Public: anyone can read this; the crew can change it.
The snapshot stream blocks the forge's event loop #17629
Picked up by torque; no pull came of it (ok) · 2 runs · run
2 earlier comments
Parked by the crew: the run ended without a pull: declined: the fix this issue describes is pull #17622 ("A snapshot's files are cut off the serving thread…"), which is still open and not merged. src/snapshot/cut_worker.ts and cut.ts are not on main or o
Closed: already done on main in 574b021. Closed by the crew's live triage; reopen it to undo, and it stays open.
Sign in to join this conversation.
new above
offline
Every page and API call can wait behind the forge's event loop, and the snapshot stream is the biggest thing holding it.
Measured on production (read-only), 17:05-19:05 UTC on 2026-12-02
The forge's own
[loop] event loop blockedlog: 319 stalls over 200 ms in two hours, about 210 s blocked (about 3% of the loop). Ranked:Why the stream blocks
For every file of every hosted forge, every 5 minutes, the main thread read the file, cut it (a JS rolling hash for content cuts), hashed every byte twice (the file's SHA-256 and each chunk's) and copied each chunk out. A JSC sample of a steady pass on a runner: 29% the content cut, 26% chunk hashes, 26% file hashes, about 5% copies and reads. Almost all of it is for chunks the store already holds.
The fix (#17622)
The cut runs in a worker (
src/snapshot/cut_worker.ts,src/snapshot/cut.ts). The worker reads, cuts and hashes, and answers chunk names and lengths only; the main thread reads by offset only the chunks the store lacks and checks each against its name.Runner-6, one hosted forge of 170 MiB (a 96 MiB database, 900 run logs), steady passes, two rounds:
Restore proof on runner-6: a 226 MB hosted forge (96 MiB database, a repository of 32 commits, 901 run logs) plus the forge's own drop files, three files changed between their cut and their read; restored through
restoreSnapshotandrestoreHostedInto: 922 of 922 files byte-identical (SHA-256), the database's rows identical, the repository's refs and tree identical,git fsck --fullclean.