[Mono-bugs] [Bug 465700] New: Mono throws InvalidProgramException due to some race condition

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Jan 13 08:26:22 EST 2009


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


           Summary: Mono throws InvalidProgramException due to some race
                    condition
    Classification: Mono
           Product: Mono: Runtime
           Version: SVN
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: JIT
        AssignedTo: lupus at novell.com
        ReportedBy: mprobst at novell.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Very seldomly (maybe once in a few thousand runs) Mono throws an
InvalidProgramException when running this program:

using System;
using System.Threading;
using System.Runtime.CompilerServices;

public class main {
    static int global = 0;
    static Random random = new Random ();

    public static int fib (int i) {
    if (i < 2)
        return i;
    return fib (i - 2) + fib (i - 1);
    }

    [MethodImplAttribute(MethodImplOptions.Synchronized)]
    public static bool synch () {
    if (global != 0)
        return false;
    global = 1;
    fib (random.Next (5, 12));
    global = 0;
    return true;
    }

    public static void thread_func () {
    int i;

    for (i = 0; i < 1000; ++i)
        if (!synch ()) {
        Console.WriteLine ("fail");
        Environment.Exit (1);
        }
    }

    public static int Main () {
    Thread t1 = new Thread (new ThreadStart (thread_func));
    Thread t2 = new Thread (new ThreadStart (thread_func));

    Console.WriteLine ("starting");

    t1.Start ();
    t2.Start ();

    t1.Join ();
    t2.Join ();

    return 0;
    }
}

I run mono like this:

  $ while mono synchtest.exe ; do true ; done

and eventually it stops with

Unhandled Exception: System.InvalidProgramException: Invalid IL code in
(wrapper runtime-invoke) object:runtime_invoke_void__this__
(object,intptr,intptr,intptr): IL_0028: pop

-- 
Configure bugmail: https://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