CloseThreadpoolWork throws Exception (_Threadpool_chore destructor)


Is it a known issue that ::CloseThreadpoolWork(static_cast<PTP_WORK>(_Work)) in the _Threadpool_chore destructor throws on exit?

I'm using the Sort_Sample project which works flawlessly up to that point.

Unhandled exception at 0x775C9CD2 (ntdll.dll) in Sort_Sample.exe: 0xC000000D
Einem Dienst oder einer Funktion wurde ein ungültiger Parameter übergeben.

I'm using latest source code snapshot on Windows 7 (German) with VS 2013 Update 1 (English) (see attachments).

file attachments

Closed Apr 21, 2014 at 11:24 PM by lchodors


lchodors wrote Apr 17, 2014 at 4:46 PM

Thank you very much for your feedback. We are trying to reproduce this issue.

Could you provide us with more information about:
1) What architecture are you running and building for?
2) Does it fail on all build combinations?
3) What is the concurrency level on your machine (number of cores)?

vreid wrote Apr 17, 2014 at 5:51 PM

1) x86/x64 Release/Debug
2) yes
3) 4 cores/8 threads

Everything up until that point works without any issues. I will test again on Windows 8 64bit when I have time.

vreid wrote Apr 17, 2014 at 9:34 PM

VS 2013 Express on Windows 8 works perfectly for all configurations (home PC). I will investigate further on Tuesday when I'm back at work.

lchodors wrote Apr 18, 2014 at 5:19 PM

From our initial investigation it looks that on Windows 7 you cannot call Thread Pool API during the call to DllMain (ParallelSTL) – process shutdown. In this case thread pool API just throw invalid argument. Parallel STL has a global queues that are released in DllMain thus this issue for the algorithms that are using details::TaskgGroup.

We are looking at the options for fixing this issue.

vreid wrote Apr 18, 2014 at 8:16 PM

Thanks you for your hard work. Maybe linking it statically might help until a fix is committed. At least I can play at work with it :)