tsdb/index/postings: fix missing lock unlock#14103
Merged
beorn7 merged 1 commit intoprometheus:mainfrom May 15, 2024
Merged
Conversation
Followup to prometheus#14096 Unfortunately the previous PR introduced this bug by not releasing the lock before returning. Signed-off-by: György Krajcsovits <[email protected]>
beorn7
reviewed
May 15, 2024
Member
beorn7
left a comment
There was a problem hiding this comment.
Could we just do defer p.mtx.RUnlock() in line 402?
Member
Author
I suspect it's not done that way because of line 431, the last return |
beorn7
approved these changes
May 15, 2024
Member
beorn7
left a comment
There was a problem hiding this comment.
Ah, right, we need to release it before executing Merge. Too bad…
Contributor
|
We could unlock by default in defer, and skip unlock in defer when not needed. and set (We use this pattern in few places in Mimir.) |
Member
|
Hmm, not sure what is less bad… it's both error prone, but the current solution is still a bit more compact (which would change if we had more exit points). |
krajorama
added a commit
to grafana/mimir
that referenced
this pull request
May 15, 2024
grafana/mimir-prometheus@e5b85c1 To get prometheus/prometheus#14103 Signed-off-by: György Krajcsovits <[email protected]>
krajorama
added a commit
to grafana/mimir
that referenced
this pull request
May 15, 2024
* Update mimir-prometheus to e5b85c151ba8 grafana/mimir-prometheus@e5b85c1 prometheus/prometheus#14103 prometheus/prometheus#14096 prometheus/prometheus#14068 prometheus/prometheus#13669 Signed-off-by: György Krajcsovits <[email protected]>
grafanabot
pushed a commit
to grafana/mimir
that referenced
this pull request
May 15, 2024
* Update mimir-prometheus to e5b85c151ba8 grafana/mimir-prometheus@e5b85c1 prometheus/prometheus#14103 prometheus/prometheus#14096 prometheus/prometheus#14068 prometheus/prometheus#13669 Signed-off-by: György Krajcsovits <[email protected]> (cherry picked from commit 307567a)
krajorama
added a commit
to grafana/mimir
that referenced
this pull request
May 15, 2024
* Update mimir-prometheus to e5b85c151ba8 grafana/mimir-prometheus@e5b85c1 prometheus/prometheus#14103 prometheus/prometheus#14096 prometheus/prometheus#14068 prometheus/prometheus#13669 Signed-off-by: György Krajcsovits <[email protected]> (cherry picked from commit 307567a) Co-authored-by: George Krajcsovits <[email protected]>
francoposa
pushed a commit
to grafana/mimir
that referenced
this pull request
May 27, 2024
* Update mimir-prometheus to e5b85c151ba8 grafana/mimir-prometheus@e5b85c1 prometheus/prometheus#14103 prometheus/prometheus#14096 prometheus/prometheus#14068 prometheus/prometheus#13669 Signed-off-by: György Krajcsovits <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Followup to #14096
Unfortunately the previous PR introduced this bug by not releasing the lock before returning.