Repository navigation
Description
smokePackagedRenderer in scripts/verify-packaged-app.mjs reserves a CDP port, launches the packaged app with it, and polls http://127.0.0.1:<port>/json/list. When that poll times out, the error names neither the port it polled nor the deadline's cause:
Error: Packaged Maka renderer did not expose CDP within 30 seconds: fetch failed.
DevTools listening on ws://127.0.0.1:59034/devtools/browser/f8d99344-...
The app's own stderr carries a port; the verifier's message does not. So the one comparison that would classify the failure — are these the same port? — cannot be made from the log.
Observed: run 32108361079, package, on #3148. It failed in the upgrade-lifecycle step while the same binary had passed the identical smoke ~3 minutes earlier in the same job. A re-run of the identical tree passed, so the failure was environmental — but establishing that took a re-run rather than a read of the log.
Why the log is not enough. Three causes produce this same message, and only one is already distinguishable:
- the app failed to start — ruled out, since
child.exitCode !== nullreportsexited before its renderer was readyinstead, and the captured stderr held no error - the app is listening on a port the verifier is not polling
- the app is listening on the right port and simply had not served CDP within 30s
The second and third are indistinguishable today. I tried to separate them and could not: an occupied port makes Electron print no DevTools listening line at all (so the printed line argues against a mismatch), and the lifecycle step's reuse of one smokeDirectory across both app versions — a real difference from the standalone check that passed — reproduced 3/3 passes locally when I reused that Chromium profile.
Suspected cause of the flakiness itself: reserveTcpPort binds port 0, reads the number, then closes the socket before Electron binds it. Between those two points the port is free for anything else on the runner to take. Whether that is what happened here is exactly what the log cannot say.
Suggested fix, smallest first:
- Include the polled port and the elapsed time in the timeout message. One line, and it makes this class of failure classifiable on sight.
- Read the real port from
<user-data-dir>/DevToolsActivePort, which Chromium writes, instead of trusting the requested number. That removes the reserve-then-release race rather than only reporting it.
Scope note: this is diagnostics for the release verifier, not a product defect, and it is independent of any open PR.
Activity
Joob1n commentedon Aug 18, 2026
I hit this one while working on #3148 and plan to implement it — starting with the message change, then the
DevToolsActivePortread so the reserve-then-release window stops mattering.chore: retrigger CI after the known CDP smoke flake
chore: retrigger CI — second CDP smoke fault in the lifecycle step
Joob1n commentedon Aug 24, 2026
Re-checked this against current
main. The cause is gone; only a fraction of the diagnostics ask is left, and it is worth less than it was.#3327 replaced the reserve-then-release scheme with the port Chromium itself announces:
That comment describes this issue, including the message quoted in the body. All three verification paths call it —
verify-packaged-app.mjs:724,verify-windows-autoupdate.mjs:310,verify-windows-installer-rollback.mjs:199.This closes the ambiguity the issue was actually about. The two causes I said were indistinguishable were "listening on a port the verifier is not polling" and "listening on the right port but slow". The first can no longer happen: the verifier does not choose a port, it reads the one the app bound. So the comparison I wanted the log to make — are these the same port? — has nothing left to compare, which is a better outcome than being able to make it.
The suggested fix #2 (read the real port rather than trusting the requested number) is therefore implemented, in a stronger form than I proposed. I suggested reading
DevToolsActivePortfrom the user-data dir; taking it from the announcement removes the reservation entirely rather than checking it afterwards.Separately, the timeout message gained the error cause chain, which distinguishes
ECONNREFUSEDfromETIMEDOUTfromECONNRESET:What remains is suggested fix #1, and only half of it. The message still carries no elapsed time, so "the deadline was reached" and "it failed immediately and retried until the deadline" still read alike. The port half is now moot.
That is a real but small improvement, and it is not the problem this issue describes. I would rather close this as fixed by #3327 than leave it open against a body that no longer matches the code — a reader arriving here would go looking for a reserve-then-release race that is not there. If the elapsed-time line is wanted, I am happy to open a narrow issue for it, or send it as a one-line PR without one.
I am the assignee; closing or narrowing is a maintainer's call, so I have not done either.
Astro-Han commentedon Sep 17, 2026
Fixed by #3327, which replaced the reserve-then-release scheme with
waitForDevToolsPort(scripts/verify-packaged-app.mjs:111). All three verification scripts now wait for the port Chromium announces instead of polling a pre-reserved number, so the port-mismatch case this issue could not distinguish can no longer occur.