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

[updatenotification] use of this module creates pm2 daemon process(es) #3480

Closed
khassel opened this issue Jun 24, 2024 · 3 comments
Closed
Labels

Comments

@khassel
Copy link
Collaborator

khassel commented Jun 24, 2024

When running mm with updatenotification module (or running tests where this module is active) we get

node@ec51cfe176dd:/opt/magic_mirror$ npx jest tests/e2e/env_spec.js
 PASS   e2e  tests/e2e/env_spec.js (7.22 s)
  App environment
    ✓ get request from http://localhost:8080 should return 200 (217 ms)
    ✓ get request from http://localhost:8080/nothing should return 404 (27 ms)
    ✓ should show the title MagicMirror² (204 ms)

Test Suites: 1 passed, 1 total
Tests:       3 passed, 3 total
Snapshots:   0 total
Time:        7.456 s
Ran all test suites matching /tests\/e2e\/env_spec.js/i.

node@ec51cfe176dd:/opt/magic_mirror$ ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
node         1  0.0  0.0   2472   884 pts/0    Ss   22:52   0:00 /usr/bin/tini -- ./entrypoint.sh bash
node         7  0.0  0.0   4188  3384 pts/0    S    22:52   0:00 bash
node       193  3.6  0.8 1039160 66032 ?       Ssl  22:53   0:00 PM2 v5.4.1: God Daemon (/home/node/.pm2)
node       200  3.1  0.7 1006164 64880 ?       Ssl  22:53   0:00 PM2 v5.4.1: God Daemon (/home/node/.pm2)
node       211  0.0  0.0   8088  3868 pts/0    R+   22:53   0:00 ps aux

@bugsounet I'm not familiar with pm2, so my question is: Can we avoid these God Daemon processes?

@bugsounet
Copy link
Contributor

sure it's not really logical to have 2 pm2 process running

I will inspect

@bugsounet
Copy link
Contributor

bugsounet commented Jun 26, 2024

bugsounet@PC-Bugsounet:~/MagicMirror/modules$ npx jest tests/e2e/env_spec.js && grep pm2
 PASS   e2e  ../tests/e2e/env_spec.js
  App environment
    ✓ get request from http://localhost:8080 should return 200 (37 ms)
    ✓ get request from http://localhost:8080/nothing should return 404 (14 ms)
    ✓ should show the title MagicMirror² (201 ms)

Test Suites: 1 passed, 1 total
Tests:       3 passed, 3 total
Snapshots:   0 total
Time:        1.802 s
Ran all test suites matching /tests\/e2e\/env_spec.js/i.
bugsounet@PC-Bugsounet:~/MagicMirror/modules$ ps aux | grep PM2
bugsoun+    3687  0.0  0.7 1299924 61668 ?       Ssl  17:02   0:02 PM2 v5.4.1: God Daemon (/home/bugsounet/.pm2)
bugsoun+   84793  0.0  0.0   9104  2304 pts/0    S+   20:31   0:00 grep --color=auto PM2
bugsounet@PC-Bugsounet:~/MagicMirror/modules$ 

(tested on my pi5, it's the same)

I don't create any process with PM2.
I just check pm2 app presence and check if MM² is on pm2 "status" list
--> if condition match set "flag" to use PM2 for restart MM² (with MM² process id in PM2)

So, i don't know why you have double process, maybe double install of PM2 ??? (I don't think PM2 must avoid this)

@khassel
Copy link
Collaborator Author

khassel commented Jun 26, 2024

Thanks so far, will test this again ...

khassel added a commit that referenced this issue Jun 28, 2024
…3484)

related to #3480 

Change module updatenotification so that it can work without `pm2` in a
docker container.

It now tests if file `/.dockerenv` exists and if so `require("pm2")` is
never called.
@khassel khassel closed this as completed Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants