Multi-threaded access in HEAP_NO_SERIALIZE heap

393 views Asked by At

Our application crashes with the following error.

===========================================================
VERIFIER STOP 00000003: pid 0x2E54: multithreaded access in HEAP_NO_SERIALIZE heap
       00161000 : Heap handle
       00001444 : Thread owning heap lock
       00003188 : Current thread trying to acquire the heap lock
       00000000 :
===========================================================

We have enabled a full page heap for the application. The application crashes at a random location. Often the crash location is the inner portions of STL. In all cases, the callstack seems to be corrupted.

The application uses a list of libraries and DLL files. All DLL files and libraries are built with the multithreaded DLL library (command line option /MD) .

One of the libraries is using the HeapAlloc method for allocating memory in heap.

what techniques should I use to identify the crash?

2

There are 2 answers

1
John Dibling On BEST ANSWER

You appear to have already done it, by running your program under WinDbg.

A quick Google search on the interesting bits of the error message found the MSDN article Multithreaded Access In A HEAP_NO_SERIALIZE Heap, which suggests to me that some module you are loading is linked against the single-threadded CRT.

I would examine each part of your project, and all the project settings, very carefully to verify that everything is really using the MD libraries. Something may be statically linked.

0
EdChum On

Attach using WinDbg, fix your symbols:

.symfix;reload;

Run automated crash analysis:

!analyze -v

You can inspect the call stacks of all the threads:

~* kb;

You could check what the dependencies are for your modules using Dependency Walker and see if any are using the single threaded CRT, but I would also check if any are statically linked like John Dibling suggests.

You can check this under project settings: Configuration Properties -> C/C++ -> Code Generation -> Check Runtime Library. It should say 'Multi-threaded DLL (/MD)'.