You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While the Chromium DevTools debugger is attached, RSS memory usage of a Node process keeps increasing without being collected. Once the debugger is detached, the memory usage flattens, however the memory is never released. When the debugger is not attached to the process in its runtime, memory allocation occurs as expected. It is entirely possible that this might not be related to Node (v8, perhaps) - however, this issue might be a good place to start a discussion.
Inspecting htop on a Raspberry Pi 3B machine:
Process after running for ~24 hours without a debugger attached: stable at around ~180MB RSS:
The same process, after attaching the debugger for ~15 minutes (with no actual user debugging active nor any logs being displayed): RSS at around ~245MB and rising:
After disconnecting the debugger (removing the connection, closing and re-opening the debugger window), RSS stabilizes at around ~260MB. After ~30 minutes of further activity, the RSS usage seems stable; however, the memory is not freed:
After running valgrind for various amounts of time on a different Linux machine, there seems to be an excessive amount of v8_inspector::AsyncStackTrace::capture calls. Using the Disable async stack traces option in DevTools > Settings > Debugger seems to reduce the leak somewhat, however, this wasn't reproducible across machines. Furthermore, testing the same process on Windows 10 in the same environment leads to no memory leaks.
Attached are valgrind dumps for various tested nodejs versions. Note that each dump was created with the process running for differing amounts, hence the total memory leaked will not be as relevant.
Set up a Node process, possibly with asynchronous stack activity
Attach a Chrome DevTools debugger instance
Observe a memory leak as long as the debugger is attached
How often does it reproduce? Is there a required condition?
Only seems to reproduce on Linux, not Windows
Might be related to async stack traces
At first, seemed to be related to the mariadb NPM module - but upon further testing with the module inactive, the memory leak kept occuring
What is the expected behavior?
No memory leak should occur as the debugger is being used.
What do you see instead?
Depending on the process being run, upwards of hundreds of MB of RAM will leak in a couple of minutes as the debugger is attached.
Additional information
A similar type of memory leak seems to be present in versions prior to 14.0, however, in a much smaller scale, and occuring much more slowly. Reference: #28787, possibly #28420
The text was updated successfully, but these errors were encountered:
Ayase-252
added
inspector
Issues and PRs related to the V8 inspector protocol
memory
Issues and PRs related to the memory management or memory footprint.
labels
Jun 18, 2021
I think I am also encountering this on nodejs v14.18.0 running on AWS ECS Fargate on a container based on amazonlinux:2. Memory usage started at around 500MB and as soon as I attached the debugger (no profiling or heap dumps) it jumped up to 2.1GB. Node still reports around 500MB used.
v14.0.0
,v14.17.0
andv16.1.0
)While the Chromium DevTools debugger is attached, RSS memory usage of a Node process keeps increasing without being collected. Once the debugger is detached, the memory usage flattens, however the memory is never released. When the debugger is not attached to the process in its runtime, memory allocation occurs as expected. It is entirely possible that this might not be related to Node (v8, perhaps) - however, this issue might be a good place to start a discussion.
Inspecting
htop
on a Raspberry Pi 3B machine:Process after running for ~24 hours without a debugger attached: stable at around ~180MB RSS:

The same process, after attaching the debugger for ~15 minutes (with no actual user debugging active nor any logs being displayed): RSS at around ~245MB and rising:

After disconnecting the debugger (removing the connection, closing and re-opening the debugger window), RSS stabilizes at around ~260MB. After ~30 minutes of further activity, the RSS usage seems stable; however, the memory is not freed:

After running valgrind for various amounts of time on a different Linux machine, there seems to be an excessive amount of
v8_inspector::AsyncStackTrace::capture
calls. Using theDisable async stack traces
option inDevTools > Settings > Debugger
seems to reduce the leak somewhat, however, this wasn't reproducible across machines. Furthermore, testing the same process on Windows 10 in the same environment leads to no memory leaks.Attached are valgrind dumps for various tested nodejs versions. Note that each dump was created with the process running for differing amounts, hence the total memory leaked will not be as relevant.
valgrind.zip
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
mariadb
NPM module - but upon further testing with the module inactive, the memory leak kept occuringWhat is the expected behavior?
No memory leak should occur as the debugger is being used.
What do you see instead?
Depending on the process being run, upwards of hundreds of MB of RAM will leak in a couple of minutes as the debugger is attached.
Additional information
A similar type of memory leak seems to be present in versions prior to 14.0, however, in a much smaller scale, and occuring much more slowly. Reference: #28787, possibly #28420
The text was updated successfully, but these errors were encountered: