Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.

Dump of all waiting tasks

jiri
New Contributor I
224 Views

Hi,

I'm building a library on top of TBB's task scheduler. From time to time, the library gets stuck, because of some synchronization issus related to tasks or simply because there is something wrong with the way tasks (and the dependencies in the task graph) are created. This usually means that the main thread is waiting for the root task to finish, but that never happens, because dute to some error (in my library), the continuation of the root task is never spawned.

In other words, after some time, the application reaches state where there are no running tasks, but there are multiple tasks waiting to be spawn, but they are bound to wait indefinitely.

Is there a way to dump such tasks? I know that TBB uses its own mechanisms to create tasks, so it may be aware of all the tasks that have been allocated. Since the dump would be done in a situation where there are no ready (spawned or enqueued) tasks, synchronization should probably not be an issue.

At the moment, I have my own solution that tracks task creation and destruction, but since it is outside of TBB, it requires changes to the application code to make sure all tasks are tracked correctly. It also introduces a bottleneck for the whole application, which is acceptable as it is only used for debugging, but it is still not very nice, as the serialization imposed on some operations may hide race conditions.

0 Kudos
2 Replies
RafSchietekat
Valued Contributor III
224 Views

Fuhgeddaboudit!

0 Kudos
jiri
New Contributor I
224 Views

After some digging through the TBB sources, I'm afraid I'll have to aggree, since for "large" tasks, general purpose allocator is used. And because those "lost" tasks are neither spawned nor enqueued, they won't be in the task scheduler queues.

0 Kudos
Reply