Skip to content

Fixed #1131 - Race condition between SuspendNotifications() and .ResumeNotifications()#1132

Open
JakenVeina wants to merge 1 commit into
mainfrom
issues/1131
Open

Fixed #1131 - Race condition between SuspendNotifications() and .ResumeNotifications()#1132
JakenVeina wants to merge 1 commit into
mainfrom
issues/1131

Conversation

@JakenVeina

Copy link
Copy Markdown
Collaborator

Fixed that ObservableCache.SuspendNotifications() uses a lock to synchronize updates to internal state for tracking notification suspensions, but .ResumeNotifications() did not use any synchronization when updating that same state, allowing for corruption of state if the two methods happen to overlap, concurrently.

Also fixed that the test for this behavior was intermittent, specifically that it tended to falsely pass when running in parallel with many other tests. The test has now been moved to its own IntegrationTests fixture, to guarantee it is never parallelized with other tests.

Resolves #1131.

@dwcullop I suspect this may not be a proper fix, in the context of DeliveryQueue<>. I.E. this solution involves using a basic lock() when perhaps the proper solution should be using the locking mechanisms upon DeliveryQueue<>. But I don't have the familiarity with it. For now, I just duplicated the existing lock(_locker) upon .SuspendNotifications() over to .ResumeNotifications(). If you'd rather take a crack at this yourself instead, go for it.

The test changes we should definitely keep, though.

…synchronize updates to internal state for tracking notification suspensions, but `.ResumeNotifications()` did not use any synchronization when updating that same state, allowing for corruption of state if the two methods happen to overlap, concurrently.

Also fixed that the test for this behavior was intermittent, specifically that it tended to falsely pass when running in parallel with many other tests. The test has now been moved to its own `IntegrationTests` fixture, to guarantee it is never parallelized with other tests.

Resolves #1131.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Intermittent test failure for in SuspendNotificationsFixture

1 participant