-
Notifications
You must be signed in to change notification settings - Fork 4.6k
fix(core): prevent concurrent downloads clobbering by using unique temp dirs #37335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix(core): prevent concurrent downloads clobbering by using unique temp dirs #37335
Conversation
emyjamalian
commented
Sep 8, 2025
- This change ensures concurrent 'npx playwright install' processes do not clobber each other by downloading to a unique temporary directory before finalizing.
- Adds unique temp dir per download in packages/playwright-core/src/server/registry/browserFetcher.ts.
- Adds installation test tests/installation/concurrent-download.spec.ts validating concurrent installs.
- Test assertions avoid depending on stdout formatting.
- Fixes [Bug]: Jobs running concurrently on the same machine download browsers to the same directory and clobber each other (Windows) #32179
…mp dirs Fixes #<please-link-issue-if-any>. Adds temporary unique download directory to avoid race conditions during concurrent installs. Updates installation test to be resilient to stdout formatting.
@microsoft-github-policy-service agree |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Use removeFolders() for temp dir cleanup and restore ProgressBar type. This prevents concurrent installs from clobbering each other.
…ncurrent-download test
This comment has been minimized.
This comment has been minimized.
Test results for "tests 1"2 failed 3 flaky46842 passed, 821 skipped Merge workflow run. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new test is failing on Windows.
await exec('npm init -y'); | ||
await exec('npm install playwright'); | ||
const numProcesses = 3; | ||
await Promise.all(Array.from({ length: numProcesses }, () => exec('npx playwright install chromium'))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All 3 commands will try to install browsers into the same directory, which may lead to the test flakiness. Please make sure the the commands run with different PLAYWRIGHT_BROWSERS_PATH
values, something like:
await Promise.all(Array.from({ length: numProcesses }, (_, index) =>
exec('npx playwright install chromium', {
env: {
PLAYWRIGHT_BROWSERS_PATH: test.info().outputPath(`browsers-${index}`),
}
})
));