You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test(server): desktop upload test no longer races chromium's DevToolsActivePort write - #38727
uploads a file over 50 MB to a desktop tab, which shares the server's filesystem in apps/server/src/preview/ServerBrowserContexts.test.ts can fail with ENOENT: no such file or directory, open '/tmp/t3-desktop-upload-XXXXXX/profile/DevToolsActivePort'. the test launches chromium with --remote-debugging-port=0 and reads DevToolsActivePort as soon as the launch resolves. playwright resolves the launch on chromium's DevTools listening on stderr line, and chromium writes DevToolsActivePort only after printing it (devtools_http_handler.cc), so the read races the write. on GitHub-hosted ubuntu-24.04 runners it failed 3 of 132 CI jobs that ran this file. this repo's CI hasn't hit it: none of the 53 failed Test Server jobs since the test landed fail on it.
Change
the test reserves a loopback port the way the user agent test in the same file does (http server on port 0, read address(), close), passes it to chromium and connects to it. playwright already waits for DevTools listening on, which chromium prints after binding the socket, so the endpoint is live when the launch resolves. test-only change, no sleep, poll, retry or timeout.
Scope
small fix of an obvious test bug, so no issue. searched issues and PRs for DevToolsActivePort, nothing open.
Verification
real test file on linux (mcr.microsoft.com/playwright:v1.64.1-noble, arm64), with chrome-headless-shell wrapped in strace --seccomp-bpf -P <profile>/DevToolsActivePort -e inject=openat:delay_enter=300000 so only chromium's open of that file is delayed: main fails 5/5 with the CI error, this branch passes 10/10 and the whole file 16/16. same wrapper with no delay: main passes 5/5.
delay sweep on the old launch and read: 20 ms 0/20 failed, 50 ms 15/20, 100 ms 20/20.
no natural repro locally: 0 of 900 launches on linux (including cpu and fsync load) and 0 of 350 on macOS.
macOS: whole file 25/25 runs on this branch. vp run check:changed passes (format, lint, knip, typecheck of 3 packages, tests for 2 files).
Reviewing files that changed from the base of the PR and between 9bfcf90 and dc7005c.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
The large-file upload test now obtains an available loopback port by briefly binding a temporary HTTP server. It closes the server before launching Chromium with that port and removes the previous DevToolsActivePort file lookup.
Changes: Large-file upload test
Layer / File(s)
Summary
Reserve and pass a loopback port apps/server/src/preview/ServerBrowserContexts.test.ts
The test briefly binds a temporary HTTP server to obtain an available port, closes it, and passes the port to Chromium as --remote-debugging-port. It no longer requests port 0 or reads DevToolsActivePort.
This is a test-only fix for a flaky desktop upload test, with no production behavior change. It is ready to merge.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: the desktop upload test no longer races Chromium's DevToolsActivePort write. The raw summary confirms the test now reserves a port and passes it via --remote-debugging…
Description check
The description follows the template sections (Problem, Change, Scope, Verification). Problem explains the race and failure mode with reproduction context. Change explains the port reservation approac…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: the desktop upload test no longer races Chromium's DevToolsActivePort write. The raw summary confirms the test now reserves a port and passes it via --remote-debugging-port instead of reading DevToolsActivePort. The title is specific and follows the conventional commit format.
Full details: Description check
Explanation
The description follows the template sections (Problem, Change, Scope, Verification). Problem explains the race and failure mode with reproduction context. Change explains the port reservation approach and states it is test-only. Scope says it is a small obvious test bug and searched for existing issues. Verification gives focused test runs, delay sweeps, and macOS results, and states the check command run. It does not list anything that could not be checked, and it does not mention the agent/model line, which the template asks for only if an agent was used. Overall the description is mostly complete.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Connect real Chromium through the production server browser service, select synthetic large.bin, and verify its browser FileList contains 53,477,376 bytes. Both sides use fresh profiles, Linux Chromium, 1280×720, and light theme. Final screenshots are byte-identical. These captures show the synthetic browser fixture, not the Electron shell.
With a 300 ms delay on DevToolsActivePort creation, base stops with ENOENT before connecting; head completes the same upload. This Chromium build uses creat, so the wrapper delays that syscall. The existing repository test also fails on base and passes on head; those test results are supplemental to the runtime captures.
The full Electron application was not launched: runtime evidence drives the production server browser service directly against real Chromium. No desktop-shell UI equivalence is claimed.
Concurrent occupation of the reserved port between release and Chromium binding was not forced.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size:S10-29 changed lines (additions + deletions).vouch:unvouchedAuthor is not yet trusted in the VOUCHED list.
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
uploads a file over 50 MB to a desktop tab, which shares the server's filesysteminapps/server/src/preview/ServerBrowserContexts.test.tscan fail withENOENT: no such file or directory, open '/tmp/t3-desktop-upload-XXXXXX/profile/DevToolsActivePort'. the test launches chromium with--remote-debugging-port=0and readsDevToolsActivePortas soon as the launch resolves. playwright resolves the launch on chromium'sDevTools listening onstderr line, and chromium writesDevToolsActivePortonly after printing it (devtools_http_handler.cc), so the read races the write. on GitHub-hosted ubuntu-24.04 runners it failed 3 of 132 CI jobs that ran this file. this repo's CI hasn't hit it: none of the 53 failed Test Server jobs since the test landed fail on it.Change
the test reserves a loopback port the way the user agent test in the same file does (http server on port 0, read
address(), close), passes it to chromium and connects to it. playwright already waits forDevTools listening on, which chromium prints after binding the socket, so the endpoint is live when the launch resolves. test-only change, no sleep, poll, retry or timeout.Scope
small fix of an obvious test bug, so no issue. searched issues and PRs for
DevToolsActivePort, nothing open.Verification
mcr.microsoft.com/playwright:v1.64.1-noble, arm64), with chrome-headless-shell wrapped instrace --seccomp-bpf -P <profile>/DevToolsActivePort -e inject=openat:delay_enter=300000so only chromium's open of that file is delayed: main fails 5/5 with the CI error, this branch passes 10/10 and the whole file 16/16. same wrapper with no delay: main passes 5/5.vp run check:changedpasses (format, lint, knip, typecheck of 3 packages, tests for 2 files).