Fix race condition in Sentinel connection multiplexer by ewisuri · Pull Request #2133 · StackExchange/StackExchange.Redis

Skip to content

Navigation Menu

Sign in

Appearance settings

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Merged

NickCraver merged 2 commits intoStackExchange:mainfrom

ewisuri:main

May 10, 2022

Conversation

@ewisuri

Copy link Copy Markdown

Contributor

@ewisuri ewisuri commented

May 7, 2022

In the Sentinel Connection Multiplexer, since OnManagedConnectionRestored can be executed on a different thread, it's possible for it to dispose the timer just before OnManagedConnectionFailed calls .Change() on the timer, which leads to an ObjectDisposedException being thrown in OnManagedConnectionFailed. Since the connection was restored, it seems safe to suppress these exceptions, instead of requiring locking around the reference to connection.sentinelPrimaryReconnectTimer.

@NickCraver NickCraver self-assigned this

May 10, 2022
Copy link Copy Markdown

Collaborator

@NickCraver NickCraver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good - thanks for the fix here!

@NickCraver NickCraver merged commit dc9a9b6 into StackExchange:main

May 10, 2022

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

Reviewers

@NickCraver NickCraver NickCraver approved these changes

Assignees

@NickCraver NickCraver

Labels

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@ewisuri @NickCraver