fix: resolve etxtbsy issue(file busy error) at spawn#15246
Conversation
|
|
Greptile SummaryThis PR fixes ETXTBSY/EBUSY errors that occurred when the BrowserStack CLI binary was being executed while a new version was written to the same path. It replaces direct-to-destination extraction with a PID-scoped temp-file + atomic-rename approach for binary zip entries, adds a pre-spawn
Confidence Score: 3/5The download/extraction path in Two distinct defects exist in packages/wdio-browserstack-service/src/cli/cliUtils.ts — specifically the
|
| Filename | Overview |
|---|---|
| packages/wdio-browserstack-service/src/cli/cliUtils.ts | Core of the ETXTBSY fix: adds PID-scoped temp-file extraction, atomic rename, zip-slip guard, and isBinaryBusy probe. Two error paths in downloadFileStream leave file descriptors open when openReadStreamPromise rejects, and neither path attaches an error handler to the piped readStream. |
| packages/wdio-browserstack-service/src/cli/index.ts | Adds spawn-retry loop with _spawnAndAwaitReady helper; uses idempotent settle to prevent double-settlement; handles synchronous spawn errors and clean-exit-before-ready. Logic is correct. |
| packages/wdio-browserstack-service/src/constants.ts | Adds BINARY_BUSY_ERROR_CODES, MAX_SPAWN_RETRIES, and SPAWN_RETRY_DELAY_MS constants. No issues. |
| packages/wdio-browserstack-service/tests/cli/cliUtils.test.ts | Removes the now-deleted binaryName parameter from the downloadFileStream test call; no new coverage for isBinaryBusy or the spawn-retry logic. |
Reviews (4): Last reviewed commit: "fix(cli): zip-slip guard, directStream e..." | Re-trigger Greptile
…or bailout Address review: - Add zip-slip guard before extraction (BROWSERSTACK_BINARY_URL safety) - Add 'error' listener on directStream for non-binary entries - Add writeStreamErrored flag + early-return in close handler to prevent double zipfile.close() and ENOENT on chmod when stream errors Co-authored-by: Claude <noreply@anthropic.com>
create-wdio
eslint-plugin-wdio
@wdio/allure-reporter
@wdio/appium-service
@wdio/browser-runner
@wdio/browserstack-service
@wdio/cli
@wdio/concise-reporter
@wdio/config
@wdio/cucumber-framework
@wdio/dot-reporter
@wdio/firefox-profile-service
@wdio/globals
@wdio/jasmine-framework
@wdio/json-reporter
@wdio/junit-reporter
@wdio/lighthouse-service
@wdio/local-runner
@wdio/logger
@wdio/mocha-framework
@wdio/protocols
@wdio/repl
@wdio/reporter
@wdio/runner
@wdio/sauce-service
@wdio/shared-store-service
@wdio/smoke-test-cjs-service
@wdio/smoke-test-reporter
@wdio/smoke-test-service
@wdio/spec-reporter
@wdio/static-server-service
@wdio/sumologic-reporter
@wdio/testingbot-service
@wdio/types
@wdio/utils
@wdio/webdriver-mock-service
@wdio/xvfb
webdriver
webdriverio
commit: |
Proposed changes
Fixes a binary file busy (ETXTBSY/EBUSY) error that occurred when the BrowserStack CLI binary was being executed while a new version was being written to the same file path during spawn.
Types of changes
Checklist
Backport Request
v9and doesn't need to be back-ported#XXXXXFurther comments
Reviewers: @webdriverio/project-committers