Opened 8 years ago

Closed 8 years ago

#10387 closed Bugs (wontfix)

Strange infinite wait in log\sinks\async_frontend.hpp

Reported by: Antony Polukhin Owned by: Andrey Semashev
Milestone: To Be Determined Component: log
Version: Boost 1.56.0 Severity: Problem
Keywords: log async condition wait Cc:

Description

void asynchronous_sink::stop() waits for eternity on m_BlockCond.wait(lock); line. When the call m_BlockCond.wait(lock); occurs according to VisualStudio debugger there is no others running threads, so no one could send a signal.

I've failed to create a minimal test case, but here is what happens according to debugger:

  • main thread exits the main() and enters the internal __crtExitProcess(code); function (line 639 in Microsoft Visual Studio 11.0\VC\crt\src\crt0dat.c)
  • Somewhere in depths of ExitProcess(status) the m_DedicatedFeedingThread silently disappears. Looks like this happens at the point when m_event.wait(); is called (line 115 in boost\log\sinks\unbounded_fifo_queue.hpp)
  • void asynchronous_sink::stop() is called from the main thread
  • main thread waits on m_BlockCond.wait(lock); for eternity (according to the debugger there's no more threads remain, only the main thread)

If boost::log::core::get()->remove_all_sinks(); is called before exiting the main, application does not hang.

Change History (1)

comment:1 by Andrey Semashev, 8 years ago

Resolution: wontfix
Status: newclosed

If the feeding thread disappears, it is most probably cancelled by the system. I don't know Windows internals very well, but if that's the case then the hang is possible. Boost.Log does not support cancelling threads, during runtime or termination, so I'll mark it as "wont fix". You can use the remove_all_sinks() call to resolve the problem.

Note: See TracTickets for help on using tickets.