[Mono-dev] Process.ExitCode may return an uninitlialized value

slashboot slashboot at gmail.com
Thu Jun 5 01:43:01 EDT 2008

I actually resolved the "GetExitCodeProcess: Can't find process 0x1" part
which was due to the fact that if fork() fails when it creates a process no
exception is thrown and the caller doesn't know about it. Other calls to
Process.Start() will also fail.

Fork() was failing for me because my process was allocating alot of memory
while the fork was happening and mono code wasn't calling execv right after
the fork() leading to a big chunk of memory being re-allocated for the child
process (copy on write).

This is against 1.1.17-2.


slashboot wrote:
> Hello,
> Recently, I run into an issue where Process.ExitCode was returning numbers
> out of the 0-255 range which turned out to be random numbers. I was trying
> to figure out how this can happen and found that in ExitCode_internal (see
> below, this is the latest revision), no checks were made on the return
> value of the GetExitCodeProcess (process, &code) call which might lead to
> returning uninitialized exit code if GetExitCodeProcess returns FALSE.
> That doesn't look right to me..
> For some reason that I still can't explain, GetExitCodeProcess was
> returning FALSE and I saw this message : "GetExitCodeProcess: Can't find
> process 0x1" on every process that I created (the process didn't seem to
> execute correctly). Is anyone aware of such kind of problem ? (I'm using
> an old 1.1.17-2 version). I cannot reproduce this consistently, but each
> time it happens, no more processes could be created going forward and I
> need to restart the app.
> -- 
> Mahdi.
> //trunk/mono/mono/metadata/process.c
> gint32 ves_icall_System_Diagnostics_Process_ExitCode_internal (HANDLE
> process)
> {
> 	DWORD code;	
> 	GetExitCodeProcess (process, &code);
> #ifdef DEBUG
> 	g_message (G_GNUC_PRETTY_FUNCTION ": process exit code is %d", code);
> #endif
> 	return(code);
> }

View this message in context: http://www.nabble.com/Process.ExitCode-may-return-an-uninitlialized-value-tp17635993p17662570.html
Sent from the Mono - Dev mailing list archive at Nabble.com.

More information about the Mono-devel-list mailing list