Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions test/js/bun/http/serve-body-leak.test.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -153,6 +153,10 @@ async function calculateMemoryLeak(fn: (url: URL) => Promise<void>, 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: 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],
Expand All @@ -163,7 +167,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();
Expand Down
Loading