Skip to content

browser: fix flaky TestOpenDoesNotWaitForLauncherChild cleanup - #8210

Merged
pietern merged 2 commits into
mainfrom
flaky-browser-launcher-child
Nov 30, 2026
Merged

pietern merged 2 commits into
mainfrom
flaky-browser-launcher-child

Conversation

@pietern

@pietern pietern commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Changes

Fix the flaky TestOpenDoesNotWaitForLauncherChild (libs/browser). Test-only change.

The test opens twice, and each open starts a sleeper that writes the same file in the test's TempDir when it ends. The cleanup waited only until that file existed, so it could proceed after the first sleeper while the second one (measured 3-17ms later) wrote the file again during TempDir removal: unlinkat ...: directory not empty. Each open now gets its own TempDir and file, and the cleanup waits for both. The sleeper writes the file with libs/atomicfile (temp file and rename), so the file appears only after it is closed (avoids racing an open handle on Windows).

Dashboard

  • error/1267: TempDir RemoveAll cleanup: unlinkat [PATH]: directory not empty, Linux and macOS, unrelated PRs, since the test was added on 2026-11-19.

Tests

  • Package passes with -race; 180 stress runs of all TestOpen* tests passed.

Gaps and risks

  • The original flake did not reproduce locally (0 in 180 runs); the evidence is a timing log showing the second write landing after the first cleanup started, and after the fix both cleanups always ran after both writes. No test fails without the fix.
  • Risk: low (test-only).

🤖 AI agent (opus5.5, isaac_claude)

This pull request and its description were written by Isaac.

The test opens twice, and each open starts a sleeper that writes the
same file when it ends. The cleanup waited only until that file existed,
so it went ahead after the first sleeper, and the second sleeper could
write the file again while TempDir was being removed: "unlinkat ...:
directory not empty". Give each open its own TempDir and file and wait
for both.

The sleeper now writes a temporary file and renames it into place, so
the file appears only after it is closed and the cleanup cannot race
an open handle on Windows.

Co-authored-by: Isaac <no-reply@databricks.com>
@pietern

pietern commented Nov 30, 2026

Copy link
Copy Markdown
Contributor Author

🤖 /trigger all

AI agent (opus5.5, isaac_claude)

@github-actions github-actions Bot added the test-only-fix PRs that update failing of flaky tests without changing CLI code. label Nov 30, 2026
@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: 6512a96

Run: 46461112256

Env 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux-2core-8gb 1 88 6 1:52
💚​ aws-windows-latest-4core-16gb 1 88 6 3:08
💚​ azure linux-2core-8gb 1 88 6 2:07
💚​ azure-windows-latest-4core-16gb 1 88 6 2:50
💚​ gcp linux-2core-8gb 1 88 6 1:54
💚​ gcp-windows-latest-4core-16gb 1 88 6 3:02
Test Name aws linux-2core-8gb aws-windows-latest-4core-16gb azure linux-2core-8gb azure-windows-latest-4core-16gb gcp linux-2core-8gb gcp-windows-latest-4core-16gb
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
Top 3 slowest tests (at least 2 minutes):
duration env testname
3:07 aws-windows-latest-4core-16gb TestAccept
3:00 gcp-windows-latest-4core-16gb TestAccept
2:49 azure-windows-latest-4core-16gb TestAccept

@pietern
pietern marked this pull request as ready for review November 30, 2026 15:49
@pietern
pietern requested a review from a team as a code owner November 30, 2026 15:49

@review-oss-bot review-oss-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review at c350184. Each finding was verified against the code.

No blocking issues found.

This PR fixes the flaky TestOpenDoesNotWaitForLauncherChild by giving each of the two opens its own sleeper file and cleanup wait. Each sleeper now also writes a temp file and renames it into place, so the marker appears only after the file is closed. I checked the cleanup order: each waitForSleeper is registered after the t.TempDir cleanup, so it runs before RemoveAll, and both sleepers must finish before the directory is removed. I found nothing that needs to change. Two smaller things I checked didn't hold up: the old os.WriteFile error was already thrown away, so a failed rename adds no new silent failure, and the code comment correctly says each open gets its own sleepFile.

Co-authored-by: Isaac <no-reply@databricks.com>
@pietern

pietern commented Nov 30, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Thanks, no change needed for this review. Since then, 6512a96 switches the sleeper's write-then-rename to libs/atomicfile.Write. It has the same behavior: the temp file is closed before the rename, so the marker appears only once it is closed. The package passes with -race, and go vet passes with GOOS=windows.

AI agent (opus5.5, isaac_claude)

@pietern
pietern requested a review from andrewnester November 30, 2026 16:26
@pietern
pietern added this pull request to the merge queue Nov 30, 2026
Merged via the queue into main with commit c3de434 Nov 30, 2026
27 checks passed
@pietern
pietern deleted the flaky-browser-launcher-child branch November 30, 2026 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

factory-generated test-only-fix PRs that update failing of flaky tests without changing CLI code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants