- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have been using flow_graph for a while and at the exit of my program, there is a wait_for_all() call on the graph. The program hangs there and cannot exit. What can i check in order to find the reason and fix this problem?
regards.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, cinar
Do you use any decrement/increment_wait_count() graph API or asynchronous features like async_node, async_msg?
Thanks, Nikita
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi,
I only use function_node s. Nothing else.
regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Then, could you, please, send a minimal reproducer for your problem and explain what you are trying to achieve?
Thanks, Nikita
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
actually it is hard to share.
I have just one graph object and several classes use this same graph for their async needs. Corresponding function nodes are called with try_put() methods.
Is there no way to understand the graph's current status, etc. before wait_for_all() call?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is no such status API for the graph as far as I know.
Ok, then how this async needs is organized? Do you use any native (non TBB thread-pool threads)? What TBB version do you use?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi,
version i use: 4.4~20151115-0ubuntu3
I have 1 long running task and 2 pthreads in addition to the graph usage. In the log, i see that their infinite loops end before wait_for_all(). (pthreads' join calls are after wait_for_all() )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Seems like this is a multiple wait issue. By default, the graph is created with default task_group context, which can lead to root task ref_count races in concurrent wait scenario. Pass appropriate task_group_context to the graph constructor:
tbb::task_group_context ctx( tbb::task_group_context::bound, tbb::task_group_context::concurrent_wait ); tbb::flow::graph g( ctx );
Also, use the latest version of TBB. We have fixed other possible hanging scenarios for the graph there.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thanks nikita. I upgraded the tbb and made the code change you recommended. I will check with these updates.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello nikita,
after the changes above (upgrade and task_group_context), i still faced this problem. Do you have anything else to recommend me to check?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi cinar,
it is hard to tell without a detailed scenario, reproducer or maybe pseudocode could help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hello nikita,
I figured out that the problem i faced has nothing to do with tbb; just my own fault. sorry for taking your time.
Best.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page