Boost C++ Libraries: Ticket #6005: Potential epoll fd leak in boost::asio::detail::epoll_reactor https://svn.boost.org/trac10/ticket/6005 <p> in boost/asio/detail/impl/epoll_reactor.ipp: </p> <p> epoll_reactor::epoll_reactor(boost::asio::io_service&amp; io_service) </p> <blockquote> <p> : boost::asio::detail::service_base&lt;epoll_reactor&gt;(io_service), </p> <blockquote> <p> io_service_(use_service&lt;io_service_impl&gt;(io_service)), mutex_(), epoll_fd_(do_epoll_create()), ------&gt; epoll_fd_ may leak if the following member's initialization throws an exception timer_fd_(do_timerfd_create()), interrupter_(), ------&gt; may throw because of EMFILE shutdown_(false) </p> </blockquote> </blockquote> <p> { </p> <blockquote> <p> <em> Add the interrupter's descriptor to epoll. epoll_event ev = { 0, { 0 } }; ev.events = EPOLLIN | EPOLLERR | EPOLLET; ev.data.ptr = &amp;interrupter_; epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, interrupter_.read_descriptor(), &amp;ev); interrupter_.interrupt(); </em></p> </blockquote> <blockquote> <p> <em> Add the timer descriptor to epoll. if (timer_fd_ != -1) { </em></p> <blockquote> <p> ev.events = EPOLLIN | EPOLLERR; ev.data.ptr = &amp;timer_fd_; epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, timer_fd_, &amp;ev); </p> </blockquote> <p> } </p> </blockquote> <p> } </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6005 Trac 1.4.3 yafei.zhang@… Tue, 11 Oct 2011 03:02:45 GMT attachment set https://svn.boost.org/trac10/ticket/6005 https://svn.boost.org/trac10/ticket/6005 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">epoll_reactor.hpp.patch_1.40.0</span> </li> </ul> <p> only for boost 1.40.0 </p> Ticket anonymous Tue, 11 Oct 2011 03:06:54 GMT version changed https://svn.boost.org/trac10/ticket/6005#comment:1 https://svn.boost.org/trac10/ticket/6005#comment:1 <ul> <li><strong>version</strong> <span class="trac-field-old">Boost 1.47.0</span> → <span class="trac-field-new">Boost 1.40.0</span> </li> </ul> <p> my patch only works, but it may not be the boost way and not graceful enough. </p> Ticket anonymous Tue, 11 Oct 2011 03:12:52 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/6005#comment:2 https://svn.boost.org/trac10/ticket/6005#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">invalid</span> </li> </ul> Ticket