Skip to content

Fix data race in the topology relation cache - #538

Merged
LouisParkin merged 3 commits into
stackstate-7.78.2from
relation-cache-race
Oct 1, 2026
Merged

LouisParkin merged 3 commits into
stackstate-7.78.2from
relation-cache-race

Conversation

@LouisParkin

Copy link
Copy Markdown

SubmitRelation parks relations whose endpoints are not yet known in possibleRelations. The collectors goroutine and the correlator goroutines append to that slice concurrently, and the WaitGroup around the append did not exclude them, so relations could be lost from a topology snapshot. The cache now uses a mutex, and CorrelateRelations reads a snapshot of the slice under it.

The new test submits relations from 8 goroutines. Before the fix it reports data races under -race and loses relations; after the fix, the package tests pass under -race.

Fixes #536

🤖 Generated with Claude Code

Collectors and correlators append to possibleRelations concurrently; the WaitGroup did not exclude them, so relations could be lost.
The moving cacert.pem fails checksum verification whenever curl publishes a new bundle.
@LouisParkin
LouisParkin enabled auto-merge October 1, 2026 13:59
@LouisParkin
LouisParkin added this pull request to the merge queue Oct 1, 2026
Merged via the queue into stackstate-7.78.2 with commit 73a3cdf Oct 1, 2026
42 checks passed
@LouisParkin
LouisParkin deleted the relation-cache-race branch October 1, 2026 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix data race in the topology relation cache

2 participants