Skip to content

Parser: wait out a brief lock when opening a V8 log - #9

Merged
Saeris merged 1 commit into
mainfrom
fix/wait-out-locked-logs
Nov 9, 2026
Merged

Saeris merged 1 commit into
mainfrom
fix/wait-out-locked-logs

Conversation

@Saeris

@Saeris Saeris commented Nov 9, 2026

Copy link
Copy Markdown
Owner

Fixes the flaky Windows lane on the version PR (#5).

The diagnostic #8 added to "the teardown writes findings.json that the LSP can publish" caught the cause on the version PR's Node latest / Windows lane:

findings.json has no source-mapped megamorphic "x" finding (none at all). It holds 0 finding(s) from 0 log(s); the manifest lists 1.
deoptkit: could not analyze …\v8-7560.log: EBUSY: resource busy or locked, open '…\v8-7560.log'

The worker had already exited: the teardown did not report it as still running. Another process held the file for a moment after its writer closed it, which on Windows is usually an antivirus scan, and Node reports that sharing violation as EBUSY. The next test reads the same log later and succeeds.

readLog now opens through openLog, which retries EBUSY with a backoff (25 ms doubling to 1 s) for up to 10 s and fails at once on any other error. Every log reader goes through it: the bench teardown, profile_run, load_log and deoptkit ci, which all read a log right after its writer exits. So this fixes the same failure for users, not only in CI.

A correction to #8. I said there that unfinished logs dropped these findings on Windows. The one failure on record is this lock, so the comment and the pending bump file no longer claim it. The wait for workers to exit stays: V8 does write the end of a log at exit, and Vitest does run the teardown first.

Tests

src/parser/__tests__/logReader.spec.ts, mutation-checked:

  • A lock that clears is waited out; any other error (ENOENT) fails at once; a lock that never clears ends the wait.
  • On Windows only, the real thing: PowerShell opens the log with no sharing (FileShare.None, as a scanner does) for 700 ms while readLog reads it.
  • Mutations: never retry (fails the stand-in and the real-lock test, which confirms the lock surfaces as EBUSY), retry every error, no deadline, readLog bypassing the retry.

vp check is clean, and vp run test passes 198 tests in 27 files on Node 26.13 (Windows).

The version PR's Windows lane failed with the diagnostic #8 added: "could not analyze …\v8-7560.log: EBUSY: resource busy or locked, open". The worker had already exited (the teardown did not report it as still running), but another process held the file for a moment after its writer closed it, which on Windows is usually an antivirus scan. The test after it reads the same log later and succeeds.

readLog now opens through openLog, which retries EBUSY with a backoff (25 ms doubling to 1 s) for up to 10 s and fails at once on any other error. Every reader goes through it: the bench teardown, profile_run, load_log and deoptkit ci, which all read a log right after its writer exits.

This also corrects #8's claim that unfinished logs dropped the findings on Windows: the failure on record is this lock. The comment and pending bump file no longer say so.
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

bumpy-frog

The changes in this PR will be included in the next version bump.

patch Patch releases

  • deoptkit 0.2.0 → 0.2.1
  • deoptkit-vscode 0.1.0 → 0.1.1 (cascade)

Bump files in this PR

Click here if you want to add another bump file to this PR


This comment is maintained by bumpy.

@Saeris
Saeris merged commit e5451aa into main Nov 9, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant