Skip to content

Fix/zlib mem node#89099

Merged
bgw merged 4 commits intovercel:canaryfrom
naaa760:fix/zlib-mem-node
Jan 30, 2026
Merged

Fix/zlib mem node#89099
bgw merged 4 commits intovercel:canaryfrom
naaa760:fix/zlib-mem-node

Conversation

@naaa760
Copy link
Contributor

@naaa760 naaa760 commented Jan 27, 2026

  • What?
    Fixes zlib memory leak in Node.js 24 when requests are aborted.

  • Why?
    Compression streams weren't cleaned up on abort, causing memory to accumulate.

  • How?
    Destroy the response on request abort/close to clean up compression streams.

Closes NEXT-
fixes: #89091

@nextjs-bot
Copy link
Collaborator

nextjs-bot commented Jan 27, 2026

Allow CI Workflow Run

  • approve CI run for commit: 893265d

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

@nextjs-bot
Copy link
Collaborator

nextjs-bot commented Jan 28, 2026

Tests Passed

@vercel vercel deleted a comment from nextjs-bot Jan 29, 2026
@bgw
Copy link
Member

bgw commented Jan 29, 2026

@naaa760 I tried re-running the tests a few times in CI (a lot of them are just flaky), but I think this change might be breaking something. A lot of the tests are failing with errors like:

FetchError: request to http://localhost:35445/api/test failed, reason: socket hang up

@naaa760
Copy link
Contributor Author

naaa760 commented Jan 30, 2026

@bgw
sir the failures were from listening to req.close (it runs when the request body is read) and i have switched to only req.aborted, so we only clean up on client abort.
That should fix the socket hang up and keep the zlib leak fix.
please let me know!

@bgw bgw merged commit abfd994 into vercel:canary Jan 30, 2026
191 of 203 checks passed
bgw added a commit that referenced this pull request Jan 30, 2026
@bgw bgw mentioned this pull request Jan 30, 2026
@bgw
Copy link
Member

bgw commented Jan 30, 2026

Apparently this did not fix the reported issue: #89091 (comment)

Reverting in #89322

bgw added a commit that referenced this pull request Jan 31, 2026
Reverts #89099

Apparently this did not solve the user's memory leak issue:
#89091 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

zlib memory leak Node.js 24

3 participants