Repository navigation
Merged
Conversation
…ot accessors (#3091) #3086/#3087 introduced the lock-guarded snapshot accessors for cross-goroutine reads of the shared slices, but this helper kept two bare slice reads (len + last element). The sole caller runs once at bridge construction before the collectors register, so the window is near zero (low, consistency cleanup, not a reproducible fault) - but the accessor comments name exactly this use. Replaced both reads with UsageHistorySnapshot()/MetricsSnapshot(). Verified: go build + internal/im tests green under -race; new zz_issue3091 probe (nil/empty/max-from-usage/max-from-metric).
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.
Fixes #3091 (low, #3086/#3087 follow-up consistency cleanup).
Root cause
daemonSessionTurnIndex(daemon_bridge.go) kept two bare slice reads (len(ses.UsageHistory)+ last element, same fors.Metrics) after #3087 introduced the lock-guarded snapshot accessors for exactly these cross-goroutine reads. Sole caller is bridge construction (once, before collectors register), so the race window is near zero - a consistency gap, not a reproducible fault, as the issue itself adjudicates.Fix
Both reads replaced with
UsageHistorySnapshot()/MetricsSnapshot(); max-TurnIndex semantics unchanged.Verification
go build -tags goolm ./...OKinternal/imtests green under-racezz_issue3091_test.go: nil session, empty session, max-from-usage-entry, max-from-metric-entry