Boost C++ Libraries: Ticket #12298: epool_wait hang https://svn.boost.org/trac10/ticket/12298 <p> We use sofarpc (<a class="ext-link" href="https://github.com/baidu/sofa-pbrpc"><span class="icon">​</span>https://github.com/baidu/sofa-pbrpc</a> ) which uses boost asio as network lib. </p> <p> code like </p> <p> boost::asio::io_service io_ser; auto work = new boost::asio::io_service::work(io_ser); </p> <p> after I delete work, io_ser still in run function and never stop. so i print io_ser class member as below </p> <p> (gdb) p *(boost::asio::detail::task_io_service * const) 0x22738e0 $26 = {&lt;boost::asio::detail::service_base&lt;boost::asio::detail::task_io_service&gt;&gt; = {&lt;boost::asio::io_service::service&gt; = {&lt;boost::noncopyable_::noncopyable&gt; = {&lt;No data fields&gt;}, </p> <blockquote> <p> _vptr.service = 0xa24a90 &lt;vtable for boost::asio::detail::task_io_service+16&gt;, key_ = {type_info_ = 0xa245a0 &lt;typeinfo for boost::asio::detail::typeid_wrapper&lt;boost::asio::detail::task_io_service&gt;&gt;, </p> <blockquote> <p> id_ = 0x0}, owner_ = @0x228f6d0, next_ = 0x0}, static id = {&lt;boost::asio::io_service::id&gt; = {&lt;boost::noncopyable_::noncopyable&gt; = {&lt;No data fields&gt;}, &lt;No data fields&gt;}, &lt;No data fields&gt;}}, </p> </blockquote> </blockquote> <blockquote> <p> one_thread_ = false, mutex_ = {&lt;boost::noncopyable_::noncopyable&gt; = {&lt;No data fields&gt;}, mutex_ = {<span class="underline">data = {</span>lock = 0, <span class="underline">count = 0, </span>owner = 0, <span class="underline">nusers = 7, </span>kind = 0, <span class="underline">spins = 0, </span>list = { </p> <blockquote> <p> <span class="underline">prev = 0x0, </span>next = 0x0}}, <span class="underline">size = '\000' &lt;repeats 12 times&gt;, "\a", '\000' &lt;repeats 26 times&gt;, </span>align = 0}}, task_ = 0x2266e10, </p> </blockquote> <p> task_operation_ = {&lt;boost::asio::detail::task_io_service_operation&gt; = {next_ = 0x0, func_ = 0x0, task_result_ = 0}, &lt;No data fields&gt;}, task_interrupted_ = false, outstanding_work_ = {value_ = 3}, op_queue_ = {&lt;boost::noncopyable_::noncopyable&gt; = {&lt;No data fields&gt;}, front_ = 0x0, back_ = 0x0}, stopped_ = false, shutdown_ = false, first_idle_thread_ = 0x7f182991fce0} </p> </blockquote> <p> and I found one of the thread stack as belows Thread 6 (Thread 0x7f182a321700 (LWP 30142)): <a class="missing ticket">#0</a> 0x00007f1833fb2163 in epoll_wait () from /lib64/libc.so.6 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/1" title="#1: Bugs: boost.build causes ftjam to segfault (closed: Wont Fix)">#1</a> 0x000000000061f888 in boost::asio::detail::epoll_reactor::run (this=0x2266e10, block=&lt;optimized out&gt;, ops=...) at /usr/local/include/boost/asio/detail/impl/epoll_reactor.ipp:392 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2" title="#2: Bugs: list::size should be const (closed: fixed)">#2</a> 0x0000000000624671 in boost::asio::detail::task_io_service::do_run_one (ec=..., this_thread=..., lock=..., this=0x22738e0) at /usr/local/include/boost/asio/detail/impl/task_io_service.ipp:396 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3" title="#3: Bugs: automatic conversion and overload proble (closed: fixed)">#3</a> boost::asio::detail::task_io_service::run (this=0x22738e0, ec=...) at /usr/local/include/boost/asio/detail/impl/task_io_service.ipp:153 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4" title="#4: Bugs: any_ptr in any library documentation? (closed: Fixed)">#4</a> 0x000000000062521e in boost::asio::io_service::run (this=0x228f6d0) at /usr/local/include/boost/asio/impl/io_service.ipp:59 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5" title="#5: Bugs: shared_ptr and self-owning objects (closed: Fixed)">#5</a> sofa::pbrpc::ThreadGroupImpl::thread_run (param=0x22bf100) at src/sofa/pbrpc/thread_group_impl.h:263 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6" title="#6: Bugs: tie in utility.hpp and tuple.hpp clash. (closed: Duplicate)">#6</a> 0x00007f1834e7a9d1 in start_thread () from /lib64/libpthread.so.0 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7" title="#7: Bugs: g++ 2.96 requires NO_STRINGSTREAM (closed: Fixed)">#7</a> 0x00007f1833fb1b6d in clone () from /lib64/libc.so.6 </p> <p> because of its hanging, i want see if i see time_out parameter of epoll_wait function is -1. so i print epoll_reactor::timer_fd_ (gdb) p timer_fd_ $6 = 515 so we don't use time_out a normal value . so why epoll_wait never has a return ?? </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12298 Trac 1.4.3 baibin <406455861@…> Thu, 23 Jun 2016 10:25:15 GMT <link>https://svn.boost.org/trac10/ticket/12298#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12298#comment:1</guid> <description> <p> sorry i summit twice .same with <a class="new ticket" href="https://svn.boost.org/trac10/ticket/12297" title="#12297: Bugs: epoll_wait hang (new)">#12297</a> </p> </description> <category>Ticket</category> </item> <item> <author>baibin <406455861@…></author> <pubDate>Thu, 23 Jun 2016 10:25:16 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/12298#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12298#comment:1</guid> <description> <p> sorry i summit twice .same with <a class="new ticket" href="https://svn.boost.org/trac10/ticket/12297" title="#12297: Bugs: epoll_wait hang (new)">#12297</a> </p> </description> <category>Ticket</category> </item> <item> <author>mail2tao@…</author> <pubDate>Wed, 22 Feb 2017 06:58:01 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/12298#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12298#comment:2</guid> <description> <p> I met similar issue: All data has been sent to remote endpoint (remote endpoint has successfully received all of them), but sending callback not be called because of epoll_wait hang. </p> <p> BTW, seems the master branch has fixed this issue. </p> </description> <category>Ticket</category> </item> </channel> </rss>