Repository navigation
Run the local site verification with container prewarm off - #1027
Merged
Merged
Conversation
Chrome and Docker share one host only in this pass. Starting a reader's container adds a host interface, Chromium flushes its sockets on that change with ERR_NETWORK_CHANGED, and prewarm puts the start inside the module loads the pass measures. Without it the only container start is the activation read the verifier waits on.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
scripts/verify-site-local.shnow starts the local Worker withAGENT_PREWARMset tofalse, so nothing starts a reader's container while the browser is fetching the modules of the page the pass is measuring. That overlap is what has been reddening this gate: four runs in two days have stopped on a page that never presented, withnet::ERR_NETWORK_CHANGEDon its module loads — three inpublish-siteand one inci'stest, most recently run 35899003033 onmain. Fixes #981.Why a container start breaks the load beside it
Chromium answers a host IP-address change by flushing its socket pools, handing every request in flight
ERR_NETWORK_CHANGED, loopback included. Starting a container under Docker's bridge networking adds a host interface, which is that change. I found no way to opt out: the shipped Chrome binary carries no network-change command-line switch, onlyNetworkChangeNotifierLinuxitself. And only this pass puts the two on one host — a reader's container runs on Cloudflare, so no production page load starts one on the machine drawing the page.The Worker starts that container from the document response itself. With
AGENT_PREWARMtrue, aGETcarryingSec-Fetch-Dest: documenthandsprewarmContainertoctx.waitUntil(worker/src/index.ts#L907-L922), so every page the verifier opened for the first time was measured while Docker wired up that page's container. Both logs in #981 and the run above show it:container_prewarm_startedfor the page, its document and bundle GETs, and a startup report ofoutcome: 'timeout', reason: 'entry module did not load'while the Worker answered every asset200.With prewarm off, the only thing that starts a container locally is the activation read (
api/view) thatverify_site.pymakes and waits on for each page in turn. That request is not a browser load and nothing is loading beside it, so the host's interfaces are settled for every load the browser is measured on.What the gate gives up
Nothing it asserted. Prewarm is deliberately outside the reader's startup path —
ctx.waitUntil, after theServer-Timingheader is stamped — so it never appeared in the startup profile this pass reports, and no check read it. A prewarm failure is caught and logged rather than surfaced, so none could have failed the gate either.worker/test/index.test.tsstill covers the dispatch, the rate-limit denial and the non-navigation probe;worker/wrangler.tomlstill declares"true", so production and the dev environment are untouched andpublish-site's post-deploy pass over the public release exercises prewarm against real Cloudflare containers.worker/README.mdalready documentsfalseas a supported setting for comparing cold startup without changing the request path. The cost is that the activation read now absorbs the cold start it used to find done — a second or two inside a 45-minute job.Verification, and what is left
The gate ran on this branch and passed:
test'sMeasure the bundled release in Chromestep verified all three pages and the/how-it-works/neighbour, and the requests and bytes at presentation are identical to the failed run's —/reports 15 JS / 300 KiB, 17 code / 463 KiB, 25 total / 628 KiB on both — which is the comparisonAGENTS.mdasks for on a change that can alter startup. The elapsed figures move with the runner, as that rule says. One green run would not on its own separate the fix from luck, since the flush has to land inside a module load to matter; what the change rests on is that the start it needs no longer happens while a measured load is in flight.The race itself is not reproducible from the bot sandbox, which has no usable Docker. What I could check directly is the override:
wrangler dev --var AGENT_PREWARM:false, under the pinned wrangler 4.131.1, beats the"true"inwrangler.tomland the Worker reads"false"— run against a throwaway Worker that returnsenv.AGENT_PREWARM, and confirmed against that wrangler's own--varparsing, which splits on the first:.shellcheckand the rest of pre-commit pass on the script.One exposure this does not remove. Docker drops a host interface when a container stops, which triggers the same flush, and a page load overlapping a teardown would fail the same way. Every occurrence so far is a start overlapping a load, and removing the start is what can be done from inside the workflow; isolating Chrome in its own network namespace would cover both directions but needs privileges the job does not have.
The failing page's 30
registry.jsonfetches, which #981 left open as possibly a separate defectThey are the failed page's own recovery loop, not a defect of a healthy load. In the same Worker log, the two pages that presented fetched their revision's
registry.jsononce each (rootandexamples--triage-board);how-it-works, the page that timed out, fetched it 30 times.bootstrap.jspolls the probe — which is thatregistry.json— once a second while the page has not presented, looking for a release or layer that could start it (bootstrap.js#L163-L206). The verifier waits 30 s for presentation, so the count is the wait. It also confirms the page never started rather than presenting late.