Repository navigation
Conversation
The existing test could not detect its target leak: with every module retained, release RSS landed at ~2738 MB vs ~2672 MB no-leak, both under the 3000 MB threshold. Without periodic GC the allocator high-water mark dominates and retained vs freed pages are indistinguishable. Force a full GC after every batch so no-leak RSS stays bounded (~120 MB release), cut iterations 50k -> 8k (2k -> 400 debug), add an exact NodeVMSourceTextModule object-count assertion that also holds under ASAN quarantine, and assert the last module actually evaluated.
|
Warning Review limit reached
Next review available in: 15 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
Comment |
|
Updated 8:20 AM PT - Jul 26th, 2026
❌ @robobun, your commit 3a59933 has 1 failures in
Add 🧪 To try this PR locally: bunx bun-pr 35917That installs a local version of the PR into your bun-35917 --bun |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
LGTM — test-only change that turns a vacuous leak test into one that actually fails on regression, and cuts runtime ~5×.
What was reviewed:
expectMaxObjectTypeCountsignature/semantics intest/harness.tsand thatNodeVMSourceTextModuleis a real IsoSubspace-backed type name that appears inheapStats().objectTypeCounts.lastis cleared before the final GC/object-count check so the retained reference doesn't self-fail the assertion;Buffer.alloc(10, 'hello').toString()does yield"hellohello".- RSS threshold branches on
isASANand the object-count check is the authoritative signal, per the repo's leak-test guidance; timeouts (15s/30s) remain well above the measured 2s/3s runtimes.
Extended reasoning...
Overview
Single-file, test-only change to test/js/node/vm/sourcetextmodule-leak.test.ts. The rewrite adds per-batch Bun.gc(true), drops iteration counts (50k→8k release, 2k→400 debug), tightens the RSS threshold (3000/3500 MB → 256/600 MB), adds an exact NodeVMSourceTextModule object-count assertion via the existing expectMaxObjectTypeCount harness helper, and asserts last.status/last.namespace.result so the loop is proven to have linked+evaluated rather than just allocated.
Security risks
None. No production code, no external I/O, no new dependencies. Pure in-process test logic.
Level of scrutiny
Low-to-medium. This is a leak regression test being tightened, not loosened — the PR description empirically shows the old thresholds were vacuous (a forced leak still passed at 2738 MB < 3000 MB) and the new test fails on the same forced leak. The change follows the repo's stated leak-test conventions exactly: Bun.gc(true) + heapStats objectTypeCounts as the authoritative signal, RSS threshold branched on isASAN, bound well below what the unfixed leak produces. The object-count check is the pattern already used in sourcetextmodule-link-gc.test.ts and vm-script-fetcher-leak.test.ts for the same class.
Other factors
I verified expectMaxObjectTypeCount in test/harness.ts:297 polls with GC and uses toBeLessThanOrEqual, so baseline + 20 is a ceiling, and confirmed NodeVMSourceTextModule has its own IsoSubspace (DOMIsoSubspaces.h) so it shows up under that exact key in objectTypeCounts. The last = undefined before the final GC releases the one intentionally-held reference so it can't trip the ≤20 check. Buffer.alloc(10, 'hello').toString() → "hellohello" matches the assertion. Reduced timeouts (30s→15s release, 60s→30s debug) still leave ~7–10× headroom over the measured runtimes. No prior human reviews or outstanding comments on the thread.
|
This PR may be a duplicate of:
🤖 Generated with Claude Code |
|
CI (build #82350, complete): the test passes on every test lane, including debian-13-x64-asan (the 23 s lane this targets) and all three darwin lanes. The only hard failure is Ready for review. |
|
Closing: superseded by #41606, which carries the same design on top of the harness rss() helper the file now uses. |
What does this PR do?
test/js/node/vm/sourcetextmodule-leak.test.tstakes ~23 s on the linux x64-asan lane and ~8 s everywhere else, and in its current form cannot detect the leak it was written for.The existing test never fails on a leak. With every one of the 50 000 modules artificially retained, release RSS lands at ~2738 MB versus ~2672 MB with nothing retained; both sit under the 3000 MB threshold. The loop never GCs, so the allocator's high-water mark dominates and retained vs freed pages end up in the same resident set. The debug/ASAN branch is the same story (130 MB retained vs 76 MB freed, threshold 1500 MB).
This change:
NodeVMSourceTextModuleobject-count assertion viaexpectMaxObjectTypeCount, which is immune to ASAN's ~256 MB quarantine that otherwise masks RSS deltas on sanitized lanes,statusand an exportednamespace.resultso the loop is verified to have linked and evaluated, not just allocated,How did you verify your code works?
Timed locally, five runs each:
bun bd)Leak-sensitivity check: a copy of each variant with
leaked.push(mod)injected into the loop.447.62MB ≥ 256 MB)NodeVMSourceTextModule> 20)#33704 also reduces this file's release iteration count (50k → 20k) as part of a broader sweep; this change supersedes that hunk with a redesign that fixes the detection gap as well as the runtime.
[stamp-90s] gate passed · iteration 0 · 1 files touched
passes on PR (with fix)
diff hotspot
gate history · 1 passed · 0 rejected · iteration 0
evidence per changed file
self-review · no surviving concerns
32 concerns were raised and did not survive verification.