-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Significant memory usage increase starting from 20.10.0 for a simple HTTP server (potentially stream related) #52228
Comments
RedYetiDev
added
http
Issues or PRs related to the http subsystem.
stream
Issues and PRs related to the stream subsystem.
memory
Issues and PRs related to the memory management or memory footprint.
labels
Apr 20, 2024
orgads
added a commit
to orgads/node
that referenced
this issue
May 28, 2024
Amends 35ec931 (stream: writable state bitmap). Fixes nodejs#52228.
orgads
added a commit
to orgads/node
that referenced
this issue
May 29, 2024
Setting writecb and afterWriteTickInfo to null did not clear the value in the state object. Amends 35ec931 (stream: writable state bitmap). Fixes nodejs#52228.
orgads
added a commit
to orgads/node
that referenced
this issue
May 29, 2024
Setting writecb and afterWriteTickInfo to null did not clear the value in the state object. Amends 35ec931 (stream: writable state bitmap). Fixes nodejs#52228.
orgads
added a commit
to orgads/node
that referenced
this issue
May 29, 2024
Setting writecb and afterWriteTickInfo to null did not clear the value in the state object. Amends 35ec931 (stream: writable state bitmap). Fixes nodejs#52228.
orgads
added a commit
to orgads/node
that referenced
this issue
May 30, 2024
Setting writecb and afterWriteTickInfo to null did not clear the value in the state object. Amends 35ec931 (stream: writable state bitmap). Fixes nodejs#52228.
targos
pushed a commit
that referenced
this issue
Jun 3, 2024
Setting writecb and afterWriteTickInfo to null did not clear the value in the state object. Amends 35ec931 (stream: writable state bitmap). Fixes #52228. PR-URL: #53188 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
eliphazbouye
pushed a commit
to eliphazbouye/node
that referenced
this issue
Jun 20, 2024
Setting writecb and afterWriteTickInfo to null did not clear the value in the state object. Amends 35ec931 (stream: writable state bitmap). Fixes nodejs#52228. PR-URL: nodejs#53188 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
bmeck
pushed a commit
to bmeck/node
that referenced
this issue
Jun 22, 2024
Setting writecb and afterWriteTickInfo to null did not clear the value in the state object. Amends 35ec931 (stream: writable state bitmap). Fixes nodejs#52228. PR-URL: nodejs#53188 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
marco-ippolito
pushed a commit
that referenced
this issue
Jul 19, 2024
Setting writecb and afterWriteTickInfo to null did not clear the value in the state object. Amends 35ec931 (stream: writable state bitmap). Fixes #52228. PR-URL: #53188 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
marco-ippolito
pushed a commit
that referenced
this issue
Jul 19, 2024
Setting writecb and afterWriteTickInfo to null did not clear the value in the state object. Amends 35ec931 (stream: writable state bitmap). Fixes #52228. PR-URL: #53188 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
robintown
added a commit
to toaq/toadua
that referenced
this issue
Aug 3, 2024
So that we get the fix for nodejs/node#52228 added in Node 22.3.0.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version
v20.10.0
Platform
Darwin arm64
Subsystem
stream
What steps will reproduce the bug?
Simple HTTP server that returns a ~1mb JSON file and reports memory usage every 5s. Starting with node 20.10.0 memory consumption jumps significantly when servicing requests (see below).
The random generated JSON I used for this test:
data.json
The
k6
load test script (named load_test.js) that sends requests to show the increase (run withk6 run load_test.js
):How often does it reproduce? Is there a required condition?
Reproduces always.
What is the expected behavior? Why is that the expected behavior?
Using node 20.9.0 (last good version) I see the following memory usage reported:
What do you see instead?
Starting from node 20.10.0 memory usage jumps considerably:
Additional information
We discovered this jump in memory consumption when we upgrade one of our microservices in production. Service works fine with 20.9.0, but starting with 20.10.0 started going over the allotted K8 memory limits.
Taking a look at the heap snapshot and comparing between old and good I saw that 20.10.0 had a lot of string objects in heap that were the unsent responses. Screenshot from the chrome debugger:
Looks like 20.10.0 started to buffer responses a bit longer which under a normal request load manifested as increased memory consumption for the server.
After briefly going over the changelog for 20.10.0 I suspect it might be related to this change - #50014 (but haven't verified and I don't know internals of nodejs that well).
The text was updated successfully, but these errors were encountered: