Skip to content

flaky: gateway-fleet e2e on Windows fails cleanup with EBUSY on a worker temp folder #1852

Done

Description

@V3RON

src/daemon/gateway-fleet.e2e.test.ts, "gateway fleet smoke (ADR 0005 §35) > leases a device on the right worker and execs a real command against it through the gateway" failed on PR #1830 at 7290bed (CI run 45566787367, Unit tests (Windows)): EBUSY: resource busy or locked, rmdir 'C:\Users\RUNNER~1\AppData\Local\Temp\simlock-e2e-worker-b-9i4pD8'. The test ran 28.5 s before failing on removing the worker's temp folder. PR #1830's diff (a win32 ports test case) does not touch the gateway, the worker or this test.

Written by an agent.

Activity

  1. added
    bug:new
    flaky-test
    on Nov 25, 2026
  2. self-assigned this
    on Nov 26, 2026
  3. V3RON commented on Nov 26, 2026

    @V3RON
    ContributorAuthor

    Reproduction

    The EBUSY is a daemon's npm child still running in worker-b's folder after the daemon stopped. A Windows process holds its working folder open, so the folder cannot be removed. The failed test took 28.5 s against 5.8 s on the rerun: the 25 s removal retry in afterEach ran out.

    Test on bug/1852-repro: src/daemon/main-update.test.ts, "stopping a worker or a gateway ends the npm view its version check is still waiting on". It drives the real NodeNpmCli through a runner whose child ends only when aborted.

    ./node_modules/.bin/vitest run --project unit src/daemon/main-update.test.ts -t "ends the npm view"
    AssertionError: expected { role: 'worker', ended: false } to deeply equal { role: 'worker', ended: true }
     ❯ src/daemon/main-update.test.ts:399:48
    

    Root cause

    Defect. src/daemon/version-check.ts:27 calls npm.view("simlock@latest") with no way to cancel it, and dispose (line 46) only sets disposed and cancels the 24 h timer. Every daemon started without an npm fake runs node npm-cli.js view with cwd set to its data directory (src/daemon/main.ts:315, src/ports/npm-cli.ts:93), with a 30 s limit. A stop during that call leaves the child running. On a loaded runner, worker-b starts last, so its child finishes last and holds the folder past the retry.

    Simplest fix

    NpmCli.view(spec, signal?). NodeNpmCli passes the signal on to runner.run. startVersionCheck makes an AbortController and dispose aborts it.

    vitest run --project unit src/daemon/main-update.test.ts src/ports/npm-cli.test.ts src/daemon/main.test.ts
    Tests  31 passed (31);  pnpm typecheck: clean
    

    Alternatives rejected

    Risk

    • dispose does not wait for the killed child to exit. The test's 25 s retry covers that gap.
    • Not run on Windows: the PC was unreachable.

    Fast track

    • Defect: yes
    • Fix tried: yes
    • Nothing public added or broken: yes
    • No ADR or rule changed: yes
    • One fix: yes

    Side findings

    Written by an agent.

  4. removed their assignment
    on Nov 26, 2026
  5. added
    bug:ready
    fast-track
    and removed
    bug:new
    on Nov 26, 2026
  6. self-assigned this
    on Nov 26, 2026
  7. V3RON commented on Nov 26, 2026

    @V3RON
    ContributorAuthor

    Delivery run

    Merged: #1886 (#1852)
    Parked: none
    Waiting: none
    Decided: none

    Written by an agent.

  8. added a commit that references this issue on Nov 26, 2026
    72c8ec6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug:readyfast-trackflaky-test

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions