Debugging NodeJS app with Remote SSH and using VSCode causes memory to climb on linux computer

Linux networking topics in here including wired or wireless.
Post Reply
admin
Site Admin
Posts: 36
Joined: Sun Aug 08, 2021 7:49 am

Debugging NodeJS app with Remote SSH and using VSCode causes memory to climb on linux computer

Post by admin »

I have noticed when trying to debug my NodeJS application remotely on Linux using VSCode, that the memory used by the NodeJS app will continues to climb until the Linux system runs out of memory. The issue seems to be related to how much the app uses console.log(). When running the application straight in Linux (typing node test.js in SSH), the app does not have the same memory issues.

This is my setup:

I am using VSCode on Windows V1.67.2.
Remote SSH connected to a Ubuntu Server (Ubuntu 20.04.4 LTS)
NodeJS version is v16.15.0 (also tried v14)
Debug the NodeJS app remotely on Linux PC.
Launch.json

{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "pwa-node",
"request": "launch",
"name": "Launch Program",
"skipFiles": ["<node_internals>/**"],
"program": "${workspaceFolder}/test.js"
}
]
}
test.js

let i = 0;
setInterval(() => {
console.log(i++);
}, 10);
Using Top on linux to monitor the memory of the app:

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
15240 root 20 0 666752 52224 31504 S 16.2 1.7 0:03.38 /usr/bin/node ./test.js
15240 root 20 0 673620 60356 31504 S 14.9 2.0 0:05.71 /usr/bin/node ./test.js
15240 root 20 0 680024 66328 31504 S 13.9 2.2 0:07.81 /usr/bin/node ./test.js
15240 root 20 0 686580 73840 31504 S 12.9 2.4 0:09.83 /usr/bin/node ./test.js
15240 root 20 0 720928 107552 31504 S 12.9 3.5 0:20.09 /usr/bin/node ./test.js
15240 root 20 0 791936 178952 31504 S 12.9 5.8 0:41.38 /usr/bin/node ./test.js
15240 root 20 0 857920 244916 31504 R 12.9 8.0 1:00.94 /usr/bin/node ./test.js
Does anyone have any ideas why the memory keeps climbing?
Post Reply