开发者

Subject<T> stops publishing items

开发者 https://www.devze.com 2023-03-15 05:53 出处:网络
I have a Subject<T> that I\'m publishing items into via OnNext and after a while, under load, I get this exception:

I have a Subject<T> that I'm publishing items into via OnNext and after a while, under load, I get this exception:

System.NullReferenceException: Object reference not set to an instance of an object
at System.Diagnostics.ExceptionExtensions.PrepareForRethrow (System.Exception exception) [0x00000] in <filename unknown>:0
at System.Concurrency.AsyncLock.Wait (System.Action action) [0x00000] in <filename unknown>:0
at System.Concurrency.Scheduler+<>c__DisplayClass4.<Schedule>b__0 () [0x00000] in <filename unknown>:0
at System.Concurrency.ImmediateScheduler.Schedule (System.Action action) [0x00000] in <filename unknown>:0
at System.Concurrency.Scheduler.Schedule (IScheduler scheduler, System.Action`1 action) [0x00000] in <filename unknown>:0
at System.开发者_JAVA技巧ScheduledObserver`1[GetNotifyd.Superfeedr.FeedItem].EnsureActive () [0x00000] in <filename unknown>:0
at System.Collections.Generic.Subject`1[GetNotifyd.Superfeedr.FeedItem].OnNext (GetNotifyd.Superfeedr.FeedItem value) [0x00000] in <filename unknown>:0

After this happens I can still publish items via OnNext, but my subscriber no longer receives anything. This is running under mono 2.10.1 using the .NET 3.5 Reactive Extensions DLLs from MS (i.e. i don't think it's mono code that's dying). I haven't seen this happen when I try it on windows, but i haven't run the same loads there. The item that is the argument to OnNext is definitely not null, so that's not the cause.

Any idea what might be causing this or how i could recover the Subject, or do i just have to create a new Subject, notify all my subscribers to subscribe to that instead?

Since it looks like an Rx issue, i've also reported it on their forum

Update: The issue was confirmed as a Rx/mono issue for the combinations of versions i was using. Upgrading to latest Rx (1.0.10605) fixed the problem.


You might be hitting a race condition bug in Rx.

Notice in this MSDN thread, a poster had a similar problem: an unexplained NullReferenceException coming from a stack trace that hits AsyncLock.Wait.

Now, his problem was caused by [ThreadStatic] not working on the Windows Phone 7. Is it possible [ThreadStatic] has nuanced behavior on Mono?

I'd recommend reporting this error to the Rx team via the Rx forums.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号