Patch to fix exception safety in boost::asio::ip::tcp::acceptor::async_accept when running the epoll reactor. ---- Steps to recreate the patch: 1) Original boost sources in the directory: packages\3rdParty\boost\\src\original\boost_\... 2) Modified sources in: packages\3rdParty\boost\\src\patched\boost_\... 3) Cygwin console, in folder: packages/3rdParty/boost//src 4) Patch generated as: diff -Nru original patched > boost_asio_epoll_accept_exception_safety.patch 5) This note added to the patch file diff -Nru original/boost_1_57_0/boost/asio/detail/impl/epoll_reactor.ipp patched/boost_1_57_0/boost/asio/detail/impl/epoll_reactor.ipp --- original/boost_1_57_0/boost/asio/detail/impl/epoll_reactor.ipp 2014-10-17 15:49:08.000000000 -0700 +++ patched/boost_1_57_0/boost/asio/detail/impl/epoll_reactor.ipp 2015-11-26 00:54:02.486738000 -0800 @@ -569,7 +569,7 @@ struct epoll_reactor::perform_io_cleanup_on_block_exit { explicit perform_io_cleanup_on_block_exit(epoll_reactor* r) - : reactor_(r), first_op_(0) + : reactor_(r), first_op_(0), compensate_work_finished(false) { } @@ -586,7 +586,7 @@ // the fact that the task_io_service will call work_finished() once we // return. } - else + else if( compensate_work_finished ) { // No user-initiated operations have completed, so we need to compensate // for the work_finished() call that the task_io_service will make once @@ -598,6 +598,7 @@ epoll_reactor* reactor_; op_queue ops_; operation* first_op_; + bool compensate_work_finished; }; epoll_reactor::descriptor_state::descriptor_state() @@ -635,6 +636,7 @@ // be posted for later by the io_cleanup object's destructor. io_cleanup.first_op_ = io_cleanup.ops_.front(); io_cleanup.ops_.pop(); + io_cleanup.compensate_work_finished = true; return io_cleanup.first_op_; } diff -Nru original/boost_1_57_0/boost/asio/detail/task_io_service_operation.hpp patched/boost_1_57_0/boost/asio/detail/task_io_service_operation.hpp --- original/boost_1_57_0/boost/asio/detail/task_io_service_operation.hpp 2014-10-17 15:49:08.000000000 -0700 +++ patched/boost_1_57_0/boost/asio/detail/task_io_service_operation.hpp 2015-11-26 00:54:12.975835400 -0800 @@ -40,7 +40,13 @@ void destroy() { - func_(0, this, boost::system::error_code(), 0); + try + { + func_(0, this, boost::system::error_code(), 0); + } + catch(std::exception&) + { + } } protected: