Skip to content

test(server): desktop upload test no longer races chromium's DevToolsActivePort write - #38727

Merged
juliusmarminge merged 2 commits into
pingdotgg:mainfrom
realsuiciniv:fix/desktop-upload-test-devtools-port
Nov 19, 2026
Merged

juliusmarminge merged 2 commits into
pingdotgg:mainfrom
realsuiciniv:fix/desktop-upload-test-devtools-port

Conversation

@realsuiciniv

Copy link
Copy Markdown
Contributor

Problem

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).

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 18, 2026
@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

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.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Other

Suggested reviewers: juliusmarminge, maria-rcks, macroscopeapp

Merge Risk: Minimal · previous review 9bfcf

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: Passed 4

Check name Status Explanation
Title check Passed 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 Passed 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 Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed 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
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between e396bb2 and 9bfcf90.

Files selected for processing: 1

  • apps/server/src/preview/ServerBrowserContexts.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 19, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

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.

Before After
9246c3235e dc7005c6c5
Before: 51 MiB upload After: identical 51 MiB upload
Upload recording Upload recording

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.

Runtime and reproduction transcript · Driver · Delay wrapper · Reproduction instructions

Not shown:

  • 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.

@juliusmarminge juliusmarminge added takeover:ready Takeover done; auto-lands when gates pass and removed takeover:in-progress A takeover lead is working on this PR labels Nov 19, 2026
@juliusmarminge
juliusmarminge merged commit 2ab3b7f into pingdotgg:main Nov 19, 2026
45 checks passed
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants