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

Reinstalling all plugins very resource hungry #1741

Open
tkurki opened this issue May 23, 2024 · 1 comment
Open

Reinstalling all plugins very resource hungry #1741

tkurki opened this issue May 23, 2024 · 1 comment

Comments

@tkurki
Copy link
Member

tkurki commented May 23, 2024

I tried to reinstall all my plugins on my PRi3 by removing .signalk/node_modules and simply running npm install in .signalk.

This turned out to be problematic in two ways:

  • my docker compose based setup has a mem limit of 350m that OOM killed npm install when it exceeded the limit
  • without the memory limit the install would still stall, halting the whole RPi or at least stopping the ssh connection i was using and no longer responding to ssh over Zerotier

pstree showed a number of npm install processes and I think i saw node-pre-gyp in top also.

Doing the same operation manually, one by one (under docker run -it --rm -v /home/pi/signalk-settings:/home/node/.signalk --entrypoint /bin/sh signalk/signalk-server:master) succeeded without breaking a sweat.

To me this suggests that just given a package.json npm install goes all out, with parallel operations, which may be just too resource intensive for some typical platforms that Signal K is used on.

I can think of two solutions here:

  • a separate sk-reinstall-plugins script that renames node_modules and package.json and then loops over the plugins there, installing them one by one
  • a way to launch sk server with a command line option --reinstall-plugins that does the same thing as the script. this would support also Windows platform
@KEGustafsson
Copy link
Contributor

KEGustafsson commented May 23, 2024

npm config get maxsockets default is 15. If this is tuned, would it make any difference e.g. npm config set maxsockets 5 or even smaller amount?

Also npm i --max-old-space-size=250 might be viable solution to limit memory usage.

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

2 participants