Skip to content

Release verifier: a CDP smoke timeout cannot be diagnosed from its own message #3196

Closed

Description

@Joob1n

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 !== null reports exited before its renderer was ready instead, 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:

  1. Include the polled port and the elapsed time in the timeout message. One line, and it makes this class of failure classifiable on sight.
  2. 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

  1. Joob1n commented on Aug 18, 2026

    @Joob1n
    MemberAuthor

    I hit this one while working on #3148 and plan to implement it — starting with the message change, then the DevToolsActivePort read so the reserve-then-release window stops mattering.

  2. added
    bug
    help wanted
    good first issue
    on Aug 20, 2026
  3. Joob1n commented on Aug 24, 2026

    @Joob1n
    MemberAuthor

    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:

    /**
     * The authoritative CDP port: Chromium announces it on stderr once the
     * DevTools socket is actually bound. Callers spawn with
     * `--remote-debugging-port=0` and wait for this instead of pre-reserving a
     * port — reserve-then-release had a race window in which another process
     * could take the port, leaving Electron listening elsewhere while the
     * verifier polled the stale number for its full deadline ("did not expose
     * CDP ... fetch failed", observed repeatedly on busy CI runners).
     */
    export function waitForDevToolsPort(child, { timeoutMs = 30_000 } = {})

    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 DevToolsActivePort from 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 ECONNREFUSED from ETIMEDOUT from ECONNRESET:

    throw new Error(
      `Packaged Maka renderer did not expose CDP within ${Math.round(timeoutMs / 1000)} seconds${
        described.length ? `: ${described.join(' <- ')}` : ''
      }.`,
    );

    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.

  4. removed
    help wanted
    good first issue
    on Aug 29, 2026
  5. added theissue type on Aug 29, 2026
  6. Astro-Han commented on Sep 17, 2026

    @Astro-Han
    Contributor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions