Skip to content

[Bug] 2.37.dev when started with pm2, updatenotification fails on checking for module changes #4165

Description

@sdetweil

Environment

SYSTEM: manufacturer: System manufacturer; model: System Product Name; virtual: false; MM: v2.37.0-develop

  • OS: platform: linux; distro: Ubuntu; release: 22.04.5 LTS; arch: x64; kernel: 5.15.0-179-generic
  • VERSIONS: electron: 42.1.0; used node: 24.15.0; installed node: 22.22.1; npm: 10.9.4; pm2: 5.4.3
  • ENV: XDG_SESSION_TYPE: x11; MM_CONFIG_FILE: undefined
    WAYLAND_DISPLAY: undefined; DISPLAY: :0.0; ELECTRON_ENABLE_GPU: undefined
  • RAM: total: 48076.70 MB; free: 42777.97 MB; used: 5298.73 MB
  • OTHERS: uptime: 127 minutes; timeZone: America/Chicago

Which start option are you using?

node --run start:x11

Are you using PM2?

Yes

Module

updatenotification

Have you tried disabling other modules?

  • Yes
  • No

Have you searched if someone else has already reported the issue on the forum or in the issues?

  • Yes

What did you do?

Configuration
      {
        module: "updatenotification",
        position: "top_center",
        order: "*",
        disabled: false,
        hiddenOnStartup: false,
        configDeepMerge: false,
        animateIn: "None",
        animateOut: "None",
        config: {
          updateAutorestart: true,
          updateInterval: 60000,
          updates: [
            { 'SampleModule':'git pull'}
          ]     
        }
      },

<!-- Paste relevant code here -->

Steps to reproduce the issue:
set UPN confg as above
start MM via pm2
then update one of the modules active in the config.js

What did you expect to happen?

expected module to update and MM to restart (per the new restart fix)

What actually happened?

HOWEVER , when MM is started via pm2, the git commands fail

2026-05-20 14:46:48.424] [ERROR] [updatenotification] Failed to get git revisions for MMM-Wallpaper: Error: Command failed: git rev-list --ancestry-path --count ecff59a..86a0df4  master
fatal: ambiguous argument 'ecff59a..86a0df4  master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

[2026-05-20 14:46:48.819] [ERROR] [updatenotification] Failed to get git revisions for MMM-EmbedURL: Error: Command failed: git rev-list --ancestry-path --count b401282..a6215fa  with_MMM-Config
fatal: ambiguous argument 'b401282..a6215fa  with_MMM-Config': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

[2026-05-20 14:46:49.131] [ERROR] [updatenotification] Failed to get git revisions for MMM-Config: Error: Command failed: git rev-list --ancestry-path --count 7702261..c12fefe  main
fatal: ambiguous argument '7702261..c12fefe  main': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

[2026-05-20 14:46:49.740] [ERROR] [updatenotification] Failed to get git revisions for MMM-CalendarExt3: Error: Command failed: git rev-list --ancestry-path --count e93534d..8b8e4f4  main
fatal: ambiguous argument 'e93534d..8b8e4f4  main': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

[2026-05-20 14:46:50.057] [ERROR] [updatenotification] Failed to get git revisions for MMM-page-indicator: Error: Command failed: git rev-list --ancestry-path --count 4d2cbd6..c431bb9  master
fatal: ambiguous argument '4d2cbd6..c431bb9  master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

[2026-05-20 14:46:50.691] [ERROR] [updatenotification] Failed to get git revisions for SampleModule: Error: Command failed: git rev-list --ancestry-path --count 9a81558..dd05c02  master
fatal: ambiguous argument '9a81558..dd05c02  master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

so it never detects the change, and does not know to update.

i tested this twice, deleted the .pm2/logs/project_name-*.log

I was wondering what would happen when we killed and restarted, disconnected from pm2,
the args still look the same..

[2026-05-20 14:49:26.946] [LOG]   [updatenotification] args= [
  '/home/sam/MagicMirror.2.36.dev/node_modules/electron/dist/electron',
  'js/electron.js'
]

and it came up, as x11 (on my system, as the process.env is passed on..)

and then

                const options = { cwd: this.root_path, detached: true, stdio: ["ignore", out, err] };
                const subprocess = Spawn(binary, args, options);
                subprocess.unref(); // allow the current process to exit without waiting for the subprocess
                process.exit();

do we have a race condition?, if newly spawned MM gets to open port, before current shuts down, we fail as port is in use
and I think we will have this with pm2 trying to restart the instance that died, while we have already started another instance..

the user will not be able to restart with pm2, as there is an instance running in the background.

if I stop the pm2 instance and do manual npm run start:x11
it detects, updates, and restarts as expected

Additional comments

No response

Participation

  • I am willing to submit a pull request for this change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions