Read into a lazily committed buffer in metadata-read-overflow #8554
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 285 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.338
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #8554"
general
weight: 0.35
hoodmane
metadata-read-overflowguards the fix in 66802b6f3.PyodideMetadataReader::read()used to narrow the destination buffer's size toint, so a buffer of 2 GiB or more gavememcpya negative length. The test got a buffer that large to the reader throughcompileModuleFromReadOnlyFS()with an inflatedusedBytes. That call allocates a buffer of that size, zero-fills it and hands it to the Wasm compiler, three times. On bazelflare's 8 GiB executors that peaks around 8.6 GB, and the0.28.2variant is already OOM-killed (Killedin the log of the "before" run).The test now reads through
FS.read()into views of aWebAssembly.Memory. Its pages become resident only when written, and the reader writes only the file's 11 bytes. The reader still receives buffers of 0x7FFFFFFF, 0x80000000 and 0x80000001 bytes. A resizableArrayBufferdoesn't work for this:jsg::asBytes()copies a view of one, so the reader would write into a 2 GiB heap copy. The test also asserts the byte count and the bytes read. The old test ignored every exception and only checked for a crash.With the buffers gone, the
no-tsantag is removed.Peak RSS (workerd
VmHWM, bazelflare executors)| variant | before | after | after, TSan |
hello(for comparison) |hello, TSan || --- | --- | --- | --- | --- | --- |
|
development| 8.62 GB | 0.27 GB | 0.83 GB | 0.27 GB | 0.82 GB ||
0.26.0a2| 4.47 GB | 0.30 GB | 1.01 GB | 0.32 GB | 1.05 GB ||
0.28.2| 8.29 GB (OOM-killed) | 0.27 GB | 0.88 GB | | ||
314.0.6| 8.62 GB | 0.29 GB | 0.82 GB | | |The test now costs the same as
hello. Under TSan, the ~1 GB for0.26.0a2is what any Pyodide test costs there.Testing
Everything below ran on bazelflare (
--config=bazelflare,--config=bazelflare-tsan):@gc-stressvariants, and the four under TSan.//src/workerd/server/tests/python:all: 132/132 pass.intnarrowing put back intoreadToTarget(), all four variants segfault inmemcpy, so the test still catches the bug.Peak RSS was measured with a
--run_underbash wrapper that pollsVmHWMof theworkerdprocesses. The executor image has nopython3or GNUtime.🤖 Generated with Claude Code