[Mono-bugs] [Bug 482737] New: ves_icall_System_Diagnostics_Process_ExitCode_internal does not check GetExitCodeProcess return code

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Mar 6 04:18:24 EST 2009


https://bugzilla.novell.com/show_bug.cgi?id=482737


           Summary: ves_icall_System_Diagnostics_Process_ExitCode_internal
                    does not check GetExitCodeProcess return code
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.0.x
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: wiho at wihome.net
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.0.7)
Gecko/2009021910 Firefox/3.0.7 (.NET CLR 3.5.30729)

The function ves_icall_System_Diagnostics_Process_ExitCode (in
mono/metadata/process.c) calls GetExitCodeProcess (in
mono/io-layer/processes.c), which returns a boolean to indicate success of
failure. Under certain conditions, GetExitCodeProcess may return false without
initializing the exit code pointed to by the *code pointer.

But ves_icall_System_Diagnostics_Process_ExitCode does not check the exit code,
and assumes that GetExitCodeProcess will always initialize the code variable.
This may lead to the exit code remaining uninitialized.

I've observed this happening in my application that repeatedly starts a new
process, waits for it to exit, and queries the exit code. The process always
exits successfully, but sometimes (once in a couple of hunderd times) the
process.ExitCode property will return 10922 (i.e. 0x2AAA, uninitialized value)
instead of 0. When requesting the same exit code again a few lines of code
later, it usually returns 0 again (even if returning 10922 before), so the
issues seems to be timing related.

Reproducible: Sometimes

Steps to Reproduce:
1. Create and start new Process
2. call process.WaitForExit()
3. call process.ExitCode
Actual Results:  
process.ExitCode = 10922 (0x2AAA)

Expected Results:  
process.ExitCode = 0

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list