Greetings,

I posted on this issue before, in a more complex environment, and
thought I had resolved what appeared to be an orphaned lock or heap
corruption in my application by removing a call to TerminateThread().
You can see the original thread here:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&c2coff=1&safe=off&threadm=f867e9d7.0407151302.7f0882eb%40posting.google.com&rnum=2&prev=/groups%3Fq%3Dmarc%2Belliott%2Bpush%2Bdirection%26hl%3Den%26lr%3D%26ie%3DUTF-8%26c2coff%3D1%26safe%3Doff%26selm%3Df867e9d7.0407151302.7f0882eb%2540posting.google.com%26rnum%3D2

However, I am still experiencing this issue. When I launch my app
(particularly one which does a high number of calls to CreateProcess()
and creates runner threads for stdin/stdout/stderr the process hangs
or (more rarely) faults on closing Invalid Handle or something
similar. Sometimes I will get this problem after a single call to
CreateProcess().

I've been through the process spawning code a million times, but I
don't see anything untoward. I've enabled full page heap and the lock
verification layer, and although app verifier throws exceptions in
places that appear to be during access to invalid handles, etc, I
don't see anything otherwise meaningful and there are times where the
process still hangs and AppVerifier doesn't seem to notice anything's
wrong at all.

Question: What can I do to better isolate the problem using these
tools? I am able to repro on Win2K3, so I have access to the latest
AppVerifier switches, but am at a loss as to what usefulness I can get
out of them at this point.

Further details: This issue only appears on SMP boxes, and I have only
had success repro'ing it when multiple instances of the process are
running simultaenously. Whether that indicates some resource
contention or simply increases the statistical likelihood of the error
appearing is unclear.

Any suggestions from the cdb/windbg masters are heartily welcomed!

Regards,
Marc

Re: Can't determine cause of heap corruption or orphaned lock using cdb by Oleg

Oleg
Fri Oct 01 04:00:44 CDT 2004


Can you reproduce the same problem in a simpler case
which does not involve Java? E.g. with a test stub calling
the library that launches processes and monitors them?

Next, when you get an AppVerifier stop, could you please post
the debugger output (including "~*kb")?
Also, can you tell (e.g. with !htrace) what kind of handle is that,
who has opened and (already?) closed it?
Who is trying to access the handle?

Also, when you reproduce the deadlock case again,
please post the output of "~*kb".

Also, try to use tracing in the library and see whether it is possible
to reproduce the problem with tracing. If it is possible, verify that all
the threads do really start and do what they are expected to do.

Regards,
Oleg