Reactive: Deadlock in LocalScheduler

Created on 17 May 2017  路  3Comments  路  Source: dotnet/reactive

Having updated to Rx.NET 3.0.0 I am seeing a deadlock occur in LocalScheduler due to the use of two locks, which are taken in different orders depending on the code path.

I am seeing one thead stuck in SystemClockChanged, having taken a lock on _gate and now waiting for a lock on s_gate. Another thread has entered ScheduleShortTermWork via EvaluateLongTermQueue, which has a lock on _gate, and is now waiting for a lock on s_gate.

Having reversed the order of locks taken in SystemClockChanged and rebuilt System.Reactive.Core locally, I no longer see this issue.

bug [area] Rx

Most helpful comment

I've just discovered this issue myself (after going through the v3 package rename pain) and was dismayed to find this 9 month old bug report and a 4.0 milestone. I'm not sure how more people aren't screaming about this. Maybe they can't figure out why their applications are freezing or randomly stopping working.

Any chance this can be raised in priority for a 3.1.2 release? The fix is tiny as shown by @tcberry.

All 3 comments

We are using version 3.1.1 and we are experiencing the same deadlock as described by tcberry.
See the attached snapshot:
deadlock in localscheduler

I've just discovered this issue myself (after going through the v3 package rename pain) and was dismayed to find this 9 month old bug report and a 4.0 milestone. I'm not sure how more people aren't screaming about this. Maybe they can't figure out why their applications are freezing or randomly stopping working.

Any chance this can be raised in priority for a 3.1.2 release? The fix is tiny as shown by @tcberry.

The PR for this issue has been merged; we'll look to include it in the next release.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jtbrower picture jtbrower  路  7Comments

Thaina picture Thaina  路  5Comments

oliverjanik picture oliverjanik  路  4Comments

MartinEgli picture MartinEgli  路  5Comments

JanEggers picture JanEggers  路  4Comments