Re: [Boost-bugs] [Boost C++ Libraries] #7611: segfault in epoll_reactor.ipp

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #7611: segfault in epoll_reactor.ipp
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-06-13 19:28:26


#7611: segfault in epoll_reactor.ipp
-------------------------------------------------+-------------------------
  Reporter: Fredrik Jansson | Owner:
  <fredrik.jansson.se@…> | chris_kohlhoff
      Type: Bugs | Status: closed
 Milestone: To Be Determined | Component: asio
   Version: Boost 1.52.0 | Severity: Problem
Resolution: invalid | Keywords:
-------------------------------------------------+-------------------------

Comment (by anonymous):

 I am running into a similar issue (using asio http server)

 Thread 1 (the main thread) segfaulting in the same spot as the OP while
 trying to shutdown the server.

 #0 0x00000000005a6667 in
 boost::asio::detail::epoll_reactor::deregister_descriptor (this=0x979c90,
 descriptor=41, descriptor_data=@0x7fffe4003e68: 0x0, closing=false) at
 /usr/include/boost/asio/detail/impl/epoll_reactor.ipp:309
 #1 0x000000000066068e in
 boost::asio::detail::reactive_socket_service_base::close (this=0x979e18,
 impl=..., ec=...) at
 /usr/include/boost/asio/detail/impl/reactive_socket_service_base.ipp:104
 #2 0x000000000066e1b2 in
 boost::asio::stream_socket_service<boost::asio::ip::tcp>::close
 (this=0x979df0, impl=..., ec=...) at
 /usr/include/boost/asio/stream_socket_service.hpp:170
 #3 0x000000000066da0a in boost::asio::basic_socket<boost::asio::ip::tcp,
 boost::asio::stream_socket_service<boost::asio::ip::tcp> >::close
 (this=0x7fffe4003e60) at /usr/include/boost/asio/basic_socket.hpp:356
 #4 0x000000000066af48 in http::server::connection::stop
 (this=0x7fffe4003e50) at src/main/include/asio_http/connection.cc:35
 #5 0x00000000006693b3 in http::server::connection_manager::stop_all
 (this=0x978560) at src/main/include/asio_http/connection_manager.cc:35
 #6 0x000000000065a24e in http::server::server::stop (this=0x978510) at
 src/main/include/asio_http/server.cc:104

 Thread 2 (detached thread) started from thread 1 earlier in the
 application, waiting for thread 3 to return.
 Thread 3 (detached thread) started from thread 2, running server.run()

 #0 __lll_lock_wait () at
 ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
 #1 0x00007ffff7bc3dbd in __GI___pthread_mutex_lock (mutex=0x7fffe4003d68)
 at ../nptl/pthread_mutex_lock.c:80
 #2 0x00000000005a5dea in boost::asio::detail::posix_mutex::lock
 (this=0x7fffe4003d68) at /usr/include/boost/asio/detail/posix_mutex.hpp:52
 #3 0x000000000065e9b7 in
 boost::asio::detail::epoll_reactor::descriptor_state::perform_io
 (this=0x7fffe4003d40, events=1) at
 /usr/include/boost/asio/detail/impl/epoll_reactor.ipp:610
 #4 0x000000000065eb57 in
 boost::asio::detail::epoll_reactor::descriptor_state::do_complete
 (owner=0x976050, base=0x7fffe4003d40, ec=..., bytes_transferred=1) at
 /usr/include/boost/asio/detail/impl/epoll_reactor.ipp:649
 #5 0x000000000065ce0e in
 boost::asio::detail::task_io_service_operation::complete
 (this=0x7fffe4003d40, owner=..., ec=..., bytes_transferred=1) at
 /usr/include/boost/asio/detail/task_io_service_operation.hpp:38
 #6 0x000000000065f78f in boost::asio::detail::task_io_service::do_run_one
 (this=0x976050, lock=..., this_thread=..., ec=...) at
 /usr/include/boost/asio/detail/impl/task_io_service.ipp:372
 #7 0x000000000065f1c9 in boost::asio::detail::task_io_service::run
 (this=0x976050, ec=...) at
 /usr/include/boost/asio/detail/impl/task_io_service.ipp:149
 #8 0x000000000065f9e2 in boost::asio::io_service::run (this=0x978510) at
 /usr/include/boost/asio/impl/io_service.ipp:59
 #9 0x0000000000659ff0 in http::server::server::run (this=0x978510) at
 src/main/include/asio_http/server.cc:64
 server thread and some other threads and waits for them to return.

 Although thread 3 can also be in other parts of the code when this occurs.

 #0 0x00007ffff5edbe23 in epoll_wait () at ../sysdeps/unix/syscall-
 template.S:84
 #1 0x000000000065e319 in boost::asio::detail::epoll_reactor::run
 (this=0x979c90, block=true, ops=...) at
 /usr/include/boost/asio/detail/impl/epoll_reactor.ipp:392
 #2 0x000000000065f70b in boost::asio::detail::task_io_service::do_run_one
 (this=0x976050, lock=..., this_thread=..., ec=...) at
 /usr/include/boost/asio/detail/impl/task_io_service.ipp:356
 #3 0x000000000065f1c9 in boost::asio::detail::task_io_service::run
 (this=0x976050, ec=...) at
 /usr/include/boost/asio/detail/impl/task_io_service.ipp:149
 #4 0x000000000065f9e2 in boost::asio::io_service::run (this=0x978510) at
 /usr/include/boost/asio/impl/io_service.ipp:59
 #5 0x0000000000659ff0 in http::server::server::run (this=0x978510) at
 src/main/include/asio_http/server.cc:64

 This occurs after the server has been running for some time (serving data
 without issue), and only during the shutdown sequence. I have done no
 modifications to the asio http server code and am using libcurl to do all
 of the transactions (which are done by thread 1 before the shutdown is
 called.) Making the changes in the OP does seem to resolve the issue.

--
Ticket URL: <https://svn.boost.org/trac10/boost/ticket/7611#comment:7>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-06-13 19:34:29 UTC