Skip to content

Fix data race in the topology relation cache - #538

Open
LouisParkin wants to merge 3 commits into
stackstate-7.78.2from
relation-cache-race
Open

LouisParkin wants to merge 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

This branch has not been deployed

No deployments
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