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 deadlock when deleting measurement and writing to it #8714

Merged
merged 2 commits into from
Aug 16, 2017

Conversation

jwilder
Copy link
Contributor

@jwilder jwilder commented Aug 16, 2017

Required for all non-trivial PRs
  • Rebased/mergable
  • Tests pass
  • CHANGELOG.md updated
  • Sign CLA (if not already signed)

The OnReplace func ends up trying to acquire locks on MeasurementFields. When
its called via snapshotting, this can deadlock because the snapshotting goroutine
also holds an RLock on the engine. If a delete measurement calls is run at the
right time, it will lock the MeasurementFields and try to acquire a lock on the engine
to disable compactions. This creates a deadlock.

To fix this, the OnReplace callback is moved to a function param to allow only Replace
calls as part of a compaction to invoke it as opposed to both snapshotting and compactions.

Fixes #8713

@jwilder jwilder added this to the 1.3.4 milestone Aug 16, 2017
@jwilder jwilder requested a review from stuartcarnie August 16, 2017 21:58
@jwilder jwilder force-pushed the jw-delete-deadlock branch from 337a4d0 to 0d33dd0 Compare August 16, 2017 22:00
The OnReplace func ends up trying to acquire locks on MeasurementFields.  When
its called via snapshotting, this can deadlock because the snapshotting goroutine
also holds an RLock on the engine.  If a delete measurement calls is run at the
right time, it will lock the MeasurementFields and try to acquire a lock on the engine
to disable compactions.  This creates a deadlock.

To fix this, the OnReplace callback is moved to a function param to allow only Replace
calls as part of a compaction to invoke it as opposed to both snapshotting and compactions.

Fixes #8713
@jwilder jwilder force-pushed the jw-delete-deadlock branch from 0d33dd0 to 035b211 Compare August 16, 2017 22:44
Copy link
Contributor

@stuartcarnie stuartcarnie left a comment

Choose a reason for hiding this comment

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

LGTM 🍺

@jwilder jwilder merged commit 9135b21 into master Aug 16, 2017
@jwilder jwilder deleted the jw-delete-deadlock branch August 16, 2017 23:30
@jwilder jwilder mentioned this pull request Aug 16, 2017
jwilder added a commit that referenced this pull request Aug 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deadlock when dropping measurement and writing
2 participants