Community
cancel
Showing results for 
Search instead for 
Did you mean: 
cinar_e_
Beginner
145 Views

flow graph hangs at wait_for_all

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.

0 Kudos
11 Replies
Nikita_P_Intel
Employee
145 Views

Hi, cinar

Do you use any decrement/increment_wait_count() graph API or asynchronous features like async_node, async_msg?

Thanks, Nikita

cinar_e_
Beginner
145 Views

hi,

I only use function_node s. Nothing else.

 

regards.

Nikita_P_Intel
Employee
145 Views

Then, could you, please, send a minimal reproducer for your problem and explain what you are trying to achieve?

Thanks, Nikita

cinar_e_
Beginner
145 Views

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?

Nikita_P_Intel
Employee
145 Views

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?

cinar_e_
Beginner
145 Views

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() )

 

 

Nikita_P_Intel
Employee
145 Views

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.

cinar_e_
Beginner
145 Views

thanks nikita. I upgraded the tbb and made the code change you recommended. I will check with these updates.

cinar_e_
Beginner
145 Views

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?

Nikita_P_Intel
Employee
145 Views

Hi cinar,

it is hard to tell without a detailed scenario, reproducer or maybe pseudocode could help.

cinar_e_
Beginner
145 Views

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.

Reply