Note that there are some explanatory texts on larger screens.

plurals
  1. POOnly thread handling io_service is waiting even though async I/O operations are pending
    text
    copied!<p>Boost's ASIO dispatcher seems to have a serious problem, and I can't seem to find a workaround. The symptom is that the only thread waiting to dispatch is left in <code>pthread_cond_wait</code> feven though there are I/O operations pending that require it to block in <code>epoll_wait</code>.</p> <p>I can most easily replicate this issue by having one thread call <code>poll_one</code> in a loop until it returns zero. This can leave the thread calling <code>run</code> stuck in <code>pthread_cond_wait</code> while the thread calling <code>poll_one</code> breaks out of the loop. Presumably, the io_service is expecting that thread to return to block in <code>epoll_wait</code>, but it's under no obligation to do so and that expectation seems fatal.</p> <p>Is there a requirement that threads be statically associated with <code>io_service</code>s?</p> <p>Here's an example showing the deadlock. This is the only thread handling this io_service because the others have moved on. There are definitely socket operations pending:</p> <pre><code>#0 pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0 #1 boost::asio::detail::posix_event::wait&lt;boost::asio::detail::scoped_lock&lt;boost::asio::detail::posix_mutex&gt; &gt; (...) at /usr/include/boost/asio/detail/posix_event.hpp:80 #2 boost::asio::detail::task_io_service::do_run_one (...) at /usr/include/boost/asio/detail/impl/task_io_service.ipp:405 #3 boost::asio::detail::task_io_service::run (...) at /usr/include/boost/asio/detail/impl/task_io_service.ipp:146 </code></pre> <p>I believe the bug is as follows: If a thread servicing an I/O queue is the thread that's blocking on the I/O socket readiness check and it calls to a dispatch function, if there are any other threads blocked on the io service, it must signal. It currently only signals if there are handlers ready to run at that time. But that leaves no thread checking for socket readiness.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload