[Mono-bugs] [Bug 62409][Blo] New - Random NullPointerExceptions

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 4 Aug 2004 03:21:38 -0400 (EDT)

Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by michi@zeroc.com.


--- shadow/62409	2004-08-04 03:21:38.000000000 -0400
+++ shadow/62409.tmp.20196	2004-08-04 03:21:38.000000000 -0400
@@ -0,0 +1,79 @@
+Bug#: 62409
+Product: Mono: Runtime
+Version: unspecified
+OS Details: RedHat 8, dual-CPU machine
+Status: NEW   
+Priority: Blocker
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: michi@zeroc.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+Summary: Random NullPointerExceptions
+I'm seeing random NullPointerExceptions in various places in my code. These
+are rare -- I'm getting them once every thousand runs or so. Here is a
+stack trace:
+System.NullReferenceException: Object reference not set to an instance of
+an object
+in (unmanaged) (wrapper managed-to-native)
+System.Threading.Mutex:CreateMutex_internal (bool,string,bool&)
+in <0x00004> (wrapper managed-to-native)
+System.Threading.Mutex:CreateMutex_internal (bool,string,bool&)
+in [0x0000b] (at
+System.Threading.Mutex:.ctor ()
+in <0x0004f> (wrapper remoting-invoke-with-check)
+System.Threading.Mutex:.ctor ()
+in <0x00021> IceInternal.OutgoingAsync:.ctor ()
+in <0x0000a> AMI_Test_unknownDerivedAsBase:.ctor ()
+in <0x00035> AMI_Test_unknownDerivedAsBaseI:.ctor ()
+in [0x001ea] (at
+AllTests:allTests (Ice.Communicator,bool)
+in [0x00002] (at
+/home/michi/src/icecs/test/Ice/slicing/exceptions/Client.cs:16) Client:run
+in [0x0000e] (at
+/home/michi/src/icecs/test/Ice/slicing/exceptions/Client.cs:29) Client:Main
+Line 577 in AllTests.cs looks like this:
+    AMI_Test_unknownDerivedAsBaseI cb = new AMI_Test_unknownDerivedAsBaseI();
+From the stack trace, you can see that this class derives from
+AMI_Test_unknownDerivedAsBase, which in turn derives from OutgoingAsync.
+The code crashes in the constructor of OutgoingAsync. However, all three
+classes have no user-defined constructors, just the system-generated
+default constructor.
+OutgoingAsync has the following private member:
+    Mutex _timeoutMutex = new Mutex();
+This explains how the code ends up in the constructor for
+So, as far as I can see, it's pretty much impossible for this to be an
+application error: I call new on a class without a user-defined constructor
+(and none of the base classes have user-defined constructors), which means
+that no application code gets to run at all.
+I'm getting NullReferenceExceptions in other places of my code, seemingly
+at random. But they typically involve constructors somewhere in the stack
+trace. (Given that I'm seeing this maybe once in a thousand runs, it's
+difficult to test this more thoroughly.)
+Anyway, could you have a look at this please. This is pretty much a
+show-stopper for me right now. I can supply the code if you like.