SignalR/SignalR — Issue #88: SignalR exception (server side) if Clients opened from more than one Azure Worker instance
Author: mcannistra
Created: 2011-12-06 15:16:28+00:00
State: open

I wrote an Azure Worker role that opens 2000 SignalR.Client connections targeting a test server on premise implemented as https://github.com/mcannistra/testHarness
I then use https://github.com/mcannistra/BroadcastingSource to send one test message every 15 seconds to the same target url used by the 2000 connections.
Everything works fine if I use only 1 instance of the worker role.

If I start 3 worker instances, when i start sending the test messages (not before) i get some server generated "NullReferenceException"s in the azure opened clients . They apparently come from Newtonsoft.Json

elmah output is:

System.AggregateException: One or more errors occurred. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Newtonsoft.Json.Serialization.JsonArrayContract.CreateWrapper(Object list) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonArrayContract.cs:line 86
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContract collectionValueContract) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalWriter.cs:line 146
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeDictionary(JsonWriter writer, IWrappedDictionary values, JsonDictionaryContract contract, JsonProperty member, JsonContract collectionValueContract) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalWriter.cs:line 625
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.WriteMemberInfoProperty(JsonWriter writer, Object memberValue, JsonProperty property, JsonContract contract) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalWriter.cs:line 223
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContract collectionValueContract) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalWriter.cs:line 347
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalWriter.cs:line 70
at Newtonsoft.Json.JsonConvert.SerializeObject(Object value, Formatting formatting, JsonSerializerSettings settings) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\JsonConvert.cs:line 628
at SignalR.Transports.LongPollingTransport.Send(Object value) in C:\Download\Projects\SignalR\SignalR\SignalR\Transports\LongPollingTransport.cs:line 155
at SignalR.Transports.LongPollingTransport.Send(PersistentResponse response) in C:\Download\Projects\SignalR\SignalR\SignalR\Transports\LongPollingTransport.cs:line 150
at System.Threading.Tasks.Task.Execute()
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
at System.Web.HttpApplication.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar)
---> (Inner Exception #0) System.NullReferenceException: Object reference not set to an instance of an object.
at Newtonsoft.Json.Serialization.JsonArrayContract.CreateWrapper(Object list) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonArrayContract.cs:line 86
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContract collectionValueContract) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalWriter.cs:line 146
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeDictionary(JsonWriter writer, IWrappedDictionary values, JsonDictionaryContract contract, JsonProperty member, JsonContract collectionValueContract) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalWriter.cs:line 625
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.WriteMemberInfoProperty(JsonWriter writer, Object memberValue, JsonProperty property, JsonContract contract) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalWriter.cs:line 223
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContract collectionValueContract) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalWriter.cs:line 347
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalWriter.cs:line 70
at Newtonsoft.Json.JsonConvert.SerializeObject(Object value, Formatting formatting, JsonSerializerSettings settings) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\JsonConvert.cs:line 628
at SignalR.Transports.LongPollingTransport.Send(Object value) in C:\Download\Projects\SignalR\SignalR\SignalR\Transports\LongPollingTransport.cs:line 155
at SignalR.Transports.LongPollingTransport.Send(PersistentResponse response) in C:\Download\Projects\SignalR\SignalR\SignalR\Transports\LongPollingTransport.cs:line 150
at System.Threading.Tasks.Task.Execute()<---

PATH_INFO	/PublicEntrypoint.ashx/connect

QUERY_STRING	transport=longPolling&connectionId=26b8a199-4d16-49d2-8068-313e419a0878&messageId=&groups=&connectionData=