Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
6709 Discussions

Application crashes: OMP: Error #136: Cannot create thread.

RyanS
New Contributor I
1,442 Views

I have two Windows 7 SP1 x64 dev machines that have reliability problems unless I set KMP_ALL_THREADS environment variable. If I don't set that environment variable, I get application crashes in Windows save (as) file dialogs. When the app crashes, it pops a separate console window to display errors. The errors I see are like this:

OMP: Error #136: Cannot create thread.

OMP: System error #8: Not enough storage is available to process this command.

And then the application crashes. The applications that have crashed like this are Outlook Express, VirtualDub, Visual Studio 2010, and a tiny C++ test ui I wrote that just opens a file save dialog. These machines both have 8GB of RAM, I am not low on RAM according to task manager. I have generally had only Visual Studio running.

When I execute the test ui and point to a directory without a jpeg, it works fine. When I point to a directory with a jpeg (as the above steps do), it crashes and pops a console window with this:

OMP: Error #136: Cannot create thread.

OMP: System error #8: Not enough storage is available to process this command.

OMP: Error #178: Function GetExitCodeThread() failed:

OMP: System error #6: The handle is invalid.

When I run under the visual studio debugger I don't get the crash.

The crash is perfectly repeatable, I haven't seen it not crash given the specified run conditions.

If I set the system environment variable KMP_ALL_THREADS (I tried 0,1,16 and 4096) or OMP_THREAD_LIMIT the crash does not happen. With system environment variable OMP_NUM_THREADS set to 1 or 16 the crash still happens. With system environment variable KMP_STACKSIZE and/or OMP_STACKSIZE set to 4m the crash still happens.

But when I set KMP_ALL_THREADS to 1, 16, or 4096 (probably anything) I get this when I run another app that uses IPP:

OMP: Warning #96: Cannot form a team with 8 threads, using 1 instead.

OMP: Hint: Consider unsetting KMP_ALL_THREADS and OMP_THREAD_LIMIT (if either is set).

So I either havecrashes and a console window with errors with windows file save as dialog, or a console window with errors on an app that uses IPP. Neither is good.

What is going on here? Is Windows using Intel OMP? What does "not enough storage" mean if I'm not low on memory or disk? Why can it not form a team of 8 threads with KMP_ALL_THREADS set to 4096?

0 Kudos
7 Replies
Ying_H_Intel
Employee
1,442 Views
Hi RyanS,

From the error itself,
OMP: Error #136: Cannot create thread.

OMP: System error #8: Not enough storage is available to process this command.
It seems thatyour program was trying to set a large number of threads which beyond your system can support.

Not sure how your program works and how IPP was used. Could you please provide
a test case (or you can send your test UI by Private thread) so we can reproduce the problem?
and provide more detials information like
-What is your hardware? have you obversed how many threads when you run the test UC under all kind of setting?
-does yourprogram are 32bit or 64bit?are your program is multi-threading or not, what threading method are you using?
-what IPP function and how IPP was used in your application?
For example, IPP provide picnicsample, it's executablefile can be download fromdownload. It can open file dir and open/save a jpeg file, it use IPP. On 2 core machine, it will start about over10 threads. 3 of threads are Intel OpenMP thread started by IPP functions, other is save or open file UI threads.

Regardingyour question, is windows using Intel OMP? In general, no windows don't use Intel OpenMP. But as you knowvisual studio 2010 can build OpenMPapplication which use Microsoft OpenMP.

Best Regards,
Ying

0 Kudos
SergeyKostrov
Valued Contributor II
1,442 Views
Quoting RyanS
...So it is like the Windows operating system itself has the problem, not any particular application...

If you're able to reproduce that problem easily could you take a look at the Windows Task Manager? How much memorywas allocated
by your applicationwhen these problems started?

Sorry for my generic response but it is almost impossible to reproduce your problems without a really good test case
in an environment similar to yours.
0 Kudos
Ying_H_Intel
Employee
1,442 Views
Hi Ryans,

No, we notice the scenario you mentioned. (none of the apllication Outlook Express, VirtualDub, (Microsoft) Visual Studio 2010, and a tiny C++ test ui use IPP, so it should not related to IPP). But as youpost the problem to IPP forum, so we need to make sure if it is IPP-related or Intel Compiler related.

Butyou should be rightabout KMP_ALL_THREADS is Intel-specific. So the problemappear to berelated Intel OpenMP.
As Sergery mentioned, it is impossible to catch the reason without a test case, you may do general check, like check how many threads started in task manager etc.

( i may try to move your post to Intel Compiler forum and see if there are some insight from Compiler experts)
the new post in Intel Compiler Forum is http://software.intel.com/en-us/forums/showthread.php?t=107255


Best Regards,
Ying
0 Kudos
SergeyKostrov
Valued Contributor II
1,442 Views
Quoting RyanS
...And then the application crashes. The applications that have crashed like this are Outlook Express, VirtualDub, Visual Studio 2010, and a tiny C++ test ui...


Could you take a look at Windows Event Viewer? Microsoft applications usually leave some messages in the log when
something is really wrong.

0 Kudos
SergeyKostrov
Valued Contributor II
1,442 Views
Quoting RyanS
...When the app crashes, it pops a separate console window to display errors. The errors I see are like this:
OMP: Error #136: Cannot create thread.
OMP: System error #8: Not enough storage is available to process this command.
...


Hi Ryan, Please take a look at my comments in a thread:

http://software.intel.com/en-us/forums/showthread.php?t=107255

0 Kudos
Ying_H_Intel
Employee
1,442 Views
Hi Ryan, I saw in Compiler Forum, they hope you can provide a test case so they can investigate it. If possible, please consider to provide a simulators. And just recently, i work another OMP: Error #136: Cannot create thread issue. Where the OpenMP program allowed OpenMP omp_set_nested(.true.), as a result, too many OpenMP thread was started untill crashed. So i'm guess if it is same (or closer) reason for your problem. If it is possible, could you please start your applicaiton from one command windows , for example, >KMP_AFFINITY=verbose (please note the KMP_AFFINITY is uppercase) > your applicaiton.exe Then show us all outputs in command windows . Best Regards, Ying
0 Kudos
RyanS
New Contributor I
1,442 Views
(I am copying the resolution from the forked thread here.) Thanks Ying for pointing the right direction. The problem was that I have a windows installer that installs UIC dll's. The install builder automatically decided to register wic_uic_codec.dll with COM. So when Windows opened a save dialog on a folder with a jpeg, it was using that UIC dll (for a thumbnail, or just properties or something) and some of the other UIC dll's also (because when I deleted the other dll's the problem went away). The UIC dlls use Intel OpenMP, and somewhere there is a bug or maybe a version incompatibility or maybe something about the COM registration was wrong. I did not nail down the root cause nor try the newer versions of UIC dll's. The UIC dll's are the Intel-built ones and are from version 7.0.7. I told the installer not to register that UIC DLL and that solves my problem.
0 Kudos
Reply