diagnostics: lock while populating hardware information#61100
Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom Feb 25, 2021
Merged
diagnostics: lock while populating hardware information#61100craig[bot] merged 1 commit intocockroachdb:masterfrom
craig[bot] merged 1 commit intocockroachdb:masterfrom
Conversation
Member
Contributor
Author
|
Not sure who the right reviewers are; if either of you two know better reviewers, please add. |
Contributor
Author
|
Note that the only real change here is adding the lock. I also moved the code from one file to another to make it more clear that it's shared between both |
RaduBerinde
approved these changes
Feb 25, 2021
Member
RaduBerinde
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! 1 of 0 LGTMs obtained (waiting on @knz)
df53667 to
fbdcb14
Compare
The shirou/gopsutil/host library that we use to gather hardware information during diagnostics reporting is not multi-thread safe. As one example, it lazily initializes a global map the first time the Virtualization function is called, but takes no lock while doing so. Work around this limitation by taking our own lock. This code never triggered race conditions before, but is doing so after recent changes I made to the diagnostics reporting code. Previously, we were using a single background goroutine to do both diagnostics reporting and checking for updates. Now we are doing each of those on different goroutines, which triggers race detection. Fixes cockroachdb#61091 Release justification: fixes for high-priority or high-severity bugs in existing functionality Release note: None
fbdcb14 to
1aee317
Compare
knz
approved these changes
Feb 25, 2021
Contributor
knz
left a comment
There was a problem hiding this comment.
Reviewed 3 of 3 files at r1.
Reviewable status:complete! 0 of 0 LGTMs obtained (and 1 stale)
Contributor
Author
|
bors r+ |
Contributor
|
Build failed: |
Contributor
Author
|
bors r+ |
Contributor
|
Build failed (retrying...): |
Contributor
|
Build succeeded: |
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.
The shirou/gopsutil/host library that we use to gather hardware information
during diagnostics reporting is not multi-thread safe. As one example, it
lazily initializes a global map the first time the Virtualization function
is called, but takes no lock while doing so. Work around this limitation by
taking our own lock.
This code never triggered race conditions before, but is doing so after recent
changes I made to the diagnostics reporting code. Previously, we were using a
single background goroutine to do both diagnostics reporting and checking for
updates. Now we are doing each of those on different goroutines, which triggers
race detection.
Fixes #61091
Release justification: fixes for high-priority or high-severity bugs in existing
functionality
Release note: None