Skip to content

Windows CI: launcher test exits 1 from its own teardown after every assertion has passed #1987

Closed

Description

@abhisheksharma2411

What happens

The windows CI job fails after the launcher suite has printed every "passed" line it has, with no assertion having failed:

ocr launcher exit-code tests passed
ocr launcher signal policy tests passed
skipping POSIX signal relay cases on win32
Error: EBUSY: resource busy or locked, unlink 'C:\Users\RUNNER~1\AppData\Local\Temp\ocr-launcher-test-qtdBKt\node_modules\@alibaba-group\ocr-win32-x64\bin\opencodereview.exe'
    at unlinkSync (node:fs:1948:11)
    at _unlinkSync (node:internal/fs/rimraf:215:14)
    at rimrafSync (node:internal/fs/rimraf:196:7)

Seen on https://github.com/alibaba/open-code-review/actions/runs/42135163088/job/127621342004. Every Go package passed in the same job.

Why

createLauncherFixture copies the running node executable to the fixture binary path on Windows (fs.copyFileSync(process.execPath, binaryPath)), where POSIX gets a symlink. The cases then run it. Windows keeps an executable's image mapped for a short time after the process that ran it exits, so a removal straight afterwards can fail with EBUSY.

Two places remove that file, and either can meet the lock:

  • testSpawnFailure does fs.unlinkSync(fixture.binaryPath);
  • the finally does fs.rmSync(fixture.root, { recursive: true, force: true }).

force: true doesn't help here — it suppresses ENOENT, not EBUSY.

The stack above is from the finally, which means the real failure was the one in testSpawnFailure and the teardown error replaced it on the way out. So the message on screen is never the thing that actually went wrong.

Why it matters beyond the flake

A suite whose assertions all pass can still exit 1, and when something does genuinely fail the error you get is the cleanup's. Both make the Windows job hard to trust.

Suggested fix

Retry both removals — fs.rm retries exactly EBUSY/EPERM when maxRetries is set, though it ignores the retry options unless recursive is also set, even for a single file. And let teardown report rather than decide: a temp directory that will not delete is not a reason to fail a build, and should never replace the run's own error.

Happy to put up a PR.

Activity

  1. lizhengfeng101 commented on Nov 18, 2026

    @lizhengfeng101
    Contributor

    @abhisheksharma2411 Thanks for opening this issue! I had just run into the same problem while looking into the Windows CI failure on #1909 and was about to open an issue myself. You beat me to it, haha! Thanks for putting together a fix in #1988 as well.

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