when_all() on a deferred future crashes
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- cpp
- Domain
- operating-systems
Research direction
Reproduce the deferred-future example and inspect boost/thread/future.hpp at run_if_is_deferred, accumulate_run_if_is_deferred, and the when_all tuple shared state. Trace why when_all reaches the assertion, then add a regression test covering the shown call; done means the example no longer crashes and the test passes.
Written by the indexing model from the issue text.
Description
Trying to run
int q = 0;
boost::promise<int> x;
boost::future<int> fx = x.get_future();
fx.then(boost::launch::deferred, [&q](boost::future<int>&&) { q = 1; });
future<std::tuple<boost::future<int>>>&& _ = boost::when_all(std::move(fx)); // CRASH!
Yields a crash:
#0 0x00007ffff4ae1387 in raise () from /lib64/libc.so.6
#1 0x00007ffff4ae2a78 in abort () from /lib64/libc.so.6
#2 0x00007ffff4ada1a6 in __assert_fail_base () from /lib64/libc.so.6
#3 0x00007ffff4ada252 in __assert_fail () from /lib64/libc.so.6
#4 0x000000000307ceaa in boost::shared_ptr<boost::detail::shared_state<int> >::operator-> (this=0xec0eb60)
at boost/smart_ptr/shared_ptr.hpp:734
#5 0x0000000003094d85 in boost::future<int>::run_if_is_deferred (
this=0xec0eb60)
at boost/thread/future.hpp:1785
#6 0x000000000308f5f7 in boost::detail::accumulate_run_if_is_deferred<std::tuple<boost::future<int> >, 1ul>::operator() (this=0x7fffffffd77f,
t=std::tuple containing)
at boost/thread/future.hpp:5685
#7 0x0000000003086eb1 in boost::detail::future_when_all_tuple_shared_state<std::tuple<boost::future<int> >, boost::future<int>>::run_deferred() (
this=0xec0ea40)
at boost/thread/future.hpp:5726
#8 0x000000000307d24c in boost::detail::future_when_all_tuple_shared_state<std:
:tuple<boost::future<int> >, boost::future<int>>::init() (this=0xec0ea40)
at boost/thread/future.hpp:5729
#9 0x0000000003073cfd in boost::when_all<boost::future<int>>(boost::future<int>&&) (
f=<unknown type in unittests, CU 0xa5fc9, DIE 0x19fe8a>)
at boost/thread/future.hpp:5856
Which is maybe related to #112 asking for when_all to be rewritten anyway.
- Dominant language
- C++
- Stars
- 213
- Forks
- 171
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from boostorg/thread
-
Difficulty 1/5 Under an hour Newbie friendliness 65/100
-
Difficulty 3/5 1-2 days Newbie friendliness 64/100
-
Difficulty 3/5 1-2 days Newbie friendliness 42/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 58/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
google/libultrahdr#485 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
godotengine/godot#123776 ·
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 60/100
-
good first issue
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
ros2/common_interfaces#344 ·