Skip to content

deflake serve-body-leak: skip on ASAN where RSS-based leak detection is not meaningful#28301

Merged
alii merged 2 commits into
mainfrom
farm/3da66f99/deflake-serve-body-leak
Mar 20, 2026
Merged

deflake serve-body-leak: skip on ASAN where RSS-based leak detection is not meaningful#28301
alii merged 2 commits into
mainfrom
farm/3da66f99/deflake-serve-body-leak

Conversation

@robobun

@robobun robobun commented Mar 20, 2026

Copy link
Copy Markdown
Collaborator

The serve-body-leak test sends 10k warmup + 10k test requests per test case (7 cases = 140k requests) with 512KB payloads. Under ASAN this causes timeouts and crashes because:

  • ASAN adds 2-3x memory overhead, making RSS measurements meaningless for leak detection
  • ASAN significantly slows execution, causing test timeouts (40s/60s limits)
  • The subprocess gets OOM-killed under the added memory pressure

RSS-based memory leak detection is not meaningful under ASAN, which has its own built-in leak detection. Skip these tests on ASAN builds.

@robobun

robobun commented Mar 20, 2026

Copy link
Copy Markdown
Collaborator Author
Updated 11:24 PM PT - Mar 19th, 2026

@alii, your commit 02c24f6644d49d1965211b170466370032e49e88 passed in Build #40195! 🎉


🧪   To try this PR locally:

bunx bun-pr 28301

That installs a local version of the PR into your bun-28301 executable, so you can run:

bun-28301 --bun

@coderabbitai

coderabbitai Bot commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: e0b85c19-8697-478b-a43a-9979aa472e87

📥 Commits

Reviewing files that changed from the base of the PR and between 245f9ab and 02c24f6.

📒 Files selected for processing (1)
  • test/js/bun/http/serve-body-leak.test.ts

Walkthrough

Imported the ASAN environment flag into a memory-leak test and updated test registration to mark these cases as todo when ASAN is active; expanded the inline comment to state ASAN makes RSS-based memory-leak thresholds unreliable.

Changes

Cohort / File(s) Summary
Test ASAN Handling
test/js/bun/http/serve-body-leak.test.ts
Added isASAN to imported environment flags; updated test registration to include ASAN in the it.todoIf(...) conditions so memory-leak tests are marked todo under ASAN; extended inline comment noting ASAN invalidates RSS-based leak thresholds.
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: skipping the serve-body-leak test on ASAN builds where RSS-based leak detection is not meaningful.
Description check ✅ Passed The description provides comprehensive context explaining the problem (ASAN overhead, timeouts, memory pressure), the solution (skip tests on ASAN), and reasoning.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown
Contributor

Found 7 issues this PR may fix:

  1. Bun gets OOM-killed on trivial scripts #27371 - OOM-killed issues that ASAN builds experience due to memory overhead, exactly what this PR addresses
  2. Out of memory: total-vm:72GB RAM #27998 - Out-of-memory issues that could be related to ASAN's memory overhead making memory measurements meaningless
  3. jemalloc reserves ~485GB VSZ per process on aarch64 macOS (Apple Silicon, 16KB pages) #28138 - Virtual memory reservation issues that could be exacerbated by ASAN builds, affecting RSS-based leak detection
  4. Bun.serve -> request.header memory leak #9261 - Bun.serve memory leak that this PR's test is designed to catch in non-ASAN builds
  5. Likely memoryleak inside bun runtime on service http requests #14065 - HTTP request memory leak that serve-body-leak.test.ts would be designed to detect
  6. bun:test does not show a stack trace when a test times out #27486 - Test timeout issues that could be related to the timeout problems experienced in ASAN environments
  7. internal: running bun's test suite concurrently causes many unusual failures #8071 - Test reliability issues that could be compounded by ASAN builds, making conditional test skipping valuable

If this is helpful, consider adding 'Fixes #' to the PR description to auto-close the issue on merge.

🤖 Generated with Claude Code

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, straightforward test skip for ASAN where RSS-based leak detection is meaningless.

Extended reasoning...

Overview

This PR modifies a single test file (test/js/bun/http/serve-body-leak.test.ts) to skip RSS-based memory leak tests when running under ASAN builds. The change adds isASAN to the import from harness and appends || isASAN to the it.todoIf() condition.

Security risks

None. This is a test-only change that skips tests under a specific build configuration. No production code is modified.

Level of scrutiny

Minimal scrutiny needed. This is a standard test deflaking pattern — skipping tests whose methodology (RSS measurement) is incompatible with ASAN's memory overhead. The isASAN helper is already well-established in the test harness and used elsewhere in the codebase.

Other factors

The rationale is sound: ASAN adds 2-3x memory overhead making RSS thresholds meaningless, and ASAN already has its own built-in leak detection. The change is consistent with how other tests handle ASAN incompatibility in this repo.

@robobun

robobun commented Mar 20, 2026

Copy link
Copy Markdown
Collaborator Author

Deflake complete — test/js/bun/http/serve-body-leak.test.ts passed on all platforms at 245f9ab. Ready to merge.

@alii alii enabled auto-merge (squash) March 20, 2026 04:42
…, not LSan

Bun CI runs with detect_leaks=0 so LSan is disabled. The actual reason
to skip is that ASAN's 256MB quarantine + allocator metadata pushes RSS
past the 512MB threshold even without leaks, and the 2x slowdown risks
hitting the 40/60s timeout.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — straightforward test deflake adding isASAN to the existing skip condition.

Extended reasoning...

Overview

This PR modifies a single test file (test/js/bun/http/serve-body-leak.test.ts) to skip RSS-based memory leak tests on ASAN builds. The change adds isASAN to the import and appends || isASAN to the existing it.todoIf(...) condition. A clarifying comment is also added.

Security risks

None. This is a test-only change that conditionally skips tests under ASAN. No production code, no auth paths, no user-facing behavior is affected.

Level of scrutiny

Low scrutiny is appropriate. This is a small, mechanical test deflake that follows the exact same pattern already used in this file (e.g., isFlaky && isWindows for conditional skipping). The rationale is sound: ASAN inflates RSS via its quarantine and metadata, making the end_memory ≤ 512MB threshold meaningless, and ASAN has its own built-in leak detection anyway.

Other factors

  • CI passed on all platforms per the robobun comment.
  • No outstanding reviewer comments or unresolved discussions.
  • CodeRabbit found no actionable issues.
  • The bug hunting system found no bugs.
  • The change is consistent with how this repo handles ASAN-incompatible tests elsewhere.

@alii alii merged commit 9e93bfa into main Mar 20, 2026
64 checks passed
@alii alii deleted the farm/3da66f99/deflake-serve-body-leak branch March 20, 2026 06:24
alii added a commit that referenced this pull request Mar 20, 2026
structwafel pushed a commit to structwafel/bun that referenced this pull request Apr 25, 2026
…is not meaningful (oven-sh#28301)

The serve-body-leak test sends 10k warmup + 10k test requests per test
case (7 cases = 140k requests) with 512KB payloads. Under ASAN this
causes timeouts and crashes because:

- ASAN adds 2-3x memory overhead, making RSS measurements meaningless
for leak detection
- ASAN significantly slows execution, causing test timeouts (40s/60s
limits)
- The subprocess gets OOM-killed under the added memory pressure

RSS-based memory leak detection is not meaningful under ASAN, which has
its own built-in leak detection. Skip these tests on ASAN builds.
structwafel pushed a commit to structwafel/bun that referenced this pull request Apr 25, 2026
xhjkl pushed a commit to xhjkl/bun that referenced this pull request May 14, 2026
…is not meaningful (oven-sh#28301)

The serve-body-leak test sends 10k warmup + 10k test requests per test
case (7 cases = 140k requests) with 512KB payloads. Under ASAN this
causes timeouts and crashes because:

- ASAN adds 2-3x memory overhead, making RSS measurements meaningless
for leak detection
- ASAN significantly slows execution, causing test timeouts (40s/60s
limits)
- The subprocess gets OOM-killed under the added memory pressure

RSS-based memory leak detection is not meaningful under ASAN, which has
its own built-in leak detection. Skip these tests on ASAN builds.
xhjkl pushed a commit to xhjkl/bun that referenced this pull request May 14, 2026
robobun added a commit that referenced this pull request May 22, 2026
The debian-13-x64-asan-test-bun failure on the previous CI run hit
test/js/bun/http/serve-body-leak.test.ts, which is a well-documented
ASAN-flaky memory-leak test (see PR #28301 and test/no-validate-leaksan.txt:274).
This PR only touches src/install/lockfile/ and test/cli/install/ —
nothing in the HTTP/Bun.serve path. Re-rolling once.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants