Skip to content

Memory leak if accessing body of fetch() response before consuming the stream #13678

Closed

Description

@mshameti

What version of Bun is running?

1.1.26+0a37423ba

What platform is your computer?

Linux 6.6.16-linuxkit aarch64

What steps can reproduce the bug?

Access 'body' of fetch() response before consuming the stream causes memory leak.

Code snippet: https://github.com/mshameti/bun-memory-accumulation-formdata-fetch-docker/blob/main/sender/script.js#L48-L72

The focus of this issue is LEAK 2.

NOTE: This is the same repo used to report #13657, but LEAK 2 is a different but closely related to LEAK 1.

git clone https://github.com/mshameti/bun-memory-accumulation-formdata-fetch-docker
cd bun-memory-accumulation-formdata-fetch-docker
LEAK=2 docker-compose up --build

What is the expected behavior?

No memory leak.

What do you see instead?

Memory accumulation until container crashes.

Additional information

No response

Activity

  1. changed the title [-]Memory leak if accessing body of fetch() response before consuming the stream response[/-] [+]Memory leak if accessing body of fetch() response before consuming the stream[/+] on Sep 2, 2024
  2. added a commit that references this issue on Sep 2, 2024
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