From 245f9ab3f582906af69fabe2e4a942daeeb12f63 Mon Sep 17 00:00:00 2001 From: robobun Date: Fri, 20 Mar 2026 03:16:57 +0000 Subject: [PATCH 1/2] deflake serve-body-leak: skip on ASAN where RSS-based leak detection is not meaningful --- test/js/bun/http/serve-body-leak.test.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/js/bun/http/serve-body-leak.test.ts b/test/js/bun/http/serve-body-leak.test.ts index b10078fa082..e4b8d398c59 100644 --- a/test/js/bun/http/serve-body-leak.test.ts +++ b/test/js/bun/http/serve-body-leak.test.ts @@ -1,5 +1,5 @@ import { expect, it } from "bun:test"; -import { bunEnv, bunExe, isCI, isDebug, isFlaky, isLinux, isWindows } from "harness"; +import { bunEnv, bunExe, isASAN, isCI, isDebug, isFlaky, isLinux, isWindows } from "harness"; import { join } from "path"; const payload = Buffer.alloc(512 * 1024, "1").toString("utf-8"); // decent size payload to test memory leak @@ -153,6 +153,9 @@ async function calculateMemoryLeak(fn: (url: URL) => Promise, url: URL) { // Since the payload size is 512 KB // If it was leaking the body, the memory usage would be at least 512 KB * 10_000 = 5 GB // If it ends up around 280 MB, it's probably not leaking the body. +// +// Skip on ASAN: RSS-based memory leak detection is not meaningful under ASAN, +// which adds massive memory overhead and has its own leak detection. for (const test_info of [ ["#10265 should not leak memory when ignoring the body", callIgnore, false, 64], ["should not leak memory when buffering the body", callBuffering, false, 64], @@ -163,7 +166,7 @@ for (const test_info of [ ["should not leak memory when streaming the body and echoing it back", callStreamingEcho, false, 64], ] as const) { const [testName, fn, skip, maxMemoryGrowth] = test_info; - it.todoIf(skip || (isFlaky && isWindows))( + it.todoIf(skip || (isFlaky && isWindows) || isASAN)( testName, async () => { const { url, process } = await getURL(); From 02c24f6644d49d1965211b170466370032e49e88 Mon Sep 17 00:00:00 2001 From: Alistair Smith Date: Fri, 20 Mar 2026 04:46:12 +0000 Subject: [PATCH 2/2] =?UTF-8?q?clarify=20ASAN=20skip=20comment=20=E2=80=94?= =?UTF-8?q?=20quarantine=20+=20metadata=20break=20RSS=20threshold,=20not?= =?UTF-8?q?=20LSan?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- test/js/bun/http/serve-body-leak.test.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/js/bun/http/serve-body-leak.test.ts b/test/js/bun/http/serve-body-leak.test.ts index e4b8d398c59..7f94b2ccd2b 100644 --- a/test/js/bun/http/serve-body-leak.test.ts +++ b/test/js/bun/http/serve-body-leak.test.ts @@ -154,8 +154,9 @@ async function calculateMemoryLeak(fn: (url: URL) => Promise, url: URL) { // If it was leaking the body, the memory usage would be at least 512 KB * 10_000 = 5 GB // If it ends up around 280 MB, it's probably not leaking the body. // -// Skip on ASAN: RSS-based memory leak detection is not meaningful under ASAN, -// which adds massive memory overhead and has its own leak detection. +// Skip on ASAN: its quarantine (default 256MB) and allocator metadata inflate +// RSS enough to break the `end_memory ≤ 512MB` threshold even without leaks, +// and the 2x slowdown can hit the 40/60s timeout with 20k requests per case. for (const test_info of [ ["#10265 should not leak memory when ignoring the body", callIgnore, false, 64], ["should not leak memory when buffering the body", callBuffering, false, 64],