Skip to content

Updater cleanup test reads the replacement callback without waiting #1332

Description

@frahlg

TestHandleUpdate_ImageCleanupFailureKeepsUpdateDone reads the replaced string after waiting for update state done. The update goroutine writes that string in selfReplace, which runs after done is published. There is no synchronization between those accesses.

Observed during local make verify: updater self-replace target = "". Confirmed with:

cd go
go test -race -tags=netgo,osusergo ./cmd/ftw-updater -run '^TestHandleUpdate_ImageCleanupFailureKeepsUpdateDone$' -count=10

The race detector reports the read at image_prune_test.go:103 and write at image_prune_test.go:94. This is a race in the test callback and assertion; this evidence does not establish a failed real updater replacement.

Replace the shared string with a buffered channel and wait with a bounded timeout for the replacement callback before asserting its target. Keep the test that cleanup failure leaves the update done.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions