Skip to content
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

possible memory leak in ping node #170

Open
andysc opened this issue Jan 27, 2016 · 12 comments
Open

possible memory leak in ping node #170

andysc opened this issue Jan 27, 2016 · 12 comments

Comments

@andysc
Copy link

andysc commented Jan 27, 2016

After a long time (weeks) of pinging every 15 seconds, Node-RED crashed with:

26 Jan 12:46:45 - [red] Uncaught Exception:
26 Jan 12:46:45 - Error: spawn ENOMEM
at exports._errnoException (util.js:746:11)
at ChildProcess.spawn (child_process.js:1162:11)
at exports.spawn (child_process.js:995:9)
at null. (/home/pi/.node-red/node_modules/node-red-node-ping/88-ping.js:30:41)
at wrapper as _onTimeout
at Timer.listOnTimeout (timers.js:119:15)

@dceejay
Copy link
Member

dceejay commented Jan 27, 2016

how was this running ? Is this on Pi...
what was --max-old-space-size set to ? (default is 128)

@andysc
Copy link
Author

andysc commented Jan 27, 2016

yes, on Pi, with --max-old-space-size=256

@dceejay
Copy link
Member

dceejay commented Jan 31, 2016

Slightly tricky one this...
we could just try and catch the error - but then we would still not be pinging the host (but yes would not be crashing Node-RED)
Or we could try to re-write the node so it only spawns once... and runs "forever" (until redeploy etc) - but for that we need to use the -i interval parameter - which does NOT exist in windows ping command...
Or we can rewrite using something like - https://www.npmjs.com/package/net-ping

@andysc
Copy link
Author

andysc commented Feb 1, 2016

I'm wondering why it would have got this error, though - when it crashed, I was able to log in and do stuff on the Pi, so it evidently wasn't out of system memory...

@Roaders
Copy link

Roaders commented May 13, 2016

Not sure if this is relevant but I am beginning to suspect that this ping node is crashing my pi 3.

It's been running Node-red fine for ages. About 2 weeks ago I added some new custom nodes and since then the Pi has been becoming unresponsive and requiring power cycling (no response to ssh, does not serve any pages from node red)

A few days ago I removed all the new nodes other than ping but pi was still dying.

Today I investigated a bit more. 20 minutes after the pi boots the node process jumps to the top of cpu usage with 100% (or over) usage.
If I call node-red-stop the cpu usage drops right back down again (but ssh still doesn't work until a reboot).
I have now uninstalled the ping node and will see if the pi dies again.

@Roaders
Copy link

Roaders commented May 14, 2016

Nope, not the ping node. Still dying after removing it.

@bigmonkeyboy
Copy link

bigmonkeyboy commented May 14, 2016 via email

@Roaders
Copy link

Roaders commented May 14, 2016

The flow is pretty complex but it's just for controlling my lights. I have Hue nodes and wemo nodes that are kicked off with http request nodes. Most of the time it is doing nothing (unless I call one of the http nodes).
I am beginning to suspect that ssh not working is due to too many failed login attempts from bots. I am not sure what would make node cpu rocket but I have turned off port forwarding for now. It will be a pain if I can't have the page accessible from outside the house....
Thanks for the reply.

@twocolors
Copy link

twocolors commented Feb 7, 2024

@dceejay didn't think about rewriting to use https://www.npmjs.com/package/net-ping ?

in docker after ~ 1 week work a see many process ping and error

node-red  | 7 Feb 04:03:17 - [info] [ping:45sec] ping - Host '192.168.0.30' process timeout - sending SIGINT
node-red  | 7 Feb 04:08:38 - [info] [ping:45sec] ping - Host '192.168.0.30' process timeout - sending SIGINT
node-red  | 7 Feb 04:13:10 - [info] [ping:45sec] ping - Host '192.168.0.30' process timeout - sending SIGINT
node-red  | 7 Feb 04:43:28 - [info] [ping:45sec] ping - Host '192.168.0.30' process timeout - sending SIGINT
node-red  | 7 Feb 04:56:23 - [info] [ping:45sec] ping - Host '192.168.0.30' process timeout - sending SIGINT
node-red  | 7 Feb 04:58:43 - [info] [ping:45sec] ping - Host '192.168.0.30' process timeout - sending SIGINT
node-red  | 7 Feb 05:13:46 - [info] [ping:45sec] ping - Host '192.168.0.30' process timeout - sending SIGINT
node-red  | 7 Feb 05:35:37 - [info] [ping:45sec] ping - Host '192.168.0.30' process timeout - sending SIGINT
node-red  | 7 Feb 05:40:55 - [info] [ping:45sec] ping - Host '192.168.0.30' process timeout - sending SIGINT
node-red  | 7 Feb 05:45:29 - [info] [ping:45sec] ping - Host '192.168.0.30' process timeout - sending SIGINT
node-red  | 7 Feb 06:08:26 - [info] [ping:45sec] ping - Host '192.168.0.30' process timeout - sending SIGINT
node-red  | 7 Feb 06:35:52 - [info] [ping:45sec] ping - Host '192.168.0.30' process timeout - sending SIGINT
node-red  | 7 Feb 06:42:45 - [info] [ping:45sec] ping - Host '192.168.0.30' process timeout - sending SIGINT
node-red  | 7 Feb 06:45:47 - [info] [ping:45sec] ping - Host '192.168.0.30' process timeout - sending SIGINT
node-red  | 7 Feb 06:55:49 - [info] [ping:45sec] ping - Host '192.168.0.30' process timeout - sending SIGINT
node-red  | 7 Feb 07:00:25 - [info] [ping:45sec] ping - Host '192.168.0.30' process timeout - sending SIGINT
node-red  | 7 Feb 08:08:24 - [info] [ping:45sec] ping - Host '192.168.0.30' process timeout - sending SIGINT
node-red  | 7 Feb 08:55:29 - [info] [ping:45sec] ping - Host '192.168.0.30' process timeout - sending SIGINT
node-red  | 7 Feb 09:21:30 - [info] [ping:45sec] ping - Host '192.168.0.30' process timeout - sending SIGINT
node-red  | 7 Feb 09:22:59 - [info] [ping:45sec] ping - Host '192.168.0.30' process timeout - sending SIGINT
node-red  | 7 Feb 09:26:10 - [info] [ping:45sec] ping - Host '192.168.0.30' process timeout - sending SIGINT
node-red  | 7 Feb 09:30:44 - [info] [ping:45sec] ping - Host '192.168.0.30' process timeout - sending SIGINT
node-red  | 7 Feb 09:31:30 - [info] [ping:45sec] ping - Host '192.168.0.30' process timeout - sending SIGINT
node-red  | 7 Feb 09:50:23 - [info] [ping:45sec] ping - Host '192.168.0.30' process timeout - sending SIGINT
node-red  | 7 Feb 09:55:43 - [info] [ping:45sec] ping - Host '192.168.0.30' process timeout - sending SIGINT
node-red  | 7 Feb 10:05:30 - [info] [ping:45sec] ping - Host '192.168.0.30' process timeout - sending SIGINT
node-red  | 7 Feb 10:08:30 - [info] [ping:45sec] ping - Host '192.168.0.30' process timeout - sending SIGINT
node-red  | 7 Feb 10:11:30 - [info] [ping:45sec] ping - Host '192.168.0.30' process timeout - sending SIGINT
node-red  | 7 Feb 10:14:30 - [info] [ping:45sec] ping - Host '192.168.0.30' process timeout - sending SIGINT
node-red  | 7 Feb 10:21:20 - [info] [ping:45sec] ping - Host '192.168.0.30' process timeout - sending SIGINT
node-red  | 7 Feb 10:23:36 - [info] [ping:45sec] ping - Host '192.168.0.30' process timeout - sending SIGINT
node-red  | 7 Feb 10:25:06 - [info] [ping:45sec] ping - Host '192.168.0.30' process timeout - sending SIGINT
node-red  | 7 Feb 10:50:30 - [info] [ping:45sec] ping - Host '192.168.0.30' process timeout - sending SIGINT

and container Node-Red use more cpu / memory
in flow use node ping with timer 30 sec

@dceejay
Copy link
Member

dceejay commented Feb 7, 2024

No - but more than happy to look at a Pull Request.

@twocolors
Copy link

for history not good idea use net-ping for this node, in install host windows . not easy compiled / install net-ping ... (it worked for me on win10/server 2016/server 2019, but it didn’t work on win7)

@dceejay
Copy link
Member

dceejay commented Feb 12, 2024

ah - right - so it uses a binary and not pure JS... then yeah not such a great solution :-(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants