Boost logo

Boost :

From: Niklas Gürtler (profclonk_at_[hidden])
Date: 2020-05-11 09:58:42


Hello boost developers,

I found a bug in Boost.Asio on Windows using IOCP that can make the
service_registry::do_use_service block forever if a service with the same
key was created and registered while the mutex was unlocked. If the service
uses win_iocp_io_context, its destructor (implicitly called upon return, by
destroying new_service) will join() the internal thread for IOCP handling,
without requesting it to stop before. This will leave both threads to block
forever, while the mutex_ is still locked (lock's destructor may be called
after new_services), which may cause further blockages in other threads. I
submitted a PR ( https://github.com/boostorg/asio/pull/350 ) which aims to
fix this by calling shutdown() on the thread before returning, and
unlocking the mutex explicitly before that. Another solution would be to
call shutdown() from within win_iocp_io_context::~win_iocp_io_context().

Regards,
Niklas Gürtler


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk