Skip to content

Fix race in proxy-bcrypt test that crashes Windows CI - #1008

Open
X-Guardian wants to merge 1 commit into
mapbox:masterfrom
X-Guardian:fix/proxy-bcrypt-extract-race
Open

X-Guardian wants to merge 1 commit into
mapbox:masterfrom
X-Guardian:fix/proxy-bcrypt-extract-race

Conversation

@X-Guardian

Copy link
Copy Markdown
Contributor

ci (latest, windows-latest) failed on master after #1001 (run), with the tape process exiting mid-run during app1 build:

Error: ENOENT: no such file or directory, utime '...\Temp\npg-download\napi-v3\bcrypt_lib.node'
Emitted 'error' event on Extract instance

The error comes from test/proxy-bcrypt.test.js, which had already passed a few seconds earlier. The same job passed on the preceding PR run and on the next PR run, so this is a timing flake rather than a regression.

Cause

The download test resolved on the gunzip stream's end. At that point tar-fs has written bcrypt_lib.node but has not finished: it sets the file's times afterwards. The cleanup test then called rimraf(downloadDir) without awaiting it. On a slow runner the delete won, tar-fs's utime hit ENOENT, and with no error listener on the extract stream the error was unhandled and killed tape.

Changes

Resolve on tar-fs finish instead of gunzip end, and reject on errors from either stream, so the test only ends once extraction is complete and any extraction error fails the test rather than the process.

Await rimraf in cleanup, so the directory is gone before the next test file starts.

Create downloadDir in setup. It previously created a stray ./download directory in the working directory, which nothing used.

@X-Guardian
X-Guardian requested a review from a team as a code owner September 30, 2026 09:12
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