Skip to content

Doing a large amount of fetch requests results in a memory leak #20912

Open

Description

@tiagozip

How can we reproduce the crash?

Doing a very large amount of fetch requests results in a memory leak. Noticed this while working on my web crawler — after ~3 minutes of running (~9.5k requests), bun crashes due to a memory leak. This has also happened in previous versions and other projects that use a lot of fetch requests.

I'm guessing Bun is storing the full response body in memory, even though it should be collected by the garbage collector. No, it's not a memory leak in my code.

Relevant log output

Bun v1.2.18 (0d4089ea) macOS Silicon
macOS v26.0
CPU: fp aes crc32 atomics
Args: "bun" "."
Features: fetch(9497) jsc transpiler_cache(64) workers_spawned(64) 
Builtins: "bun:main" "bun:sqlite" 
Elapsed: 189710ms | User: 223359ms | Sys: 142958ms
RSS: 2.46GB | Peak: 2.46GB | Commit: 0.02ZB | Faults: 121

panic: Segmentation fault at address 0x7FE037DFA4FD3E8
oh no: Bun has crashed. This indicates a bug in Bun, not your code.

To send a redacted crash report to Bun's team,
please file a GitHub issue using the link below:

 https://bun.report/1.2.18/Ma10d4089eiBggkQ_uqq8fuqq8fmvs8f+3xvR2o5gO__A263h4/Hxh2g2F

zsh: trace trap  bun .

Stack Trace (bun.report)

Bun v1.2.18 (0d4089e) on macos aarch64 [RunCommand]

Segmentation fault at address 0x7FE0546D803F9E8

  • 1 unknown/js code
  • us_internal_update_handshake
  • us_internal_update_handshake
  • us_internal_ssl_socket_close
  • http.HTTPThread.processEvents
  • Thread.PosixThreadImpl.spawn__anon_811268.Instance.entryFn

Features: transpiler_cache, workers_spawned, Bun.stdout, fetch, jsc

Activity

  1. fitzn commented on Dec 9, 2025

    @fitzn

    @tiagozip We have been dealing with various memory issues in our Bun server. I have been going through Bun memory issues to pattern match for our setup. We run tons of fetch requests in our server (to S3, LLM APIs, etc.). I am just curious: does this issue still repro for you on the latest Bun? It was reported 5 months ago, I figure there's a chance it's been resolved. Thanks!

  2. jotka commented on Feb 21, 2026

    @jotka

    @fitzn issue is still present in 1.3.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions