Bug 16490 - NullReferenceException in CrossAppDomainSink.SyncProcessMessage
Summary: NullReferenceException in CrossAppDomainSink.SyncProcessMessage
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: Remoting ()
Version: 3.2.x
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-11-28 04:32 UTC by Aleksey Sotnikov
Modified: 2018-01-19 19:11 UTC (History)
5 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
test domain-multithread (1.09 KB, text/x-csharp)
2013-11-28 04:32 UTC, Aleksey Sotnikov
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Aleksey Sotnikov 2013-11-28 04:32:10 UTC
Created attachment 5560 [details]
test domain-multithread

When create AppDomains from multiple threads. Sometimes NullReferenceException is thrown in all threads.

log:
mono domain-multithread.exe 
Thread start 5
Thread start 6
Thread start 4
Thread start 3
Thread start 7

Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object

Server stack trace: 
  at System.Runtime.Remoting.Messaging.RemotingSurrogateSelector.GetSurrogate (System.Type type, StreamingContext context, ISurrogateSelector& ssout) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.GetObjectData (System.Object obj, System.Runtime.Serialization.Formatters.Binary.TypeMetadata& metadata, System.Object& data) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteObject (System.IO.BinaryWriter writer, Int64 id, System.Object obj) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteObjectInstance (System.IO.BinaryWriter writer, System.Object obj, Boolean isValueObject) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteQueuedObjects (System.IO.BinaryWriter writer) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteObjectGraph (System.IO.BinaryWriter writer, System.Object obj, System.Runtime.Remoting.Messaging.Header[] headers) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize (System.IO.Stream serializationStream, System.Object graph, System.Runtime.Remoting.Messaging.Header[] headers) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize (System.IO.Stream serializationStream, System.Object graph) [0x00000] in <filename unknown>:0 
  at System.Runtime.Remoting.Channels.CADSerializer.SerializeObject (System.Object obj) [0x00000] in <filename unknown>:0 
  at System.Runtime.Remoting.Messaging.CADMethodCallMessage..ctor (IMethodCallMessage callMsg) [0x00000] in <filename unknown>:0 
  at System.Runtime.Remoting.Messaging.CADMethodCallMessage.Create (IMessage callMsg) [0x00000] in <filename unknown>:0 
  at System.Runtime.Remoting.Channels.CrossAppDomainSink.SyncProcessMessage (IMessage msgRequest) [0x00000] in <filename unknown>:0 

Exception rethrown at [0]: 

  at System.Runtime.Remoting.Messaging.RemotingSurrogateSelector.GetSurrogate (System.Type type, StreamingContext context, ISurrogateSelector& ssout) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.GetObjectData (System.Object obj, System.Runtime.Serialization.Formatters.Binary.TypeMetadata& metadata, System.Object& data) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteObject (System.IO.BinaryWriter writer, Int64 id, System.Object obj) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteObjectInstance (System.IO.BinaryWriter writer, System.Object obj, Boolean isValueObject) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteQueuedObjects (System.IO.BinaryWriter writer) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteObjectGraph (System.IO.BinaryWriter writer, System.Object obj, System.Runtime.Remoting.Messaging.Header[] headers) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize (System.IO.Stream serializationStream, System.Object graph, System.Runtime.Remoting.Messaging.Header[] headers) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize (System.IO.Stream serializationStream, System.Object graph) [0x00000] in <filename unknown>:0 
  at System.Runtime.Remoting.Channels.CADSerializer.SerializeObject (System.Object obj) [0x00000] in <filename unknown>:0 
  at System.Runtime.Remoting.Messaging.CADMethodCallMessage..ctor (IMethodCallMessage callMsg) [0x00000] in <filename unknown>:0 
  at System.Runtime.Remoting.Messaging.CADMethodCallMessage.Create (IMessage callMsg) [0x00000] in <filename unknown>:0 
  at System.Runtime.Remoting.Channels.CrossAppDomainSink.SyncProcessMessage (IMessage msgRequest) [0x00000] in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object

