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

rpcc: Fix potential deadlock in stream Sync #134

Merged
merged 2 commits into from Jun 4, 2022

Conversation

mafredri
Copy link
Owner

@mafredri mafredri commented Jun 4, 2022

The simplified Conn mutex handling introduced in #74 incorrectly moved the mutex Unlock to after stream.write. This created the opportunity for a racy mutex deadlock scenario with simultaneous writes to stream while Sync is being performed.

Due to it's racyness, this was only occasionally caught by TestStreamSyncNotifyDeadlock and evaded detection.

  • rpcc: Fix potential deadlock in stream Sync
  • rpcc: Improve odds of deadlock in TestStreamSyncNotifyDeadlock

The simplified Conn mutex handling introduced in #74 incorrectly moved
the mutex Unlock to after stream.write. This created the opportunity for
a racy mutex deadlock scenario with simultaneous writes to stream while
`Sync` is being performed.

Due to it's racyness, this was only occasionally caught by
`TestStreamSyncNotifyDeadlock` and evaded detection.
@codecov
Copy link

codecov bot commented Jun 4, 2022

Codecov Report

Merging #134 (e1f858d) into main (d0c159a) will decrease coverage by 0.6%.
The diff coverage is 100.0%.

@@           Coverage Diff           @@
##            main    #134     +/-   ##
=======================================
- Coverage   84.4%   83.8%   -0.6%     
=======================================
  Files         21      21             
  Lines       1335    1335             
=======================================
- Hits        1127    1119      -8     
- Misses       173     179      +6     
- Partials      35      37      +2     

@mafredri mafredri merged commit 91594d7 into main Jun 4, 2022
@mafredri mafredri deleted the fix-rpcc-stream-sync-deadlock branch June 4, 2022 11:38
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.

None yet

1 participant