NullRef exception in IAsyncStream<T>.SubscribeAsync(observer) when upgrading to 1.4.0
Here's a sanitized version of the code where the error occurs:
var provider = GrainClient.GetStreamProvider("SMSProvider");
var observer = new MyObserver(id);
var stream = provider.GetStream<VisualPacket>(id, "namespace");
observer._handle = await stream.SubscribeAsync(observer);
I upgraded from 1.4.0 from 1.3.1 and SubscribeAsync() is throwing a null ref exception. This code was working fine before the upgrade, and I haven't made any other modifications to my code/configuration. My only configuration for streams is registering the provider and backing store:
client:
config.RegisterStreamProvider<SimpleMessageStreamProvider>("SMSProvider");
silo:
config.AddMemoryStorageProvider("PubSubStore");
config.AddSimpleMessageStreamProvider("SMSProvider", fireAndForgetDelivery: true);
Here's the stack trace:
at Orleans.Providers.ClientProviderRuntime.ExecutingEntityIdentity()
at Orleans.Streams.StreamConsumerExtension.SetObserver[T]()
at Orleans.Streams.StreamConsumer1.<SubscribeAsync>d__14.MoveNext()
I'm going to ping @ReubenBond on this, because it looks like most of the recent runtime client work was his.
We had a similar problem just the other day. We figured out that it is the Client Configuration logging level.
Changed it from
<Tracing DefaultTraceLevel="Verbose" ...>
to anything higher ("Info" or "Warning") seems to have fixed it.
Specifically its the logging for "Provider" that is killing us:
<TraceLevelOverride LogPrefix="Provider" TraceLevel="**## Verbose**" /> is bad
@TrexinanF14 The call stack above seems incomplete to me. Are you sure there weren't more frames on it? Have you solved this by turning off verbose logging?
By setting the TraceLevel to verbose or higher, I was able to reproduce this in 1.4 and .1.4.1, but not in the current code, so it should be fixed in 1.5 release.
Fixed in master, likely as part of the removal of statics. The fix will be included in 1.5.0.