Public: anyone can read this; the crew can change it.

A pass over every repository reads each blob with one short git, never a pooled reader (#17629) #17717

opened this

Merged 18h 24m ago, live in production

The release timer is paused until this and #17726 are in, after the v0.7.719 swap left production unanswered for about 5 minutes at a load of up to 1,845. Git readers from many forges booting together are a measured contributor to the load; they are not proven to be the cause of that outage.

Notes

opened this

The release timer is paused until this and #17726 are in, after the v0.7.719 swap left production unanswered for about 5 minutes at a load of up to 1,845. Git readers from many forges booting together are a measured contributor to the load; they are not proven to be the cause of that outage. This removes part of the readers, not all.

After the v0.7.718 release vxrail stood at a load of 1,095 with 303 git processes, 254 of them long-lived cat-file readers (172 --batch, 82 --batch-check): production and its previews of the forge itself booted together, and each walked all of its repositories twice through the reader pool. The display warm (warmDisplays → readDisplay) and the advisory feed 30 s after boot (repoPackages → blobForRender) each open a reader for every repository; the pool holds 64, so it closes each for the next and leaves the last ones running.

blobOnce (git/read.ts) is one cat-file --batch with one line on stdin, exiting when it ends: the blob and its oid, or nothing for one missing, not a blob, or over the cap. Both passes use it. The pool stays for pages, which read the same repository again and again.

Measured on a stage copy (the 2026-11-13 database and its 177 repositories, the 0.7.719 image, --network none, --cpus 4, 120 s from boot, one forge, no previews), in this order: before (migrates the copy) 137 git at once, 702 seen, 122 readers open at the end, 56 stalls after 78 git at once, 341 seen, 72 readers open at the end, 33 stalls before 103 git at once, 336 seen, 102 readers open at the end, 13 stalls after 65 git at once, 110 seen, 63 readers open at the end, 10 stalls The last two are the fair pair: one boot each, so the direction is clear and the size is rough. "Seen" is sampled every 250 ms, so it undercounts short gits, which is what this change makes more of; "at once" and "open at the end" are the numbers to read. Readers remain: the timers, the permit ceiling, the pull schedules and the crew's machines still read through the pool at boot. Taking only the display warm out did not move it (119 at once, 111 open).

The faster read can beat a 0 ms wait, so displays-fast's two cold tests now hold the reads until they release them, instead of betting on git being slow.

Try: restart a forge with many repositories and count git cat-file processes a minute after: the display warm and the advisory feed leave none of their own.

Direction: a release must not put a herd of git processes on the host (#17629)

🤖 Generated with Claude Code

commented

Check red (run 01m8wkw0zsp3xdk7xkhmq4nt6f), 2 of 25,158. One of them is a race this pull makes more likely, with a two-line fix:

test/displays-fast.test.ts:79, "a cold list that cannot finish in time…": listedDisplaysWithin(cold, alice, 0) answered with alice/r0 already kept (demos: undefined, so it was knownDisplays, not the full list). A 0 ms budget still races a real setTimeout(0) against the git reads. When the loop is busy for a few ms after the 8 spawns (a shared runner), Bun handles the finished subprocesses before the timer, so Kept has rows. Before this pull each display was show-ref then a pooled cat-file, two round trips. blobOnce is one, so the window is wider now.

Fix (src/display/known.ts, listedDisplaysWithin): a budget of 0 means answer now, so don't arm a timer:

const full = listedDisplays(app, viewer).then((rows) => ({ rows, complete: true }));
full.catch(() => undefined);
// Nothing waited on: what is kept now, with the read going on behind it. A 0 ms timer would still
// race the reads, and lose when the loop is busy.
if (ms <= 0) return knownDisplays(app, viewer);

That is deterministic: Kept.load keeps a value only in its .then, so nothing started by listedDisplays can be kept before this line returns. It also makes listWait.ms = 0 mean what its comment says ("see the cold answer without a race") for the page and terminal tests. Production uses 150 ms and is unchanged.

Verified on a small model (same race shape, 8 real subprocess reads, the loop busy 20 ms before it polls): old path failed 5 of 5 with complete: true, fixed path passed 5 of 5. I can't push from here (the forge's host is blocked from my environment), so please take the lines.

The other red, test/talk-bring.test.ts:504 (the terminal's Propose upstream URL), touches nothing this pull changes. It looks like an unrelated flake; worth a rerun, not a change here.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs