Boost C++ Libraries: Ticket #10956: null point exception using asio based on linux https://svn.boost.org/trac10/ticket/10956 <p> I have writen a linux server application based on centos boost asio.I have created thread pool accelerating asyn asio,but it is cored down like following. <a class="missing ticket">#0</a> start_op (this=0x1196e18, impl=..., op_type=1, op=0x7fd2b01a8c30, is_continuation=&lt;value optimized out&gt;, is_non_blocking=true, noop=false) </p> <blockquote> <p> at /usr/share/server_depends/cmake/depends/net/../../../depends/net/../boost_1_56_0/boost/asio/detail/impl/epoll_reactor.ipp:219 </p> </blockquote> <p> <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> boost::asio::detail::reactive_socket_service_base::start_op (this=0x1196e18, impl=..., op_type=1, op=0x7fd2b01a8c30, is_continuation=&lt;value optimized out&gt;, is_non_blocking=true, noop=false) </p> <blockquote> <p> at /usr/share/server_depends/cmake/depends/net/../../../depends/net/../boost_1_56_0/boost/asio/detail/impl/reactive_socket_service_base.ipp:214 </p> </blockquote> <p> <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2" title="#2: Bugs: list::size should be const (closed: fixed)">#2</a> 0x00007fd2b94dc667 in async_send&lt;boost::asio::detail::consuming_buffers&lt;boost::asio::const_buffer, asio_net::shared_const_buffer&gt;, boost::asio::detail::write_op&lt;boost::asio::basic_stream_socket&lt;boost::asio::ip::tcp, boost::asio::stream_socket_service&lt;boost::asio::ip::tcp&gt; &gt;, asio_net::shared_const_buffer, boost::asio::detail::transfer_all_t, boost::_bi::bind_t&lt;void, boost::_mfi::mf2&lt;void, asio_net::<a class="missing wiki">AsioSocket</a>, boost::system::error_code const&amp;, unsigned long&gt;, boost::_bi::list3&lt;boost::_bi::value&lt;asio_net::AsioSocket*&gt;, boost::arg&lt;1&gt;, boost::arg&lt;2&gt; &gt; &gt; &gt; &gt; (this=&lt;value optimized out&gt;, ec=&lt;value optimized out&gt;, bytes_transferred=&lt;value optimized out&gt;, start=&lt;value optimized out&gt;) </p> <blockquote> <p> at /usr/share/server_depends/cmake/depends/net/../../../depends/net/../boost_1_56_0/boost/asio/detail/reactive_socket_service_base.hpp:216 </p> </blockquote> <p> <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3" title="#3: Bugs: automatic conversion and overload proble (closed: fixed)">#3</a> async_send&lt;boost::asio::detail::consuming_buffers&lt;boost::asio::const_buffer, asio_net::shared_const_buffer&gt;, boost::asio::detail::write_op&lt;boost::asio::basic_stream_socket&lt;boost::asio::ip::tcp, boost::asio::stream_socket_service&lt;boost::asio::ip::tcp&gt; &gt;, asio_net::shared_const_buffer, boost::asio::detail::transfer_all_t, boost::_bi::bind_t&lt;void, boost::_mfi::mf2&lt;void, asio_net::<a class="missing wiki">AsioSocket</a>, boost::system::error_code const&amp;, unsigned long&gt;, boost::_bi::list3&lt;boost::_bi::value&lt;asio_net::AsioSocket*&gt;, boost::arg&lt;1&gt;, boost::arg&lt;2&gt; &gt; &gt; &gt; &gt; (this=&lt;value optimized out&gt;, ec=&lt;value optimized out&gt;, bytes_transferred=&lt;value optimized out&gt;, start=&lt;value optimized out&gt;) </p> <blockquote> <p> at /usr/share/server_depends/cmake/depends/net/../../../depends/net/../boost_1_56_0/boost/asio/stream_socket_service.hpp:330 </p> </blockquote> <p> <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> async_write_some&lt;boost::asio::detail::consuming_buffers&lt;boost::asio::const_buffer, asio_net::shared_const_buffer&gt;, boost::asio::detail::write_op&lt;boost::asio::basic_stream_socket&lt;boost::asio::ip::tcp, boost::asio::stream_socket_service&lt;boost::asio::ip::tcp&gt; &gt;, asio_net::shared_const_buffer, boost::asio::detail::transfer_all_t, boost::_bi::bind_t&lt;void, boost::_mfi::mf2&lt;void, asio_net::<a class="missing wiki">AsioSocket</a>, boost::system::error_code const&amp;, unsigned long&gt;, boost::_bi::list3&lt;boost::_bi::value&lt;asio_net::AsioSocket*&gt;, boost::arg&lt;1&gt;, boost::arg&lt;2&gt; &gt; &gt; &gt; &gt; (this=&lt;value optimized out&gt;, ec=&lt;value optimized out&gt;, bytes_transferred=&lt;value optimized out&gt;, start=&lt;value optimized out&gt;) </p> <blockquote> <p> at /usr/share/server_depends/cmake/depends/net/../../../depends/net/../boost_1_56_0/boost/asio/basic_stream_socket.hpp:732 </p> </blockquote> <p> I guess that the socket writing thread starts a reactor io when the other thread closes it concurrency.Is that a bug?Does the socket closing function should add some lock to avoid it. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10956 Trac 1.4.3 viboes Fri, 13 Feb 2015 18:28:49 GMT component changed; owner set https://svn.boost.org/trac10/ticket/10956#comment:1 https://svn.boost.org/trac10/ticket/10956#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">chris_kohlhoff</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">asio</span> </li> </ul> Ticket mike.sampson@… Wed, 24 Jun 2015 14:42:11 GMT <link>https://svn.boost.org/trac10/ticket/10956#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10956#comment:2</guid> <description> <p> I just ran into this same issue today. From what I can tell, there is a race condition between epoll_reactor::deregister_descriptor/epoll_reactor::deregister_internal_descriptor and the epoll_reactor::start_op and epoll_reactor::cancel_ops routines. </p> <p> Both start_op and cancel_op check the descriptor_data for NULL before proceeding; however, this logic is not enough. If the descriptor_data is not NULL when the check is made and the code blocks while trying to acquire the descriptor_data-&gt;mutex, there is no guarantee the object is valid after acquiring the lock. Both deregister_xxx routines release the lock just before deleting and Null-ing out the descriptor_data. </p> <p> A segmentation fault occurs when trying to dereference descriptor_data. For example, when checking descriptor_data-&gt;shutdown in start_ops. </p> </description> <category>Ticket</category> </item> <item> <author>mike.sampson@…</author> <pubDate>Wed, 24 Jun 2015 15:41:30 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10956#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10956#comment:3</guid> <description> <p> After investigating further, this issue was already reported and marked "ignore" due to the fact that there is no thread-safety guarantee when closing a socket from one thread while issuing a read/write operation from another. I am adjusting my code to mutex protect these operations myself. </p> </description> <category>Ticket</category> </item> <item> <author>jesse.pepper@…</author> <pubDate>Thu, 11 Aug 2016 03:57:59 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10956#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10956#comment:4</guid> <description> <p> Can you point at the original report that was marked ignore? </p> </description> <category>Ticket</category> </item> </channel> </rss>