Closed gorbunovav closed 5 years ago
Thank you for the bug report. This should work now in the latest 0.9.2 images.
@mrstegeman thank you for a quick reply. I've pulled the new image, but I am observing the same behavior - high CPU usage and increasing memory allocation.
I don't see anything relevant in logs - only a few lines about the add-on launch:
2019-08-27 08:45:53.438 INFO : Loading add-on: wake-on-lan-adapter
2019-08-27 08:45:53.912 INFO : wake-on-lan: Opening database: /home/node/.mozilla-iot/config/db.sqlite3
2019-08-27 08:45:53.943 INFO : wake-on-lan: Loading add-on for wake-on-lan-adapter from /home/node/.mozilla-iot/addons/wake-on-lan-adapter
Previously, the arp
command was not available, so the adapter was doing nothing.
I just set up a fresh gateway container with only this add-on installed and watched it for an hour. It consistently sits at 0% CPU and a constant memory footprint (~130KB).
Are you positive it's this issue causing the problem? Can you watch top
or something and make sure?
@mrstegeman I've checked - the arp command is available in the running image (so it is indeed the latest one).
watched it for an hour
for me, it happens immediately after I am enabling the add-on. It takes less than a minute for MEM usage to grow up to 1Gb.
Can you watch
top
or something and make sure?
top
says, that it is node
process consuming resources.
Are you positive it's this issue causing the problem?
Is there way to get some additional logs? Issue appears right after enabling the add-on and disappears immediately after it disable (MEM usage drops too). I don't see any errors in container logs.
You should see several node processes. The one with the lowest PID would be the gateway, so I'm curious which process has the memory leak. You could also try with top -c
, which should show the full command string.
@mrstegeman it is
node src/addon-loader.js /home/node/.mozilla-iot/addons/wake-on-lan-adapter
@mrstegeman I've performed some experiments on my PC with x86 and arm images.
The plugin works in both modes. But I've noticed, that CPU load and memory usage jump on the add-on launch too, but after some time it cools down.
Maybe Raspberry Pi is too weak and the plugin launch takes much more time. Plus right now it hits throttling. I will try tomorrow with an open case and better cooling.
Hmmm interesting. Let me know if you figure anything out.
For reference, my testing was done on a 3B+ (as well as the x86-64) image.
@mrstegeman I have Raspberry Pi 4 with 2Gb of RAM. I've tested it today - the CPU temperature was ok, no throttling. The plugin dies after about 7 minutes of constant CPU usage:
2019-08-28 11:04:10.141 INFO : Loading add-on: wake-on-lan-adapter
2019-08-28 11:04:10.696 INFO : wake-on-lan: Opening database: /home/node/.mozilla-iot/config/db.sqlite3
2019-08-28 11:04:10.727 INFO : wake-on-lan: Loading add-on for wake-on-lan-adapter from /home/node/.mozilla-iot/addons/wake-on-lan-adapter
...
2019-08-28 11:11:38.056 INFO : Plugin: wake-on-lan-adapter died, code = null restarting after 0
2019-08-28 11:11:38.586 INFO : wake-on-lan: Opening database: /home/node/.mozilla-iot/config/db.sqlite3
2019-08-28 11:11:38.615 INFO : wake-on-lan: Loading add-on for wake-on-lan-adapter from /home/node/.mozilla-iot/addons/wake-on-lan-adapter
I've also tried with a fresh installation of the gateway (new data
folder and no other plugins installed) - the behavior is the same.
@mrstegeman ok, I think I've tracked it down.
I have other containers on my Pi and the gateway uses the 'host' network mode (recommended way), so the resulting network is quite extensive with a lot of network masks like 255.255.0.0
.
The plugin calls 'findDevices' function from the 'local-devices' package, which in turn is not very intellectual and just tries to ping all possible IPs on all available interfaces (which in my case is more than 500K records).
That would do it! You can definitely run in bridge mode and just forward the two ports (8080 and 4443). Just be aware that some device discovery methods may not work.
@mrstegeman I've tried and the wake feature doesn't work in the bridge mode 🙄
I just released version 0.1.1 of the adapter. Could you update your add-on and then set the checkPing
option in the config to false? That should hopefully fix your issues in host networking mode.
@mrstegeman Yes, I've just tried - it works for me. Thank you!
Docker container with the gateway starts to eat RAM upon add-on installation, it stops if you disable the add-on.
Environment:
Raspberry Pi 4 Raspbian 10 Docker version 19.03.1, build 74b1e89 Image: mozillaiot/gateway:0.9.2-arm
docker-compose.yml: