Skip to content

test/runner: guard Build fields with mutex to fix data race - #9

Merged
phaus merged 1 commit into
mainfrom
fix/test-runner-race
Sep 4, 2026
Merged

test/runner: guard Build fields with mutex to fix data race#9
phaus merged 1 commit into
mainfrom
fix/test-runner-race

Conversation

@phaus

@phaus phaus commented Sep 4, 2026

Copy link
Copy Markdown
Member

The build goroutine's deferred closure writes b.Failures, b.Duration, b.LogURL and b.LogFile while the status update goroutines spawned by updateStatus read b.Failures and persist the whole Build via save. This is a concurrent read/write race on the shared Build struct.

Add a mutex to Build and hold it when committing the final build state in the deferred closure and when snapshotting/persisting in updateStatus, so the two critical sections serialize.

The build goroutine's deferred closure writes b.Failures, b.Duration,
b.LogURL and b.LogFile while the status update goroutines spawned by
updateStatus read b.Failures and persist the whole Build via save. This
is a concurrent read/write race on the shared Build struct.

Add a mutex to Build and hold it when committing the final build state in
the deferred closure and when snapshotting/persisting in updateStatus, so
the two critical sections serialize.
@phaus
phaus merged commit 29930eb into main Sep 4, 2026
2 checks passed
@phaus
phaus deleted the fix/test-runner-race branch September 4, 2026 09:05
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.

1 participant