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

Race in checkMetricConsistency #512

Closed
beorn7 opened this issue Dec 6, 2018 · 0 comments · Fixed by #513
Closed

Race in checkMetricConsistency #512

beorn7 opened this issue Dec 6, 2018 · 0 comments · Fixed by #513
Assignees
Labels

Comments

@beorn7
Copy link
Member

beorn7 commented Dec 6, 2018

checkMetricConsistency relies on labels being sorted. If they are not, it is sorting them, which is modifying a slice that is assumed to be immutable elsewhere. Even if they are sorted, sort.Sort might temporarily change order (even if no equal elements are in the slice) if there are more than 12 labels (where the implementation switches from ShellSort to HeapSort or QuickSort).

Just using sort.Stable is not a solution as the immutable slice will still be mutated if it is not sorted (which can only happen with home-grown metric families, but it can still happen).

See #511 for discussion . Thanks to @douglas-reid for identifying the bug and its cause.

@beorn7 beorn7 self-assigned this Dec 6, 2018
@beorn7 beorn7 added the bug label Dec 6, 2018
beorn7 pushed a commit that referenced this issue Dec 6, 2018
Signed-off-by: beorn7 <[email protected]>
beorn7 pushed a commit that referenced this issue Dec 6, 2018
Signed-off-by: beorn7 <[email protected]>
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 a pull request may close this issue.

1 participant