• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

stopping MM via pm2 does not close electron - at restart I get EADDRINUSE

Scheduled Pinned Locked Moved Unsolved Troubleshooting
3 Posts 2 Posters 1.5k Views 1 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    AnduriI
    last edited by Sep 27, 2018, 9:26 AM

    Hey there,

    always after restarting I get an error EADDRINUSE. To investigate I looked at `netstat -lptn’ to see which program uses what port.
    At startup I see only one line coresponding to MM which is this:

    tcp        1      0 0.0.0.0:8088            0.0.0.0:*               LISTEN      1019/electron.js
    

    But when I use `pm2 stop mm’ I still see this line. I also tried to change the port for each restart with the result of having multiple instances of electron listening on the coresponding ports.
    When starting it manually without pm2 in the console it opens and closes correctly after quitting.
    Has anyone a guess how to solve this?

    1 Reply Last reply Reply Quote 0
    • A Offline
      AnduriI
      last edited by Sep 28, 2018, 8:19 AM

      some additional information: when running fine, pm2 seems to be the parent process:

        612 ?        Ssl    0:34 PM2 v3.1.3: God Daemon (/home/pi/.pm2)
        797 ?        Ss     0:00  \_ bash /home/pi/MagicMirror/installers/mm.sh
        799 ?        Sl     0:04      \_ npm
        946 ?        S      0:00          \_ sh -c sh run-start.sh
        947 ?        S      0:00              \_ sh run-start.sh
        949 ?        Sl     0:01                  \_ node /home/pi/MagicMirror/node_modules/.bin/electron js/electron.js
        958 ?        Sl     8:43                      \_ /home/pi/MagicMirror/node_modules/electron/dist/electron js/electron.js
        960 ?        S      0:00                          \_ /home/pi/MagicMirror/node_modules/electron/dist/electron --type=zygote --no-sandbox
       1088 ?        Sl     4:50                          |   \_ /home/pi/MagicMirror/node_modules/electron/dist/electron --type=renderer --no-sandbox --service-pipe-token=756DBD94487A30A46611ABEDF5588C31 --
       1087 ?        Sl     0:05                          \_ /home/pi/MagicMirror/node_modules/electron/dist/electron --type=gpu-process --no-sandbox --supports-dual-gpus=false --gpu-driver-bug-workarounds=9
      

      but as soon as I stop MM in pm2 I see 2 different parent processes:

        612 ?        Ssl    0:34 PM2 v3.1.3: God Daemon (/home/pi/.pm2)
        958 ?        Sl     8:45 /home/pi/MagicMirror/node_modules/electron/dist/electron js/electron.js
        960 ?        S      0:00  \_ /home/pi/MagicMirror/node_modules/electron/dist/electron --type=zygote --no-sandbox
       1088 ?        Sl     4:51  |   \_ /home/pi/MagicMirror/node_modules/electron/dist/electron --type=renderer --no-sandbox --service-pipe-token=756DBD94487A30A46611ABEDF5588C31 --lang=de --app-path=/home
       1087 ?        Sl     0:05  \_ /home/pi/MagicMirror/node_modules/electron/dist/electron --type=gpu-process --no-sandbox --supports-dual-gpus=false --gpu-driver-bug-workarounds=9,27,84 --disable-gl-exte
      

      so pm2 is still running, but left the electron browser also running now without a parent.

      1 Reply Last reply Reply Quote 0
      • B Offline
        bhepler Module Developer
        last edited by Sep 29, 2018, 5:20 PM

        It sounds like something on your Pi is attempting to start the Magic Mirror process twice. If you used a cron job to start MM as well as PM2, then this can happen. Likewise, if your script that PM2 calls to start the process has the command twice, this can happen.

        EADDRINUSE usually means that two processes are trying to serve up web pages on the same port. If that happens on reboot, then most likely two commands are trying to start MM.

        My recommendation is to remove PM2’s attempts to start MM, reboot and see if the mirror process starts. If so, find out how it’s being called and remove that, then reset pm2 to do it. If MM doesn’t start after the reboot, run your netstat -lptn again and find out what’s listening on that port.

        1 Reply Last reply Reply Quote 1
        • 1 / 1
        1 / 1
        • First post
          3/3
          Last post
        Enjoying MagicMirror? Please consider a donation!
        MagicMirror created by Michael Teeuw.
        Forum managed by Sam, technical setup by Karsten.
        This forum is using NodeBB as its core | Contributors
        Contact | Privacy Policy