Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #2376 - avoid deadlock scenario when completing dead connections #2378

Merged
merged 4 commits into from
Feb 20, 2023

Conversation

mgravell
Copy link
Collaborator

@mgravell mgravell commented Feb 20, 2023

Deadlock scenario reported with one path (RecordConnectionFailed) taking queue then message locks, and another path (ExecuteSyncImpl) taking message then queue locks; change both paths to only take one lock at a time - never nested.

  1. in RecordConnectionFailed don't hold the queue lock when we abort things - only hold it when fetching next
  2. in ExecuteSyncImpl, don't hold the message lock when throwing for timeout
  3. to avoid similar not yet seen: in GetHeadMessages, don't blindly wait forever on the message lock

also standardise on TryPeek/TryDequeue

1. to fix the immediate scenario: don't hold the queue lock when we abort things - only hold it when fetching next
2. to avoid similar not yet seen: in GetHeadMessages, don't blindly wait forever

also standardise on TryPeek/TryDequeue
Copy link
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 👍

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.

2 participants