Boost C++ Libraries: Ticket #11275: Deadlock when destroying continuation future https://svn.boost.org/trac10/ticket/11275 <p> I've stumbled upon a deadlock somewhere in continuation logic. I think the trace below will show it clearly. Basically, the future's destructor waits on lock that was already locked earlier in the callstack: </p> <p> In the continuation sequence: </p> <pre class="wiki">#22 0x0000000000505283 in boost::detail::shared_state_base::do_continuation (this=0x18979d0, lock=...) at /usr/include/boost/thread/future.hpp:239 239 } (gdb) print lock $2 = (boost::unique_lock&lt;boost::mutex&gt; &amp;) @0x7f6e62783520: {m = 0x1897a10, is_locked = true} </pre><p> Later during destruction: </p> <pre class="wiki">#7 0x0000000000505083 in boost::detail::shared_state_base::dec (this=0x18979d0) at /usr/include/boost/thread/future.hpp:197 197 void dec() { boost::unique_lock&lt;boost::mutex&gt; lk(this-&gt;mutex); dec(lk); } (gdb) print lk $4 = {m = 0x1897a10, is_locked = false} </pre><p> Following is the trace from GDB. I attach my version of future.hpp for line number reference. It's the version from 71d9a0a merged with boost-1.58 tag. </p> <pre class="wiki">Thread 2 (Thread 0x7f6e62786700 (LWP 12760)): #0 __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135 #1 0x00007f6e64b8156a in _L_lock_913 () from /lib/x86_64-linux-gnu/libpthread.so.0 #2 0x00007f6e64b81390 in __GI___pthread_mutex_lock (mutex=0x1897a10) at ../nptl/pthread_mutex_lock.c:79 #3 0x000000000050236a in pthread_mutex_lock (m=0x1897a10) at /usr/include/boost/thread/pthread/mutex.hpp:62 #4 boost::mutex::lock (this=0x1897a10) at /usr/include/boost/thread/pthread/mutex.hpp:116 #5 0x000000000050f881 in boost::unique_lock&lt;boost::mutex&gt;::lock (this=0x7f6e627831f0) at /usr/include/boost/thread/lock_types.hpp:346 #6 0x000000000050f9e9 in boost::unique_lock&lt;boost::mutex&gt;::unique_lock (this=0x7f6e627831f0, m_=...) at /usr/include/boost/thread/lock_types.hpp:124 #7 0x0000000000505083 in boost::detail::shared_state_base::dec (this=0x18979d0) at /usr/include/boost/thread/future.hpp:197 #8 0x000000000052850e in boost::detail::basic_future&lt;boost::future&lt;std::unique_ptr&lt;one::clproto::ServerMessage, std::default_delete&lt;one::clproto::ServerMessage&gt; &gt; &gt; &gt;::~basic_future (this=0x1897c58, __in_chrg=&lt;optimized out&gt;) at /usr/include/boost/thread/future.hpp:1212 #9 0x000000000051f46e in boost::future&lt;boost::future&lt;std::unique_ptr&lt;one::clproto::ServerMessage, std::default_delete&lt;one::clproto::ServerMessage&gt; &gt; &gt; &gt;::~future (this=0x1897c58, __in_chrg=&lt;optimized out&gt;) at /usr/include/boost/thread/future.hpp:1822 #10 0x0000000000534fbc in boost::detail::future_unwrap_shared_state&lt;boost::future&lt;boost::future&lt;std::unique_ptr&lt;one::clproto::ServerMessage, std::default_delete&lt;one::clproto::ServerMessage&gt; &gt; &gt; &gt;, std::unique_ptr&lt;one::clproto::ServerMessage, std::default_delete&lt;one::clproto::ServerMessage&gt; &gt; &gt;::~future_unwrap_shared_state (this=0x1897b40, __in_chrg=&lt;optimized out&gt;) at /usr/include/boost/thread/future.hpp:5043 #11 0x0000000000534ff8 in boost::detail::future_unwrap_shared_state&lt;boost::future&lt;boost::future&lt;std::unique_ptr&lt;one::clproto::ServerMessage, std::default_delete&lt;one::clproto::ServerMessage&gt; &gt; &gt; &gt;, std::unique_ptr&lt;one::clproto::ServerMessage, std::default_delete&lt;one::clproto::ServerMessage&gt; &gt; &gt;::~future_unwrap_shared_state (this=0x1897b40, __in_chrg=&lt;optimized out&gt;) at /usr/include/boost/thread/future.hpp:5043 #12 0x0000000000535030 in boost::checked_delete&lt;boost::detail::future_unwrap_shared_state&lt;boost::future&lt;boost::future&lt;std::unique_ptr&lt;one::clproto::ServerMessage, std::default_delete&lt;one::clproto::ServerMessage&gt; &gt; &gt; &gt;, std::unique_ptr&lt;one::clproto::ServerMessage, std::default_delete&lt;one::clproto::ServerMessage&gt; &gt; &gt; &gt; (x=0x1897b40) at /usr/include/boost/core/checked_delete.hpp:34 #13 0x00000000005382ee in boost::detail::sp_counted_impl_p&lt;boost::detail::future_unwrap_shared_state&lt;boost::future&lt;boost::future&lt;std::unique_ptr&lt;one::clproto::ServerMessage, std::default_delete&lt;one::clproto::ServerMessage&gt; &gt; &gt; &gt;, std::unique_ptr&lt;one::clproto::ServerMessage, std::default_delete&lt;one::clproto::ServerMessage&gt; &gt; &gt; &gt;::dispose (this=0x1897880) at /usr/include/boost/smart_ptr/detail/sp_counted_impl.hpp:78 #14 0x00000000005017e2 in boost::detail::sp_counted_base::release (this=0x1897880) at /usr/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp:146 #15 0x00000000005018a5 in boost::detail::shared_count::~shared_count (this=0x7f6e5c0008c8, __in_chrg=&lt;optimized out&gt;) at /usr/include/boost/smart_ptr/detail/shared_count.hpp:443 #16 0x0000000000505114 in boost::shared_ptr&lt;boost::detail::shared_state_base&gt;::~shared_ptr (this=0x7f6e5c0008c0, __in_chrg=&lt;optimized out&gt;) at /usr/include/boost/smart_ptr/shared_ptr.hpp:323 #17 0x000000000052f13e in std::_Destroy&lt;boost::shared_ptr&lt;boost::detail::shared_state_base&gt; &gt; (__pointer=0x7f6e5c0008c0) at /usr/include/c++/4.9/bits/stl_construct.h:93 #18 0x0000000000529d5d in std::_Destroy_aux&lt;false&gt;::__destroy&lt;boost::shared_ptr&lt;boost::detail::shared_state_base&gt;*&gt; ( __first=0x7f6e5c0008c0, __last=0x7f6e5c0008d0) at /usr/include/c++/4.9/bits/stl_construct.h:103 #19 0x00000000005228f3 in std::_Destroy&lt;boost::shared_ptr&lt;boost::detail::shared_state_base&gt;*&gt; (__first=0x7f6e5c0008c0, __last=0x7f6e5c0008d0) at /usr/include/c++/4.9/bits/stl_construct.h:126 #20 0x0000000000516107 in std::_Destroy&lt;boost::shared_ptr&lt;boost::detail::shared_state_base&gt;*, boost::shared_ptr&lt;boost::detail::shared_state_base&gt; &gt; (__first=0x7f6e5c0008c0, __last=0x7f6e5c0008d0) at /usr/include/c++/4.9/bits/stl_construct.h:151 #21 0x000000000050d24f in std::vector&lt;boost::shared_ptr&lt;boost::detail::shared_state_base&gt;, std::allocator&lt;boost::shared_ptr&lt;boost::detail::shared_state_base&gt; &gt; &gt;::~vector (this=0x7f6e62783450, __in_chrg=&lt;optimized out&gt;) at /usr/include/c++/4.9/bits/stl_vector.h:424 #22 0x0000000000505283 in boost::detail::shared_state_base::do_continuation (this=0x18979d0, lock=...) at /usr/include/boost/thread/future.hpp:239 #23 0x0000000000505412 in boost::detail::shared_state_base::mark_finished_internal (this=0x18979d0, lock=...) at /usr/include/boost/thread/future.hpp:265 #24 0x0000000000544a2d in boost::detail::shared_state&lt;boost::future&lt;std::unique_ptr&lt;one::clproto::ServerMessage, std::default_delete&lt;one::clproto::ServerMessage&gt; &gt; &gt; &gt;::mark_finished_with_result_internal(boost::future&lt;std::unique_ptr&lt;one::clproto::ServerMessage, std::default_delete&lt;one::clproto::ServerMessage&gt; &gt; &gt;&amp;&amp;, boost::unique_lock&lt;boost::mutex&gt;&amp;) (this=0x18979d0, result_=&lt;unknown type in /home/kzemek/plgrid/helpers/debug/test/unit/inbox_test, CU 0xa555, DIE 0x4091f&gt;, lock=...) at /usr/include/boost/thread/future.hpp:526 #25 0x000000000054499f in boost::detail::shared_state&lt;boost::future&lt;std::unique_ptr&lt;one::clproto::ServerMessage, std::default_delete&lt;one::clproto::ServerMessage&gt; &gt; &gt; &gt;::mark_finished_with_result(boost::future&lt;std::unique_ptr&lt;one::clproto::ServerMessage, std::default_delete&lt;one::clproto::ServerMessage&gt; &gt; &gt;&amp;&amp;) (this=0x18979d0, ---Type &lt;return&gt; to continue, or q &lt;return&gt; to quit--- result_=&lt;unknown type in /home/kzemek/plgrid/helpers/debug/test/unit/inbox_test, CU 0xa555, DIE 0x4091f&gt;) at /usr/include/boost/thread/future.hpp:554 #26 0x00000000005448be in _ZN5boost6detail41future_executor_continuation_shared_stateINS_9executors17basic_thread_poolENS_6futureIvEENS4_ISt10unique_ptrIN3one7clproto13ServerMessageESt14default_deleteIS9_EEEEZNS7_13communication6layers5InboxI10LowerLayerE11communicateES6_INS8_13ClientMessageESA_ISJ_EEiEUlT_E_E3runENS_10shared_ptrINS0_17shared_state_baseEEE (that_=...) at /usr/include/boost/thread/future.hpp:4303 #27 0x0000000000544738 in _ZN5boost6detail6run_itINS0_41future_executor_continuation_shared_stateINS_9executors17basic_thread_poolENS_6futureIvEENS5_ISt10unique_ptrIN3one7clproto13ServerMessageESt14default_deleteISA_EEEEZNS8_13communication6layers5InboxI10LowerLayerE11communicateES7_INS9_13ClientMessageESB_ISK_EEiEUlT_E_EEEclEv (this=0x18978a8) at /usr/include/boost/thread/future.hpp:4274 #28 0x00000000005445ba in _ZN5boost6detail16nullary_functionIFvvEE9impl_typeINS0_6run_itINS0_41future_executor_continuation_shared_stateINS_9executors17basic_thread_poolENS_6futureIvEENS9_ISt10unique_ptrIN3one7clproto13ServerMessageESt14default_deleteISE_EEEEZNSC_13communication6layers5InboxI10LowerLayerE11communicateESB_INSD_13ClientMessageESF_ISO_EEiEUlT_E_EEEEE4callEv ( this=0x18978a0) at /usr/include/boost/thread/detail/nullary_function.hpp:52 #29 0x0000000000507245 in boost::detail::nullary_function&lt;void ()&gt;::operator()() (this=0x7f6e62783690) at /usr/include/boost/thread/detail/nullary_function.hpp:125 #30 0x00000000005072a3 in boost::executors::basic_thread_pool::worker_thread (this=0x1894ba0) at /usr/include/boost/thread/executors/basic_thread_pool.hpp:91 #31 0x000000000053f129 in boost::detail::invoke&lt;void (boost::executors::basic_thread_pool::*)(), boost::executors::basic_thread_pool&lt;&gt;*&gt;(void (boost::executors::basic_thread_pool::*&amp;&amp;)(), boost::executors::basic_thread_pool&lt;&gt;*&amp;&amp;, (boost::executors::basic_thread_pool&lt;&gt;*&amp;&amp;)...) ( f=&lt;unknown type in /home/kzemek/plgrid/helpers/debug/test/unit/inbox_test, CU 0xa555, DIE 0xa1b40&gt;, a0=&lt;unknown type in /home/kzemek/plgrid/helpers/debug/test/unit/inbox_test, CU 0xa555, DIE 0xa1b45&gt;) at /usr/include/boost/thread/detail/invoke.hpp:77 #32 0x000000000053c705 in boost::detail::thread_data&lt;void (boost::executors::basic_thread_pool::*)(), boost::executors::basic_thread_pool*&gt;::run2&lt;1ul&gt; (this=0x1894f20) at /usr/include/boost/thread/detail/thread.hpp:75 #33 0x0000000000538e5a in boost::detail::thread_data&lt;void (boost::executors::basic_thread_pool::*)(), boost::executors::basic_thread_pool*&gt;::run (this=0x1894f20) at /usr/include/boost/thread/detail/thread.hpp:81 #34 0x00007f6e64da5d8a in ?? () from /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.58.0 #35 0x00007f6e64b7f0a5 in start_thread (arg=0x7f6e62786700) at pthread_create.c:309 #36 0x00007f6e63e1ecfd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111 </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11275 Trac 1.4.3 Konrad Zemek <konrad.zemek@…> Thu, 07 May 2015 13:03:38 GMT attachment set https://svn.boost.org/trac10/ticket/11275 https://svn.boost.org/trac10/ticket/11275 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">future.hpp</span> </li> </ul> Ticket Konrad Zemek <konrad.zemek@…> Thu, 07 May 2015 13:07:31 GMT <link>https://svn.boost.org/trac10/ticket/11275#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11275#comment:1</guid> <description> <p> Replying to <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/11275" title="#11275: Support Requests: Deadlock when destroying continuation future (closed: worksforme)">Konrad Zemek &lt;konrad.zemek@…&gt;</a>: </p> <blockquote class="citation"> <p> Basically, the future's destructor waits on lock that was already locked earlier in the callstack: </p> </blockquote> <p> Just to avoid any miscommunication, I meant a mutex, not a lock. :) </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Thu, 14 May 2015 15:56:48 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11275#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11275#comment:2</guid> <description> <p> Please, could you try the develop branch in order to see if this is already fixed? I have done a lot of changes in it. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Thu, 14 May 2015 15:58:15 GMT</pubDate> <title>owner, status changed https://svn.boost.org/trac10/ticket/11275#comment:3 https://svn.boost.org/trac10/ticket/11275#comment:3 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Anthony Williams</span> to <span class="trac-author">viboes</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> Ticket Konrad Zemek <konrad.zemek@…> Sat, 16 May 2015 18:56:14 GMT <link>https://svn.boost.org/trac10/ticket/11275#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11275#comment:4</guid> <description> <p> The same deadlock happens in develop (e39703f). </p> <p> I "solved" it for testing purposes by reordering variable initialization in <code>do_continuation</code>, but it's obviously the wrong way: if the future's destructor happens-before relocker's destructor, then relocker locks an already destroyed mutex: </p> <pre class="wiki">diff --git a/include/boost/thread/future.hpp b/include/boost/thread/future.hpp index e2dcb43..16b6270 100644 --- a/include/boost/thread/future.hpp +++ b/include/boost/thread/future.hpp @@ -230,9 +230,9 @@ namespace boost void do_continuation(boost::unique_lock&lt;boost::mutex&gt;&amp; lock) { if (! continuations.empty()) { + relocker rlk(lock); continuations_type the_continuations = continuations; continuations.clear(); - relocker rlk(lock); for (continuations_type::iterator it = the_continuations.begin(); it != the_continuations.end(); ++it) { (*it)-&gt;launch_continuation(); } </pre><p> Following is the stack trace from the application using Boost.Thread from develop: </p> <pre class="wiki">#0 __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135 #1 0x00007f9a9553856a in _L_lock_913 () from /lib/x86_64-linux-gnu/libpthread.so.0 #2 0x00007f9a95538390 in __GI___pthread_mutex_lock (mutex=0x7f9a8c000ed0) at ../nptl/pthread_mutex_lock.c:79 #3 0x00000000004bb872 in pthread_mutex_lock (m=0x7f9a8c000ed0) at /usr/include/boost/thread/pthread/mutex.hpp:62 #4 boost::mutex::lock (this=0x7f9a8c000ed0) at /usr/include/boost/thread/pthread/mutex.hpp:116 #5 0x00000000004c4b83 in boost::unique_lock&lt;boost::mutex&gt;::lock (this=0x7f9a93139d30) at /usr/include/boost/thread/lock_types.hpp:346 #6 0x00000000004c4ceb in boost::unique_lock&lt;boost::mutex&gt;::unique_lock (this=0x7f9a93139d30, m_=...) at /usr/include/boost/thread/lock_types.hpp:124 #7 0x00000000004be583 in boost::detail::shared_state_base::dec (this=0x7f9a8c000e90) at /usr/include/boost/thread/future.hpp:197 #8 0x00000000004ce1ae in boost::detail::basic_future&lt;void&gt;::~basic_future (this=0x1144a68, __in_chrg=&lt;optimized out&gt;) at /usr/include/boost/thread/future.hpp:1203 #9 0x00000000004c602e in boost::future&lt;void&gt;::~future (this=0x1144a68, __in_chrg=&lt;optimized out&gt;) at /usr/include/boost/thread/future.hpp:1556 #10 0x00000000004de3c6 in boost::detail::future_unwrap_shared_state&lt;boost::future&lt;boost::future&lt;void&gt; &gt;, void&gt;::~future_unwrap_shared_state (this=0x1144950, __in_chrg=&lt;optimized out&gt;) at /usr/include/boost/thread/future.hpp:5065 #11 0x00000000004de414 in boost::detail::future_unwrap_shared_state&lt;boost::future&lt;boost::future&lt;void&gt; &gt;, void&gt;::~future_unwrap_shared_state (this=0x1144950, __in_chrg=&lt;optimized out&gt;) at /usr/include/boost/thread/future.hpp:5065 #12 0x00000000004de44c in boost::checked_delete&lt;boost::detail::future_unwrap_shared_state&lt;boost::future&lt;boost::future&lt;void&gt; &gt;, void&gt; &gt; (x=0x1144950) at /usr/include/boost/core/checked_delete.hpp:34 #13 0x00000000004e01e2 in boost::detail::sp_counted_impl_p&lt;boost::detail::future_unwrap_shared_state&lt;boost::future&lt;boost::future&lt;void&gt; &gt;, void&gt; &gt;::dispose (this=0x1144150) at /usr/include/boost/smart_ptr/detail/sp_counted_impl.hpp:78 #14 0x00000000004bab3c in boost::detail::sp_counted_base::release (this=0x1144150) at /usr/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp:146 #15 0x00000000004babff in boost::detail::shared_count::~shared_count (this=0x7f9a8c000988, __in_chrg=&lt;optimized out&gt;) at /usr/include/boost/smart_ptr/detail/shared_count.hpp:443 #16 0x00000000004becd6 in boost::shared_ptr&lt;boost::detail::shared_state_base&gt;::~shared_ptr (this=0x7f9a8c000980, __in_chrg=&lt;optimized out&gt;) at /usr/include/boost/smart_ptr/shared_ptr.hpp:323 #17 0x00000000004d98fa in std::_Destroy&lt;boost::shared_ptr&lt;boost::detail::shared_state_base&gt; &gt; ( __pointer=0x7f9a8c000980) at /usr/include/c++/4.9/bits/stl_construct.h:93 #18 0x00000000004d5d29 in std::_Destroy_aux&lt;false&gt;::__destroy&lt;boost::shared_ptr&lt;boost::detail::shared_state_base&gt;*&gt; (__first=0x7f9a8c000980, __last=0x7f9a8c000990) at /usr/include/c++/4.9/bits/stl_construct.h:103 #19 0x00000000004d070d in std::_Destroy&lt;boost::shared_ptr&lt;boost::detail::shared_state_base&gt;*&gt; ( __first=0x7f9a8c000980, __last=0x7f9a8c000990) at /usr/include/c++/4.9/bits/stl_construct.h:126 #20 0x00000000004c8587 in std::_Destroy&lt;boost::shared_ptr&lt;boost::detail::shared_state_base&gt;*, boost::shared_ptr&lt;boost::detail::shared_state_base&gt; &gt; (__first=0x7f9a8c000980, __last=0x7f9a8c000990) at /usr/include/c++/4.9/bits/stl_construct.h:151 #21 0x00000000004c255f in std::vector&lt;boost::shared_ptr&lt;boost::detail::shared_state_base&gt;, std::allocator&lt;boost::shared_ptr&lt;boost::detail::shared_state_base&gt; &gt; &gt;::~vector (this=0x7f9a93139f80, __in_chrg=&lt;optimized out&gt;) at /usr/include/c++/4.9/bits/stl_vector.h:424 #22 0x00000000004be6f0 in boost::detail::shared_state_base::do_continuation (this=0x7f9a8c000e90, lock=...) at /usr/include/boost/thread/future.hpp:238 #23 0x00000000004be860 in boost::detail::shared_state_base::mark_finished_internal (this=0x7f9a8c000e90, lock=...) at /usr/include/boost/thread/future.hpp:264 #24 0x00000000004beea5 in boost::detail::shared_state&lt;void&gt;::mark_finished_with_result_internal ( this=0x7f9a8c000e90, lock=...) at /usr/include/boost/thread/future.hpp:716 #25 0x00000000004e0761 in boost::detail::future_unwrap_shared_state&lt;boost::future&lt;boost::future&lt;void&gt; &gt;, void&gt;::launch_continuation (this=0x7f9a8c000e90) at /usr/include/boost/thread/future.hpp:5096 #26 0x00000000004be6a5 in boost::detail::shared_state_base::do_continuation (this=0x7f9a8c0012e0, lock=...) at /usr/include/boost/thread/future.hpp:237 #27 0x00000000004be860 in boost::detail::shared_state_base::mark_finished_internal (this=0x7f9a8c0012e0, lock=...) at /usr/include/boost/thread/future.hpp:264 #28 0x00000000004beea5 in boost::detail::shared_state&lt;void&gt;::mark_finished_with_result_internal ( this=0x7f9a8c0012e0, lock=...) at /usr/include/boost/thread/future.hpp:716 #29 0x00000000004e0761 in boost::detail::future_unwrap_shared_state&lt;boost::future&lt;boost::future&lt;void&gt; &gt;, void&gt;::launch_continuation (this=0x7f9a8c0012e0) at /usr/include/boost/thread/future.hpp:5096 #30 0x00000000004be6a5 in boost::detail::shared_state_base::do_continuation (this=0x7f9a8c000a20, lock=...) at /usr/include/boost/thread/future.hpp:237 #31 0x00000000004be785 in boost::detail::shared_state_base::set_continuation_ptr (this=0x7f9a8c000a20, continuation=..., lock=...) at /usr/include/boost/thread/future.hpp:251 #32 0x00000000004e0675 in boost::detail::future_unwrap_shared_state&lt;boost::future&lt;boost::future&lt;void&gt; &gt;, void&gt;::launch_continuation (this=0x7f9a8c0012e0) at /usr/include/boost/thread/future.hpp:5087 #33 0x00000000004be6a5 in boost::detail::shared_state_base::do_continuation (this=0x7f9a8c0010d0, lock=...) at /usr/include/boost/thread/future.hpp:237 #34 0x00000000004be860 in boost::detail::shared_state_base::mark_finished_internal (this=0x7f9a8c0010d0, lock=...) at /usr/include/boost/thread/future.hpp:264 #35 0x00000000004e83ef in boost::detail::shared_state&lt;boost::future&lt;void&gt; &gt;::mark_finished_with_result_internal(boost::future&lt;void&gt;&amp;&amp;, boost::unique_lock&lt;boost::mutex&gt;&amp;) (this=0x7f9a8c0010d0, result_=&lt;unknown type in /home/konrad/plgrid/helpers/debug/test/unit/retrier_test, CU 0xa555, DIE 0x37494&gt;, lock=...) at /usr/include/boost/thread/future.hpp:525 #36 0x00000000004e8361 in boost::detail::shared_state&lt;boost::future&lt;void&gt; &gt;::mark_finished_with_result(boost::future&lt;void&gt;&amp;&amp;) (this=0x7f9a8c0010d0, result_=&lt;unknown type in /home/konrad/plgrid/helpers/debug/test/unit/retrier_test, CU 0xa555, DIE 0x37494&gt;) at /usr/include/boost/thread/future.hpp:553 #37 0x00000000004e8280 in _ZN5boost6detail41future_executor_continuation_shared_stateINS_9executors17basic_thread_poolENS_6futureIvEES5_ZN3one13communication6layers7RetrierI10LowerLayerE4sendESsiEUlT_E_E3runENS_10shared_ptrINS0_17shared_state_baseEEE (that_=...) at /usr/include/boost/thread/future.hpp:4284 #38 0x00000000004e80fa in _ZN5boost6detail6run_itINS0_41future_executor_continuation_shared_stateINS_9executors17basic_thread_poolENS_6futureIvEES6_ZN3one13communication6layers7RetrierI10LowerLayerE4sendESsiEUlT_E_EEEclEv ( this=0x7f9a8c001268) at /usr/include/boost/thread/future.hpp:4256 #39 0x00000000004e7f7c in _ZN5boost6detail16nullary_functionIFvvEE9impl_typeINS0_6run_itINS0_41future_executor_continuation_shared_stateINS_9executors17basic_thread_poolENS_6futureIvEESA_ZN3one13communication6layers7RetrierI10LowerLayerE4sendESsiEUlT_E_EEEEE4callEv (this=0x7f9a8c001260) at /usr/include/boost/thread/detail/nullary_function.hpp:52 #40 0x00000000004bf6af in boost::detail::nullary_function&lt;void ()&gt;::operator()() (this=0x7f9a9313a690) at /usr/include/boost/thread/detail/nullary_function.hpp:125 #41 0x00000000004bf70d in boost::executors::basic_thread_pool::worker_thread (this=0x1145ac0) at /usr/include/boost/thread/executors/basic_thread_pool.hpp:91 #42 0x00000000004e53d7 in boost::detail::invoke&lt;void (boost::executors::basic_thread_pool::*)(), boost::executors::basic_thread_pool&lt;&gt;*&gt;(void (boost::executors::basic_thread_pool::*&amp;&amp;)(), boost::executors::basic_thread_pool&lt;&gt;*&amp;&amp;, (boost::executors::basic_thread_pool&lt;&gt;*&amp;&amp;)...) ( f=&lt;unknown type in /home/konrad/plgrid/helpers/debug/test/unit/retrier_test, CU 0xa555, DIE 0x75e98&gt;, a0=&lt;unknown type in /home/konrad/plgrid/helpers/debug/test/unit/retrier_test, CU 0xa555, DIE 0x75e9d&gt;) at /usr/include/boost/thread/detail/invoke.hpp:77 #43 0x00000000004e3687 in boost::detail::thread_data&lt;void (boost::executors::basic_thread_pool::*)(), boost::executors::basic_thread_pool*&gt;::run2&lt;1ul&gt; (this=0x1145ca0) at /usr/include/boost/thread/detail/thread.hpp:75 #44 0x00000000004e0ad0 in boost::detail::thread_data&lt;void (boost::executors::basic_thread_pool::*)(), boost::executors::basic_thread_pool*&gt;::run (this=0x1145ca0) at /usr/include/boost/thread/detail/thread.hpp:81 #45 0x00007f9a9575cd8a in ?? () from /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.58.0 #46 0x00007f9a955360a5 in start_thread (arg=0x7f9a9313d700) at pthread_create.c:309 #47 0x00007f9a94d3dcfd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111 </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Mon, 01 Jun 2015 17:29:57 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11275#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11275#comment:5</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/11275#comment:4" title="Comment 4">Konrad Zemek &lt;konrad.zemek@…&gt;</a>: </p> <blockquote class="citation"> <p> The same deadlock happens in develop (e39703f). </p> <p> I "solved" it for testing purposes by reordering variable initialization in <code>do_continuation</code>, but it's obviously the wrong way: if the future's destructor happens-before relocker's destructor, then relocker locks an already destroyed mutex: </p> </blockquote> <p> I need to check if this situation is possible. Thanks for signaling it. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sat, 05 Sep 2015 14:54:23 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11275#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11275#comment:6</guid> <description> <p> The code in develop (or &gt;=boost.1.58) contains now </p> <pre class="wiki">#if defined BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION void do_continuation(boost::unique_lock&lt;boost::mutex&gt;&amp; lock) { if (! continuations.empty()) { continuations_type the_continuations = continuations; continuations.clear(); relocker rlk(lock); for (continuations_type::iterator it = the_continuations.begin(); it != the_continuations.end(); ++it) { (*it)-&gt;launch_continuation(); } } } #else void do_continuation(boost::unique_lock&lt;boost::mutex&gt;&amp;) { } #endif </pre><p> Please could you give a try? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Tue, 08 Sep 2015 17:22:39 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11275#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11275#comment:7</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/11275#comment:6" title="Comment 6">viboes</a>: </p> <blockquote class="citation"> <p> The code in develop (or &gt;=boost.1.58) contains now </p> <pre class="wiki">#if defined BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION void do_continuation(boost::unique_lock&lt;boost::mutex&gt;&amp; lock) { if (! continuations.empty()) { continuations_type the_continuations = continuations; continuations.clear(); relocker rlk(lock); for (continuations_type::iterator it = the_continuations.begin(); it != the_continuations.end(); ++it) { (*it)-&gt;launch_continuation(); } } } #else void do_continuation(boost::unique_lock&lt;boost::mutex&gt;&amp;) { } #endif </pre><p> Please could you give a try? </p> </blockquote> <p> Forget this message :( </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sun, 15 Nov 2015 00:02:38 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11275#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11275#comment:8</guid> <description> <p> Hi, </p> <p> we have fixed some issues with in future.hpp (<a class="ext-link" href="https://github.com/boostorg/thread/commit/60a8cb9b5c69423ee0bea403cacc971606575f01"><span class="icon">​</span>https://github.com/boostorg/thread/commit/60a8cb9b5c69423ee0bea403cacc971606575f01</a>). </p> <p> Please, could you check with the develop branch? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sat, 05 Mar 2016 09:39:53 GMT</pubDate> <title>type changed https://svn.boost.org/trac10/ticket/11275#comment:9 https://svn.boost.org/trac10/ticket/11275#comment:9 <ul> <li><strong>type</strong> <span class="trac-field-old">Bugs</span> → <span class="trac-field-new">Support Requests</span> </li> </ul> <p> Moved to support until we have some news. </p> Ticket viboes Sat, 03 Sep 2016 13:16:42 GMT status changed; resolution set; milestone deleted https://svn.boost.org/trac10/ticket/11275#comment:10 https://svn.boost.org/trac10/ticket/11275#comment:10 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">worksforme</span> </li> <li><strong>milestone</strong> <span class="trac-field-deleted">To Be Determined</span> </li> </ul> <p> I believe this issue has already been fixed. </p> <p> Please reopen it if it is not the case. </p> Ticket