[Mono-bugs] [Bug 546530] New: crash if I use multiple mono process instances making heavy use of System.Diagnostics.Process.GetProcess_internal

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Oct 13 10:38:17 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=546530


           Summary: crash if I use multiple mono process instances making
                    heavy use of
                    System.Diagnostics.Process.GetProcess_internal
    Classification: Mono
           Product: Mono: Runtime
           Version: unspecified
          Platform: x86-64
        OS/Version: RHEL 4
            Status: NEW
          Severity: Critical
          Priority: P5 - None
         Component: io-layer
        AssignedTo: lupus at novell.com
        ReportedBy: arrustem at progress.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Created an attachment (id=322275)
 --> (http://bugzilla.novell.com/attachment.cgi?id=322275)
The C# code that I used to reproduce the problem

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.1.3)
Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)

While running multiple mono instances (tens of them), each of them running .NET
code that makes heavy use of System.Diagnostics.Process.GetProcess_internal,
almost every time, one gets warnings that end up with a mono crash.
The warnings are of the following form:

** (mono-test.exe:1504): WARNING **: _wapi_handle_ref: Attempting to ref unused
handle 0x4f3

** (mono-test.exe:1504): WARNING **: _wapi_handle_unref: Attempting to unref
unused handle 0x4f3

These warnings are often followed with an error message of the following form:

** ERROR **: file ../../mono/io-layer/handles-private.h: line 188
(_wapi_shared_handle_set_signal_state): assertion failed:
(_WAPI_SHARED_HANDLE(_wapi_handle_type (handle)))
aborting...
Stacktrace:

  at (wrapper managed-to-native) System.Diagnostics.Process.GetProcess_internal
(int) <0x00048>
  at (wrapper managed-to-native) System.Diagnostics.Process.GetProcess_internal
(int) <0xffffffff>
  at System.Diagnostics.Process.GetProcessById (int) <0x00013>
  at System.Diagnostics.Process.GetProcesses () <0x00067>
  at ProcessApp.Program.UseProcess () <0x0001f>
  at (wrapper runtime-invoke) object.runtime_invoke_void__this__
(object,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:
        ./bin/mono [0x48619a]
        /lib64/tls/libpthread.so.0 [0x38b700c5b0]
        /lib64/tls/libc.so.6(gsignal+0x3d) [0x38b632e26d]
        /lib64/tls/libc.so.6(abort+0xfe) [0x38b632fa6e]
        /usr/lib64/libglib-2.0.so.0 [0x38b762ed28]
        /usr/lib64/libglib-2.0.so.0(g_log+0x83) [0x38b762edb3]
        ./bin/mono [0x578cf6]
        ./bin/mono [0x568f97]
        ./bin/mono [0x578da6]
        ./bin/mono [0x528115]
        [0x40012bb8]


Another warning that seems to be related and reported is:
WARNING **: process_set_current: error creating process handle

that is followed by the following error:

** ERROR **: file processes.c: line 91
(process_set_termination_details):
assertion failed: ((GPOINTER_TO_UINT (handle) & _WAPI_PROCESS_UNHANDLED) !=
_WAPI_PROCESS_UNHANDLED)
aborting...



Reproducible: Sometimes

Steps to Reproduce:
[happens _very_ often but not always]

1. Compile the following C# code [attached as mono-test.cs]:
using System;
using System.Diagnostics;
using System.Threading;

namespace ProcessApp
{
        class Program
        {
                const int GET_PROCESSES_LOOP_SIZE = 1024;
                const int THREAD_NO = 16;

                static void Main(string[] args)
                {
                        Thread[] tArray = new Thread[THREAD_NO];
                        for (int i = 0; i < THREAD_NO; i++)
                        {
                                tArray[i] = new Thread(new
ThreadStart(Program.UseProcess));
                        }
                        for (int i = 0; i < THREAD_NO; i++)
                        {
                                tArray[i].Start();
                        }
                        for (int i = 0; i < THREAD_NO; i++)
                        {
                                tArray[i].Join();
                        }
                        Console.WriteLine("UseProcess test Finished!");
                }

                static void UseProcess()
                {
                        Process[] processArray;
                        for (int i = 0; i < GET_PROCESSES_LOOP_SIZE; i++)
                        {
                                processArray = Process.GetProcesses();
                        }
                }
        }
}

2. Launch multiple instances of this test from the terminal with e.g. 
>mono mono-test.exe &
3. If you cannot reproduce by just running them, try killing the created mono
processes and then run them again
Actual Results:  
** ERROR **: file ../../mono/io-layer/handles-private.h: line 188
(_wapi_shared_handle_set_signal_state): assertion failed:
(_WAPI_SHARED_HANDLE(_wapi_handle_type (handle)))
aborting...
Stacktrace:

  at (wrapper managed-to-native) System.Diagnostics.Process.GetProcess_internal
(int) <0x00048>
  at (wrapper managed-to-native) System.Diagnostics.Process.GetProcess_internal
(int) <0xffffffff>
  at System.Diagnostics.Process.GetProcessById (int) <0x00013>
  at System.Diagnostics.Process.GetProcesses () <0x00067>
  at ProcessApp.Program.UseProcess () <0x0001f>
  at (wrapper runtime-invoke) object.runtime_invoke_void__this__
(object,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:
        ./bin/mono [0x48619a]
        /lib64/tls/libpthread.so.0 [0x38b700c5b0]
        /lib64/tls/libc.so.6(gsignal+0x3d) [0x38b632e26d]
        /lib64/tls/libc.so.6(abort+0xfe) [0x38b632fa6e]
        /usr/lib64/libglib-2.0.so.0 [0x38b762ed28]
        /usr/lib64/libglib-2.0.so.0(g_log+0x83) [0x38b762edb3]
        ./bin/mono [0x578cf6]
        ./bin/mono [0x568f97]
        ./bin/mono [0x578da6]
        ./bin/mono [0x528115]
        [0x40012bb8]


Another warning that seems to be related and reported is:
WARNING **: process_set_current: error creating process handle

that is followed by the following error:

** ERROR **: file processes.c: line 91
(process_set_termination_details):
assertion failed: ((GPOINTER_TO_UINT (handle) & _WAPI_PROCESS_UNHANDLED) !=
_WAPI_PROCESS_UNHANDLED)
aborting...



Expected Results:  
UseProcess test Finished!

We're embarking on quite a serious project where we hope to not only make
extensive use of mono but also potentially extend its features (and obviously
share them with you). We're in the evaluation stage where we found this
critical problem. 

We'd greatly appreciate if you could help us out. If there is anything that I
can be of help, please let me know.

best regards,
Dr Alban Rrustemi

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


More information about the mono-bugs mailing list