deps: V8: backport 786c1c2d88d4 #66249
All Vouch review confidence checks passed
Residual risk 0.20 = Change Risk (0.50) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 603 lines diff across 7 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.383
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #66249"
general
weight: 0.35
aduh95
Fixes: https://github.com/nodejs/node/issues/66074
This floats the upstream V8 fix 786c1c2d88 (CL 8426465, "[stack-traces] Fix overflow in Error.stackTraceLimit trimming"). I wrote that CL. As requested in the issue, this targets
mainfirst.The bug
The regression comes from #65764 (
deps: V8: backport ebd15783b7ba). When stack traces are captured for uncaught exceptions (--trace-uncaught, or an attached inspector),Isolate::CaptureAndSetErrorStacktrims the raw call-site data withstack_trace_limit CallSiteInfo::Fields::kCount. In our V8 14.6 treekCountis 6 and the arithmetic is signedint, so large limits overflow.Infinityis clamped toINT_MAX, andINT_MAX 6wraps to-6. That failsCHECK_GT(new_capacity, 0)inRightTrim:It reproduces on
v27.0.0-nightly202609233d85c94cfa(linux-x64). It does not reproduce onv27.0.0-nightly2026090729667e046b, which was built before #65764 landed.Measured with an Error about 59 frames deep under
--trace-uncaught, before the fix:|
Error.stackTraceLimit| Result ||---|---|
| 0 … 357913941 | correct |
| 357913942 … 715827882 | crash |
| 715827883 … 715827941 | silently loses frames (0 … 58 of 59) |
| 715827942 … 1073741823 | correct |
| 1073741824 … 1431655765 | crash |
| 1431655766 … 1431655824 | silently loses frames |
| 1431655825 … 1789569706 | correct |
| ≥ 1789569707, including
1e10andInfinity| crash |In general, a limit crashes when
int32(limit 6)is negative, and it silently truncates when the result falls in[0, raw length). The frame-loss windows are as wide as the captured stack. Without--trace-uncaught/ inspector, nothing goes wrong.The fix
Compare the limit against the number of frames (
ulength() / kCount) and multiply only after the limit is known to be smaller. The upstream commit didn't apply cleanly to 14.6 because V8 main'sulength()returns a wrapper (.value()), while 14.6 returns a plainuint32_t. The resolved hunk is identical to upstream except that.value()is dropped.v8_embedder_stringis bumped to-node.35.The CL's cctest (
CaptureStackTraceForUncaughtExceptionHugeStackTraceLimit) is included in the backport. WithkCount == 6, itsInfinitycase is the one that exercises the bug in this tree.Interaction with the V8 15.2 update (#65161)
main@{#110043}, during V8 15.6 development. The 15.2 through 15.5 branches were cut before it, and none of them has a merge-back. So #65161 (V8 15.2.124.34) does not contain the fix. Itsisolate.ccstill has the unfixed multiplication. There the symptom would change from a crash to silent frame loss, starting at 858993460.deps/v8in #65161. After 15.2 it can be a plaindeps: V8: cherry-pick 786c1c2d88d4, and it would be good to include that in #65161. If this PR lands first, the patch would be refloated on top of the 15.2 update, where it applies cleanly.v26.x-staging, which has the sameisolate.ccand embedder string-node.34.Testing
On linux-x64 with a local release build of this branch:
232,1e10andInfinity. Small limits still trim: 0 → 0 frames, 1 → 1, 10 → 10.make -j8 test-only:- C++ cctest: 264/264 passed.
- JS tests: 7382 passed, 1 failed.
-
make tooltest: 15/15 passed.parallel/test-fs-rmSync-special-char-additional-error(ENOENT … chmod '…/速_dir'). It is not related to this change: it fails the same way on the unpatched nightliesv27.0.0-nightly2026090729667e046bandv27.0.0-nightly202609233d85c94cfaon the same machine, which runs tests as root.make test-v8.CI
Please start both a regular Node.js CI run and a V8 CI* run (
node-test-commit-v8-linux). Only V8 CI builds and runs the added V8 cctest.AI assistance
Parts of this work were done with a closed-source coding agent, as disclosed by the
Assisted-bytrailer on the commit. I wrote the original V8 CL. I reviewed the full diff and the resolvedisolate.cchunk myself, and verified the reproduction, the boundary values and the test results on this machine./cc @silverwind (reporter) @richardlau (asked for the float) @nodejs/v8-update