Skip to content

ci-fix: publish-site failing — Chrome ERR_NETWORK_CHANGED while the local page container starts #981

Closed

Description

@leaf-agent

publish-site's local Chrome verification has now failed twice in two days in the same way. Chrome aborted a page's module loads with net::ERR_NETWORK_CHANGED, and in both runs the abort came while the local wrangler dev was starting that page's own reader container. The page's timing matches a Chrome socket flush triggered when Docker changes the host's network interfaces. That makes this a race in how scripts/verify-site-local.sh arranges the browser and the container on one host, not a random runner blip. I haven't opened a fix because I can't reproduce it in the bot sandbox, which has no Docker, and each available mitigation needs a maintainer's call (see below).

The two failures

Run Commit Page that never presented Browser errors
35827698414 4b29892 /examples/triage-board/ 3× ERR_NETWORK_CHANGED, 1× 404 (/favicon.ico)
35779729696 (#953) 50a9fed /how-it-works/ (neighbor page) 3× ERR_NETWORK_CHANGED

Both raise from await_presentation in scripts/verify_site.py, and the page's own startup report says outcome: 'timeout', reason: 'entry module did not load'. In both, the Worker log shows every asset answered 200, so the aborts happened only on the browser side.

Why this looks durable rather than transient

The Worker log puts every failing load inside that page's container prewarm:

  • Today: container_prewarm_started for /examples/triage-board, then the page GET and all its runtime bundles, then container_prewarm_completed (1808 ms). The startup report then says timeout. The root page / loaded before it and presented at 875 ms, before its own prewarm finished (1888 ms).
  • ci-fix: transient failure on 35779729696 #953: / and /examples/triage-board each presented. Then container_prewarm_started for /how-it-works, the page GET, container_prewarm_completed, and the page timed out.

Chromium answers an OS IP-address-change notification by flushing its socket pools with ERR_NETWORK_CHANGED for every destination, including 127.0.0.1 (#953 cites TransportClientSocketPool::OnIPAddressChanged). Starting a container under Docker's default bridge networking adds a host-side veth interface. That the veth is what triggers Chrome's notification here is my inference from the timing; I haven't observed it directly. Most runs pass because the flush has to land while module requests are in flight. Once a page's modules have loaded, the flush no longer matters.

None of this applies in production: the deployed site's containers run on Cloudflare, not on the reader's machine. Only the local verifier puts Chrome and Docker on one host.

Why no automated fix

Each option changes a deployment gate or its arrangement, and I couldn't validate any of them here:

  • Start the container before loading the page it serves. If the verifier started each reader's container before navigating (or waited for the prewarm to finish before measuring), the interface change would come before the module loads. This keeps the gate failing closed, but it moves container start out of the startup profile the verifier reports.
  • Isolate Chrome from host interface changes, for example by running the browser in its own network namespace. This removes the race without changing what is measured, but it needs privileges and setup the workflow doesn't have today.
  • Retry the navigation on ERR_NETWORK_CHANGED only. This is narrow, but it is the retry around a gate that ci-fix: transient failure on 35779729696 #953 argued against, because it would also hide a page that really stopped presenting.

After #953 the next publish-site run passed and deployed, so a hit doesn't leave main stuck. It still blocks that commit's deploy until the next run.

Also seen in both logs: repeated registry.json fetches

During the failing page load, the Worker log records about 30 network GETs of that page's revisions/<r>/registry.json, while leaf.js and each runtime bundle were fetched once. #953 noted the same thing. The verifier dumps the Worker log only on failure, so no green run gives a baseline. It isn't clear whether this is normal for a page whose entry module failed or a separate defect.

Activity

  1. leaf-agent commented on Sep 23, 2026

    @leaf-agent
    CollaboratorAuthor

    Triage: the overlap is how the Worker is built, not a coincidence of timing. Leaving this open without a fix, since the options below change what the deploy gate measures and I can't run Docker here to test any of them.

    The Worker starts a page's container from that page's own document response. When AGENT_PREWARM is "true", a GET with Sec-Fetch-Dest: document passes prewarmContainer to ctx.waitUntil (worker/src/index.ts#L907-L921). The local wrangler dev in scripts/verify-site-local.sh runs without --env, so it reads the top-level AGENT_PREWARM = "true" from worker/wrangler.toml. So each page the verifier opens for the first time starts a local container while that page is fetching its modules. Both logs show exactly that: container_prewarm_started right before the page GET, and container_prewarm_completed after its bundles. The veth link to Chrome's socket flush is still an inference, but the overlap is deterministic, so every newly opened page is exposed to the race, not only an unlucky one.

    That points the first option at a specific place. The verifier could start the container for a page's reader identity before it measures that page. One way is a document-typed request in the same browser context, which then waits for the container to be running. This keeps the gate failing closed and leaves the production prewarm path as it is. The other way is to turn off AGENT_PREWARM for the local verifier. That just moves the container start to the first API request, which may still overlap a later page's module loads, and the verifier would then stop exercising prewarm. Which of the two is right depends on whether prewarm latency should stay inside the startup profile the verifier reports. That's the open decision.

  2. leaf-agent commented on Sep 23, 2026

    @leaf-agent
    CollaboratorAuthor

    A third occurrence, and the first outside publish-site: run 35835735946 on #996, in ci's test job. The step is Measure the bundled release in Chrome, which runs the same scripts/verify-site-local.sh, and the failure is the shape this issue describes, on the same page as the first row above:

    RuntimeError: http://127.0.0.1:8787/examples/triage-board/ never presented, reaching no
    startup milestone; browser errors: ['Failed to load resource: net::ERR_NETWORK_CHANGED',
    'Failed to load resource: net::ERR_NETWORK_CHANGED', 'Failed to load resource: the server
    responded with a status of 404 (Not Found)']
    

    Every other step in that job passed, including the everyday pytest gate, the browser framework check, the runtime folds, and the Worker tests. #996 changes one nightly test file and nothing this step reads.

    The scope note matters for the mitigation choice: this is a pull_request gate as well as a deploy gate, so a hit costs a contributor a red test on a PR that has nothing to do with the site, not only a blocked deploy. Three hits in three days across two workflows.

  3. added a commit that references this issue on Sep 23, 2026
    50e7974
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions