http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60966
--- Comment #6 from Thomas Sanchez <thomas.sanchz at gmail dot com> --- Last comment on myself: I got some errors relates to the promise with valgrind but they do not cause an hangs ==30999== Thread 2: ==30999== Invalid read of size 4 ==30999== at 0x4E44A91: pthread_once (pthread_once.S:111) ==30999== by 0x4F4274: __gthread_once(int*, void (*)()) (gthr-default.h:699) ==30999== by 0x4FADBC: void std::call_once<void (std::__future_base::_State_base::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>&, bool&), std::__future_base::_State_base* const, std::reference_wrapper<std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()> >, std::reference_wrapper<bool> >(std::once_flag&, void (std::__future_base::_State_base::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>&, bool&), std::__future_base::_State_base* const&&, std::reference_wrapper<std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()> >&&, std::reference_wrapper<bool>&&) (mutex:786) ==30999== by 0x4F75A2: std::__future_base::_State_base::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>, bool) (future:358) ==30999== by 0x50B666: std::promise<void>::set_value() (future:1197) ==30999== by 0x506E1F: HTTPP::HTTP::client::detail::Manager::check_handles(std::promise<void>&) (Manager.cpp:87) ==30999== by 0x51D9A6: void std::_Mem_fn<void (HTTPP::HTTP::client::detail::Manager::*)(std::promise<void>&)>::operator()<std::promise<void>&, void>(HTTPP::HTTP::client::detail::Manager*, std::promise<void>&) const (in /home/daedric/perso/httpp/build/tests/client/Test_Client_promise) ==30999== by 0x51CFBE: void std::_Bind<std::_Mem_fn<void (HTTPP::HTTP::client::detail::Manager::*)(std::promise<void>&)> (HTTPP::HTTP::client::detail::Manager*, std::reference_wrapper<std::promise<void> >)>::__call<void, , 0ul, 1ul>(std::tuple<>&&, std::_Index_tuple<0ul, 1ul>) (functional:1296) ==30999== by 0x51C4FF: void std::_Bind<std::_Mem_fn<void (HTTPP::HTTP::client::detail::Manager::*)(std::promise<void>&)> (HTTPP::HTTP::client::detail::Manager*, std::reference_wrapper<std::promise<void> >)>::operator()<, void>() (functional:1355) ==30999== by 0x51B594: void boost::asio::asio_handler_invoke<std::_Bind<std::_Mem_fn<void (HTTPP::HTTP::client::detail::Manager::*)(std::promise<void>&)> (HTTPP::HTTP::client::detail::Manager*, std::reference_wrapper<std::promise<void> >)> >(std::_Bind<std::_Mem_fn<void (HTTPP::HTTP::client::detail::Manager::*)(std::promise<void>&)> (HTTPP::HTTP::client::detail::Manager*, std::reference_wrapper<std::promise<void> >)>, ...) (handler_invoke_hook.hpp:64) ==30999== by 0x519E81: void boost_asio_handler_invoke_helpers::invoke<std::_Bind<std::_Mem_fn<void (HTTPP::HTTP::client::detail::Manager::*)(std::promise<void>&)> (HTTPP::HTTP::client::detail::Manager*, std::reference_wrapper<std::promise<void> >)>, std::_Bind<std::_Mem_fn<void (HTTPP::HTTP::client::detail::Manager::*)(std::promise<void>&)> (HTTPP::HTTP::client::detail::Manager*, std::reference_wrapper<std::promise<void> >)> >(std::_Bind<std::_Mem_fn<void (HTTPP::HTTP::client::detail::Manager::*)(std::promise<void>&)> (HTTPP::HTTP::client::detail::Manager*, std::reference_wrapper<std::promise<void> >)>&, std::_Bind<std::_Mem_fn<void (HTTPP::HTTP::client::detail::Manager::*)(std::promise<void>&)> (HTTPP::HTTP::client::detail::Manager*, std::reference_wrapper<std::promise<void> >)>&) (handler_invoke_helpers.hpp:37) ==30999== by 0x51B6CE: boost::asio::detail::completion_handler<std::_Bind<std::_Mem_fn<void (HTTPP::HTTP::client::detail::Manager::*)(std::promise<void>&)> (HTTPP::HTTP::client::detail::Manager*, std::reference_wrapper<std::promise<void> >)> >::do_complete(boost::asio::detail::task_io_service*, boost::asio::detail::task_io_service_operation*, boost::system::error_code const&, unsigned long) (completion_handler.hpp:68) ==30999== Address 0xdbd3b54 is 132 bytes inside a block of size 136 free'd ==30999== at 0x4C2C2BC: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==30999== by 0x504C41: __gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<std::__future_base::_State_base, std::allocator<std::__future_base::_State_base>, (__gnu_cxx::_Lock_policy)2> >::deallocate(std::_Sp_counted_ptr_inplace<std::__future_base::_State_base, std::allocator<std::__future_base::_State_base>, (__gnu_cxx::_Lock_policy)2>*, unsigned long) (new_allocator.h:110) ==30999== by 0x5045F2: std::allocator_traits<std::allocator<std::_Sp_counted_ptr_inplace<std::__future_base::_State_base, std::allocator<std::__future_base::_State_base>, (__gnu_cxx::_Lock_policy)2> > >::deallocate(std::allocator<std::_Sp_counted_ptr_inplace<std::__future_base::_State_base, std::allocator<std::__future_base::_State_base>, (__gnu_cxx::_Lock_policy)2> >&, std::_Sp_counted_ptr_inplace<std::__future_base::_State_base, std::allocator<std::__future_base::_State_base>, (__gnu_cxx::_Lock_policy)2>*, unsigned long) (alloc_traits.h:377) ==30999== by 0x505D85: std::_Sp_counted_ptr_inplace<std::__future_base::_State_base, std::allocator<std::__future_base::_State_base>, (__gnu_cxx::_Lock_policy)2>::_M_destroy() (shared_ptr_base.h:417) ==30999== by 0x4F2A51: std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() (shared_ptr_base.h:161) ==30999== by 0x4F1CC4: std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() (shared_ptr_base.h:546) ==30999== by 0x4F15F3: std::__shared_ptr<std::__future_base::_State_base, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr() (shared_ptr_base.h:781) ==30999== by 0x4F160D: std::shared_ptr<std::__future_base::_State_base>::~shared_ptr() (shared_ptr.h:93) ==30999== by 0x50B491: std::promise<void>::~promise() (future:1136) ==30999== by 0x5071C3: HTTPP::HTTP::client::detail::Manager::~Manager() (Manager.cpp:121) ==30999== by 0x4F2F2B: std::default_delete<HTTPP::HTTP::client::detail::Manager>::operator()(HTTPP::HTTP::client::detail::Manager*) const (unique_ptr.h:67) ==30999== by 0x4F262F: std::unique_ptr<HTTPP::HTTP::client::detail::Manager, std::default_delete<HTTPP::HTTP::client::detail::Manager> >::reset(HTTPP::HTTP::client::detail::Manager*) (unique_ptr.h:262)