- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm seeing a sporadic hang when my application loads. As far as I can work out the sequence of events is as follows and I was wondering if there is a recommended way to avoid this occuring.
1. App starts
2. It loads dll 'Foo' (no code in dll main)
3. Foo has dependency on bar so it causes dll 'Bar' to load
4. App now calls initialise function in Foo
4.1 Foo's initalise function calls initialise in Bar
4.2 Bar starts a background thread (license check)
4.3 Foo creates tbb::task_scheduler_init, deferred
4.4 Foo calls tbb::task_scheduler_init::initialize(...)
-- hang -- function never returns
This main thread of execution is stuck in tbbmalloc.cpp:144, in a call to LoadLibrary, waiting for the global dll lock. This has the comment line. "Preventing TBB allocator library from unloading to prevent resource leak, as memory is not released on the library unload."
The interesting bit is that the other thread that was fired off by the 'Bar' dll has now got stuck in mallocThreadShutdownNotification, MemoryAllocator.cpp. It has the global dll lock as this was triggered by Dllmain in tbbmalloc.cpp:215 (DLL_THREAD_DETACH), but is not able to get tbb's lock.
Any suggestions, maybe some finer grain control on startup could be useful. For now I think I will just make sure tbb is initialised as early as possible, even if other tasks are unrelated. However this still does not seem like it would entirely prevent this situation, as the dll main events will presumbly start firing as soon as the tbb dll is loaded.
Thanks,
Paul.
1. App starts
2. It loads dll 'Foo' (no code in dll main)
3. Foo has dependency on bar so it causes dll 'Bar' to load
4. App now calls initialise function in Foo
4.1 Foo's initalise function calls initialise in Bar
4.2 Bar starts a background thread (license check)
4.3 Foo creates tbb::task_scheduler_init, deferred
4.4 Foo calls tbb::task_scheduler_init::initialize(...)
-- hang -- function never returns
This main thread of execution is stuck in tbbmalloc.cpp:144, in a call to LoadLibrary, waiting for the global dll lock. This has the comment line. "Preventing TBB allocator library from unloading to prevent resource leak, as memory is not released on the library unload."
The interesting bit is that the other thread that was fired off by the 'Bar' dll has now got stuck in mallocThreadShutdownNotification, MemoryAllocator.cpp. It has the global dll lock as this was triggered by Dllmain in tbbmalloc.cpp:215 (DLL_THREAD_DETACH), but is not able to get tbb's lock.
Any suggestions, maybe some finer grain control on startup could be useful. For now I think I will just make sure tbb is initialised as early as possible, even if other tasks are unrelated. However this still does not seem like it would entirely prevent this situation, as the dll main events will presumbly start firing as soon as the tbb dll is loaded.
Thanks,
Paul.
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Something similar was fixed in TBB 3.0 Update 1 release. Could you please report which TBB versionare you using?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using what i thought to be the latest stable release (tbb30_20100406oss), i am not sure if this includes update 1 or not?
Thanks, Paul
Thanks, Paul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Update 1 was released on June 16, 2010, so the fix in not in release you are using. Please try "Commercial Aligned Release" from http://www.threadingbuildingblocks.org/file.php?fid=78 , preferably 3.0 update 2.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thanks for your help.
![](/skins/images/B7BA37F9CE4B52FF7CAE1FB0388839C8/responsive_peak/images/icon_anonymous_message.png)
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page