Server stack trace: 
  at System.Runtime.Remoting.Messaging.RemotingSurrogateSelector.GetSurrogate (System.Type type, StreamingContext context, ISurrogateSelector& ssout) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.GetObjectData (System.Object obj, System.Runtime.Serialization.Formatters.Binary.TypeMetadata& metadata, System.Object& data) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteObject (System.IO.BinaryWriter writer, Int64 id, System.Object obj) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteObjectInstance (System.IO.BinaryWriter writer, System.Object obj, Boolean isValueObject) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteQueuedObjects (System.IO.BinaryWriter writer) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteObjectGraph (System.IO.BinaryWriter writer, System.Object obj, System.Runtime.Remoting.Messaging.Header[] headers) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize (System.IO.Stream serializationStream, System.Object graph, System.Runtime.Remoting.Messaging.Header[] headers) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize (System.IO.Stream serializationStream, System.Object graph) [0x00000] in <filename unknown>:0 
  at System.Runtime.Remoting.Channels.CADSerializer.SerializeObject (System.Object obj) [0x00000] in <filename unknown>:0 
  at System.Runtime.Remoting.Messaging.CADMethodCallMessage..ctor (IMethodCallMessage callMsg) [0x00000] in <filename unknown>:0 
  at System.Runtime.Remoting.Messaging.CADMethodCallMessage.Create (IMessage callMsg) [0x00000] in <filename unknown>:0 
  at System.Runtime.Remoting.Channels.CrossAppDomainSink.SyncProcessMessage (IMessage msgRequest) [0x00000] in <filename unknown>:0 

Exception rethrown at [0]: 

  at System.Runtime.Remoting.Messaging.RemotingSurrogateSelector.GetSurrogate (System.Type type, StreamingContext context, ISurrogateSelector& ssout) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.GetObjectData (System.Object obj, System.Runtime.Serialization.Formatters.Binary.TypeMetadata& metadata, System.Object& data) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteObject (System.IO.BinaryWriter writer, Int64 id, System.Object obj) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteObjectInstance (System.IO.BinaryWriter writer, System.Object obj, Boolean isValueObject) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteQueuedObjects (System.IO.BinaryWriter writer) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteObjectGraph (System.IO.BinaryWriter writer, System.Object obj, System.Runtime.Remoting.Messaging.Header[] headers) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize (System.IO.Stream serializationStream, System.Object graph, System.Runtime.Remoting.Messaging.Header[] headers) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize (System.IO.Stream serializationStream, System.Object graph) [0x00000] in <filename unknown>:0 
  at System.Runtime.Remoting.Channels.CADSerializer.SerializeObject (System.Object obj) [0x00000] in <filename unknown>:0 
  at System.Runtime.Remoting.Messaging.CADMethodCallMessage..ctor (IMethodCallMessage callMsg) [0x00000] in <filename unknown>:0 
  at System.Runtime.Remoting.Messaging.CADMethodCallMessage.Create (IMessage callMsg) [0x00000] in <filename unknown>:0 
  at System.Runtime.Remoting.Channels.CrossAppDomainSink.SyncProcessMessage (IMessage msgRequest) [0x00000] in <filename unknown>:0 


OS: Ubuntu 13.10

Mono version:
Mono JIT compiler version 3.2.3 (tarball Ср. нояб. 27 17:04:10 MSK 2013)
Copyright (C) 2002-2012 Novell, Inc, Xamarin Inc and Contributors.
www.mono-project.com
    TLS:           __thread
    SIGSEGV:       altstack
    Notifications: epoll
    Architecture:  amd64
    Disabled:      none
    Misc:          softdebug 
    LLVM:          supported, not enabled.
    GC:            sgen
Comment 1 Zoltan Varga 2013-12-02 06:29:18 UTC
Please try a more recent mono version (i.e. 3.2.5).
Comment 2 Rodrigo Kumpera 2013-12-06 14:53:27 UTC
Please provide a test case that shows the issue.
Comment 3 Zoltan Varga 2013-12-06 15:07:13 UTC
There is a testcase.
Comment 4 Zoltan Varga 2013-12-06 15:07:25 UTC
reopen.
Comment 5 Aleksey Sotnikov 2013-12-09 02:56:48 UTC
checked with last version mono. reproduced this exception

/usr/bin/mono --version
Mono Runtime Engine version 3.2.7 (master/3217cdc Пн. дек.  9 10:30:15 MSK 2013)
Copyright (C) 2002-2013 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           __thread
	SIGSEGV:       altstack
	Notifications: epoll
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug 
	LLVM:          supported, not enabled.
	GC:            sgen
Comment 6 Zoltan Varga 2013-12-10 14:55:10 UTC
This seems to happen only with SGEN, mono-boehm seems to work.
Comment 7 Zoltan Varga 2013-12-10 15:01:04 UTC
Could you try running the test with -O=-aot ?
Comment 8 Aleksey Sotnikov 2013-12-16 05:37:09 UTC
I cannot reproduce it with option -O=-aot
Comment 9 Ludovic Henry 2018-01-19 19:11:06 UTC
I cannot reproduce with Mono 5.11.0.276 (master/117468d740a). Please reopen if you still can. Thank you.