Fix TestBuildHermeticEnv cleanup race with Go telemetry background process - #284
Draft
mohammed90 with Copilot wants to merge 1 commit into
Draft
Fix TestBuildHermeticEnv cleanup race with Go telemetry background process#284mohammed90 with Copilot wants to merge 1 commit into
mohammed90 with Copilot wants to merge 1 commit into
Conversation
Copilot created this pull request from a session on behalf of
mohammed90
August 1, 2026 22:44
View session
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.
TestBuildHermeticEnvfails intermittently on Go 1.26 Linux withTempDir RemoveAll cleanup: unlinkat .../telemetry: directory not empty. Go's telemetry subsystem spawns a background OS process that continues writing to$HOME/.config/go/telemetry/aftergo mod initexits, racing againstt.TempDir'sRemoveAllcleanup.Fix
Pre-create the telemetry mode file before running the hermetic build:
Setting the mode to
offprevents the background telemetry process from starting.GOTELEMETRYis not an overridable OS env var—it is read from this mode file—so this is the correct mechanism.Fails only on Linux/Go 1.26 because macOS resolves the telemetry dir via
~/Library/...(outside the hermeticHOME), and the race window is narrower on earlier Go versions.