2

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?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Maanu
  • 5,093
  • 11
  • 59
  • 82
  • Not sure if it will help, but [Here](http://stackoverflow.com/a/758840/241536) is an answer I wrote to another poster about how to use WinDbg. – John Dibling Jun 08 '12 at 14:18
  • 1
    The information you need is in the VERIFIER STOP message. You have two threads accessing a no-serialize heap simultaneously, which is not allowed. The two threads are 1444 and 3188. You need to change your program so that the two threads do not try to access the same heap at the same time. – Raymond Chen Jun 08 '12 at 16:39

2 Answers2

2

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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
John Dibling
  • 99,718
  • 31
  • 186
  • 324
2

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)'.

Community
  • 1
  • 1
EdChum
  • 376,765
  • 198
  • 813
  • 562