[Mono-bugs] [Bug 528833] New: Threadpool stress test occasionally throws TypeInitializationException

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Aug 6 09:38:40 EDT 2009


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


           Summary: Threadpool stress test occasionally throws
                    TypeInitializationException
    Classification: Mono
           Product: Mono: Runtime
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: misc
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: mprobst at novell.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


The following program occasionally (once every 70 runs or so) throws a
TypeInitializationException:

Unhandled Exception: System.TypeInitializationException: An exception was
thrown by the type initializer for System.IO.StreamWriter --->
System.Threading.ThreadAbortException: Thread was being aborted
  at System.IO.StreamWriter..cctor () [0x00000] 
  --- End of inner exception stack trace ---
  at System.IO.UnexceptionalStreamWriter..ctor (System.IO.Stream stream,
System.Text.Encoding encoding) [0x00000] 
  at (wrapper remoting-invoke-with-check)
System.IO.UnexceptionalStreamWriter:.ctor
(System.IO.Stream,System.Text.Encoding)
  at System.Console..cctor () [0x00000] 

The program:

using System;
using System.Threading;
using System.Runtime.Remoting;

public class Test : MarshalByRefObject {
    public Thread thread;
    public String str;

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

    void work (Object threadContext) {
        Console.WriteLine ("pool " + fib (15));
    }

    void queueItems () {
        for (;;)
            ThreadPool.QueueUserWorkItem (work, null);
    }

    public void startThread () {
        Thread thread = new Thread (new ThreadStart (queueItems));
        thread.Start ();
    }
}

public class main {
    public static int Main (string [] args) {
    AppDomain domain = AppDomain.CreateDomain ("newdomain");
    Test otherTest = (Test) domain.CreateInstanceAndUnwrap (typeof
(Test).Assembly.FullName, typeof (Test).FullName);

    otherTest.startThread ();

    Console.WriteLine ("main " + Test.fib (20));

    AppDomain.Unload (domain);

    GC.Collect ();
    GC.WaitForPendingFinalizers ();

    return 0;
    }
}

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