-
Notifications
You must be signed in to change notification settings - Fork 9.7k
fix: unlock of unlocked mutex #16332
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: unlock of unlocked mutex #16332
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks.
@Alhanaqtah Can you sign your commits please? We can't merge before that's taken care of, this is why the DCO check is failing. |
You have to sign all of your commits. Maybe just squash them into one, signed, commit? |
Signed-off-by: Usama Alhanaqtah <a.usama@yandex.ru>
4c0fd99
to
f7eaaf5
Compare
IMO this change could use a test, otherwise there's nothing preventing it from happen again. |
Is there any conventions or guidelines for writing test? |
You can check |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Alhanaqtah your code changes look good but as @colega pointed out we're missing a unit test. I can give you some pointers.
func TestHeadAppender_AppendCT(t *testing.T) {
Line 6499 in b07b552
func TestHeadAppender_AppendCT(t *testing.T) { - Originally the appendableHistogram functions did not return other types of errors other than
ErrOutOfOrderSample
this why we got to this situation. However now they can returnErrDuplicateSampleForTimestamp
ErrTooOldSample
ErrOutOfBounds
andErrOutOfOrderSample
. So for example I think that if you attempt twoAppendHistogramCTZeroSample
calls with the same values you should be gettingErrDuplicateSampleForTimestamp
fromappendableHistogram
and your new return clauses should be executed.
Are you up for this quick test?
@jesusvazquez thanks for the pointers. They are very helpful) Yeah, i'll write tests |
Signed-off-by: Usama Alhanaqtah <a.usama@yandex.ru>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I checked that the test panics without the fix.
@jesusvazquez could you approve PR, please? |
I've just ran into this bug when I triggered duplicate sample error in grafana/mimir#11977 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I'd prefer a few more testcases, but I can add mine later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR and the tests.
Fixing panic caused by unlocking unlocked mutex.
Fixed #16318