[fpc-pascal] TProcess.Free - three exceptions in ntdll.dll - only *sometimes*

Bernd Kreuss prof7bit at googlemail.com
Mon Oct 4 19:23:10 CEST 2010


Hi,

has anybody ever had the problem of TProcess.Free causing
three exceptions in in ntdll.dll?

C0000005 at 7C928FEA in C:\WINDOWS\system32\ntdll.dll

7C928FEA seems to be RtlpWaitForCriticalSection() somewhere deep inside
the windows kernel.

The first two happen almost immediately and the third one a few seconds
later. I narrowed it down to TProcess.CloseOutput(), CloseInput() and
CloseStderr() and if I create the process with poStderrToOutPut there
will only be two exceptions instead of three.

At the time this happens the process is already terminated because I
sent it its quit command via its input and then WaitOnExit() and it will
terminate orderly. Nobody should be reading or writing to these pipes
anymore.

Is there any alternative way to close the stdio? My only workaround at
the moment is to never free the TProcess at all and simply hope that it
won't crash when the dll is unloaded (it is all residing inside a dll
that is loaded and unloaded during runtime). Most of the time it won't
crash this way, but unfortunately not always.

Bernd




More information about the fpc-pascal mailing list