Boost C++ Libraries: Ticket #5045: epoll_reactor::update_timeout() uses incorrect interrupter if TIMERFD is not available https://svn.boost.org/trac10/ticket/5045 <p> Fix: Change the final line of epoll_reactor::update_timeout() from: interrupter_.interrupt(); </p> <p> to: interrupt(); </p> <p> Description: </p> <p> The linux epoll implementation of ASIO creates a fifo pipe for interrupting the epoll_wait() during exceptional events such as a timed event. Unlike other implementations, the epoll implementation doesn't actually use a write to the pipe as the triggering mechanism. Instead, a single write is performed on construction and the pipe is never read. Subsequent triggering is handled by using epoll_ctl(fd, EPOLL_CTL_MOD, fd, EPOLLIN | EPOLLERR | EPOLLET) to effectively reset the event. While this appears to be undocumented functionality of epoll_ctl(), it does appear to work. </p> <p> However, since the code never reads from the FIFO pipe and the pipe has a maximum buffer of 65535 bytes in current linux kernels, it's vital that the pipe not continue to be written to. epoll_reactor::update_timeout() violates this in the code path where BOOST_ASIO_HAS_TIMERFD is not defined (linux kernels older than about 2.6.22) by calling interrupter_.interrupt() rather than epoll_reactor::interrupt() - which generates an interrupt event by writing a single byte to the pipe. </p> <p> After 65534 calls (less on earlier kernels) to update_timeout() on the same reactor the pipe will be full and future calls will be unable to write to the pipe, which causes the interrupt to not occur. In certain cases (such as a write-only service_io thread) this can manifest itself as extremely long periods of non-responsiveness. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5045 Trac 1.4.3 chris_kohlhoff Sat, 15 Jan 2011 09:32:17 GMT <link>https://svn.boost.org/trac10/ticket/5045#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5045#comment:1</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/68169" title="Use correct interrupt method when timerfd is not available. Refs #5045">[68169]</a>) Use correct interrupt method when timerfd is not available. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5045" title="#5045: Bugs: epoll_reactor::update_timeout() uses incorrect interrupter if TIMERFD ... (closed: fixed)">#5045</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>chris_kohlhoff</dc:creator> <pubDate>Mon, 17 Jan 2011 04:31:15 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/5045#comment:2 https://svn.boost.org/trac10/ticket/5045#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/68200" title="Merge from trunk: * Update copyright notice. * Version bump. * Fix ...">[68200]</a>) Merge from trunk: </p> <ul><li>Update copyright notice. </li></ul><ul><li>Version bump. </li></ul><ul><li>Fix out-of-bounds address_v4::broadcast() return value on 64-bit systems. </li></ul><ul><li>Use correct interrupt method when timerfd is not available. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5045" title="#5045: Bugs: epoll_reactor::update_timeout() uses incorrect interrupter if TIMERFD ... (closed: fixed)">#5045</a> </li></ul> Ticket