Opened 7 years ago

Closed 7 years ago

#11250 closed Bugs (fixed)

future made from make_exceptional fails on assertion in destructor

Reported by: Konrad Zemek <konrad.zemek@…> Owned by: viboes
Milestone: Boost 1.60.0 Component: thread
Version: Boost 1.58.0 Severity: Problem
Keywords: make_exceptional assert Cc:

Description

A future created from make_exceptional fails an assertion during destruction:

../include/boost/thread/future.hpp:155: virtual boost::detail::shared_state_base::~shared_state_base(): Assertion `cnt_==0' failed.

The error can be reproduced by calling compute(-1) in examples/make_future.cpp

Trace:

#0  0x0000003b1f6348d7 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:55
#1  0x0000003b1f63653a in __GI_abort () at abort.c:89
#2  0x0000003b1f62d47d in __assert_fail_base (fmt=0x3b1f786cb8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
    assertion=assertion@entry=0x42a333 "cnt_==0", file=file@entry=0x42a310 "../include/boost/thread/future.hpp", 
    line=line@entry=155, 
    function=function@entry=0x42a8a0 <boost::detail::shared_state_base::~shared_state_base()::__PRETTY_FUNCTION__> "virtual boost::detail::shared_state_base::~shared_state_base()") at assert.c:92
#3  0x0000003b1f62d532 in __GI___assert_fail (assertion=0x42a333 "cnt_==0", 
    file=0x42a310 "../include/boost/thread/future.hpp", line=155, 
    function=0x42a8a0 <boost::detail::shared_state_base::~shared_state_base()::__PRETTY_FUNCTION__> "virtual boost::detail::shared_state_base::~shared_state_base()") at assert.c:101
#4  0x000000000040ddb5 in boost::detail::shared_state_base::~shared_state_base (this=0x648200, 
    __in_chrg=<optimized out>) at ../include/boost/thread/future.hpp:155
#5  0x0000000000422e0d in boost::detail::shared_state<int>::~shared_state (this=0x648200, __in_chrg=<optimized out>)
    at ../include/boost/thread/future.hpp:488
#6  0x0000000000422e3c in boost::detail::shared_state<int>::~shared_state (this=0x648200, __in_chrg=<optimized out>)
    at ../include/boost/thread/future.hpp:488
#7  0x0000000000423b0b in boost::checked_delete<boost::detail::shared_state<int> > (x=0x648200)
    at /usr/local/include/boost/core/checked_delete.hpp:34
#8  0x000000000042655e in boost::detail::sp_counted_impl_p<boost::detail::shared_state<int> >::dispose (
    this=0x6481c0) at /usr/local/include/boost/smart_ptr/detail/sp_counted_impl.hpp:78
#9  0x000000000040ac4a in boost::detail::sp_counted_base::release (this=0x6481c0)
    at /usr/local/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp:146
#10 0x000000000040ad0d in boost::detail::shared_count::~shared_count (this=0x7fffffffd8e8, 
    __in_chrg=<optimized out>) at /usr/local/include/boost/smart_ptr/detail/shared_count.hpp:443
#11 0x0000000000418c7a in boost::shared_ptr<boost::detail::shared_state<int> >::~shared_ptr (this=0x7fffffffd8e0, 
    __in_chrg=<optimized out>) at /usr/local/include/boost/smart_ptr/shared_ptr.hpp:323
#12 0x0000000000418ff2 in boost::detail::basic_future<int>::~basic_future (this=0x7fffffffd8e0, 
    __in_chrg=<optimized out>) at ../include/boost/thread/future.hpp:1189
#13 0x0000000000412882 in boost::future<int>::~future (this=0x7fffffffd8e0, __in_chrg=<optimized out>)
    at ../include/boost/thread/future.hpp:1541
#14 0x000000000040a3db in main () at make_future.cpp:100

Change History (5)

comment:1 by viboes, 7 years ago

Owner: changed from Anthony Williams to viboes
Status: newassigned

Thanks for catching this untested function.

comment:3 by viboes, 7 years ago

Milestone: To Be DeterminedBoost 1.59.0

comment:4 by viboes, 7 years ago

Milestone: Boost 1.59.0Boost 1.60.0
Note: See TracTickets for help on using tickets.