You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Prevent EventLoop async cleanup thread early exit during shutdown
Antoine Poinsot <[email protected]> reported a bug with details in
#182 (comment)
where an IPC client rapidly connecting and disconnecting to the server in a
loop could cause problems.
One problem, fixed by this commit, was that if a server process is shutting
down, the async cleanup thread in `EventLoop::startAsyncThread` responsible for
destroying unused server object on unclean disconnects could detect the done()
condition and decide to exit right before a new incoming connection is
processed, and exit prematurely when there might be more cleanup work for it
do. If this happens, process shutdown could hang waiting for cleanup work that
will never be completed.
This commit fixes that problem by changing the `EventLoop::startAsyncThread()`
while condition to check whether the `EventLoop::loop() method has _exited_,
instead of checking whether it is about to exit. Specifically the change makes
the `m_async_fns` list into a `std::optional` value and sets it to `nullopt`
when the `loop()` method exits.
0 commit comments