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.

    Calendar issue with 2.7.1

    Scheduled Pinned Locked Moved Bug Hunt
    12 Posts 3 Posters 3.8k Views 4 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.
    • D Offline
      drfukc
      last edited by

      @sdetweil

      Hi Sam,
      the calendar entry I use for testing is the standard URL:

      url: "webcal://www.calendarlabs.com/templates/ical/US-Holidays.ics"
      

      As advised by you I searched up-and-down my calendarfetcher.js in:
      /home/pi/MagicMirror/modules/default/calendar/calendarfetcher.js

      I can find the following string: if (event.type === “VEVENT”) {
      But I cannot even find substring to uncomment such like this: console.log("have or event title or
      Hence there seems to be nothing to uncomment

      I rather believe my issue has something to do with to many Electron instances that kill several moduls.
      Maybe you have an idea for this:

      1. I boot up my raspberry 3b
      2. Execute ‘ps -a’ to check the running processes
      3. ‘ps -a’ returns ‘ps’ as the only running processes
      4. launching the mirror: ‘npm start &’
      5. the console tells me uncaught exception since EADDRINUSE is already in use:

      magicmirror@2.7.1 start /home/pi/MagicMirror
      sh run-start.sh

      Starting MagicMirror: v2.7.1
      Loading config ...
      Loading module helpers ...
      No helper found for module: alert.
      Initializing new module helper ...
      Module helper loaded: updatenotification
      No helper found for module: clock.
      Initializing new module helper ...
      Module helper loaded: calendar
      Initializing new module helper ...
      Module helper loaded: newsfeed
      All module helpers loaded.
      Starting server on port 8080 ... 
      Server started ...
      Connecting socket for: updatenotification
      Connecting socket for: calendar
      Starting node helper for: calendar
      Connecting socket for: newsfeed
      Starting module: newsfeed
      Sockets connected & modules started ...
      Whoops! There was an uncaught exception...
      { Error: listen EADDRINUSE 127.0.0.1:8080
          at Server.setupListenHandle [as _listen2] (net.js:1330:14)
          at listenInCluster (net.js:1378:12)
          at GetAddrInfoReqWrap.doListen [as callback] (net.js:1492:7)
          at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:55:10)
        errno: 'EADDRINUSE',
        code: 'EADDRINUSE',
        syscall: 'listen',
        address: '127.0.0.1',
        port: 8080 }
      MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
      If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
      
      1. Now I recheck my running processes and see *four instances of Electron. According to another thread it looks like I run two instances of MagicMirror in parallel, that have a conflict with each other and causing this EADDRINUSE message:
      PID TTY          TIME CMD
       1176 pts/0    00:00:01 npm
       1187 pts/0    00:00:00 sh
       1188 pts/0    00:00:00 sh
       1189 pts/0    00:00:00 node
       1196 pts/0    00:00:30 electron
       1198 pts/0    00:00:00 electron
       1236 pts/0    00:00:00 electron
       1238 pts/0    00:00:15 electron
       1305 pts/1    00:00:00 ps
      
      1. Checking PM2 by ‘pm2 list’ gives me only one instance:
      pi@raspberrypi:~ $ pm2 list
      +-------------------------------------------------------+
      ¦ Name        ¦ id ¦ mode ¦ status ¦ ? ¦ cpu ¦ memory   ¦
      +-------------+----+------+--------+---+-----+----------¦
      ¦ MagicMirror ¦ 0  ¦ fork ¦ online ¦ 0 ¦ 0%  ¦ 2.5 MB   ¦
      +-------------------------------------------------------+
      
      1. For more details I try pm2 show 0
      pi@raspberrypi:~ $ pm2 show 0
       Describing process with id 0 - name MagicMirror 
      +--------------------------------------------------------------+
      ¦ status            ¦ online                                   ¦
      ¦ name              ¦ MagicMirror                              ¦
      ¦ version           ¦ 2.7.1                                    ¦
      ¦ restarts          ¦ 0                                        ¦
      ¦ uptime            ¦ 16m                                      ¦
      ¦ script path       ¦ /home/pi/MagicMirror/installers/mm.sh    ¦
      ¦ script args       ¦ N/A                                      ¦
      ¦ error log path    ¦ /home/pi/.pm2/logs/MagicMirror-error.log ¦
      ¦ out log path      ¦ /home/pi/.pm2/logs/MagicMirror-out.log   ¦
      ¦ pid path          ¦ /home/pi/.pm2/pids/MagicMirror-0.pid     ¦
      ¦ interpreter       ¦ bash                                     ¦
      ¦ interpreter args  ¦ N/A                                      ¦
      ¦ script id         ¦ 0                                        ¦
      ¦ exec cwd          ¦ /home/pi/MagicMirror                     ¦
      ¦ exec mode         ¦ fork_mode                                ¦
      ¦ node.js version   ¦ N/A                                      ¦
      ¦ node env          ¦ N/A                                      ¦
      ¦ watch & reload    ¦ ?                                        ¦
      ¦ unstable restarts ¦ 0                                        ¦
      ¦ created at        ¦ 2019-04-06T11:57:10.685Z                 ¦
      +--------------------------------------------------------------+
       Revision control metadata 
      +---------------------------------------------------------------------+
      ¦ revision control ¦ git                                              ¦
      ¦ remote url       ¦ https://github.com/MichMich/MagicMirror.git      ¦
      ¦ repository root  ¦ /home/pi/MagicMirror                             ¦
      ¦ last update      ¦ 2019-04-15T06:53:55.840Z                         ¦
      ¦ revision         ¦ b508a629e8a727358f1b88e3c7df842d14669ec4         ¦
      ¦ comment          ¦ Merge pull request #1632 from MichMich/fix-2.7.1 ¦
      ¦                  ¦                                                  ¦
      ¦                  ¦ Fix package.json version number.                 ¦
      ¦ branch           ¦ master                                           ¦
      +---------------------------------------------------------------------+
      

      Any ideas?

      S 1 Reply Last reply Reply Quote 0
      • S Offline
        sdetweil @drfukc
        last edited by

        @drfukc said in Calendar issue with 2.7.1:

        { Error: listen EADDRINUSE 127.0.0.1:8080

        ok, then something ELSE on your system is using port 8080… maybe a web server?

        change the port number in mm/config/config.js to something else (8081 maybe)

        			if (event.type === "VEVENT") {
                 // console.log("have event title="+event.summary);
        

        so, add the second line and then uncomment it… I must have added that fro debugging someone elses problem

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        1 Reply Last reply Reply Quote 0
        • D Offline
          drfukc
          last edited by

          @sdetweil
          Thanks for your comment.
          First I changed the port as recommended in mm/config/config.js to 8081 and gave it a reboot.
          After reboot and logon I checked the network connections by sudo netstat -lnptu:

          pi@raspberrypi:~ $ sudo netstat -lnptu
          Aktive Internetverbindungen (Nur Server)
          Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
          tcp        0      0 127.0.0.1:8081          0.0.0.0:*               LISTEN      836/electron.js     
          tcp6       0      0 :::21                   :::*                    LISTEN      418/vsftpd          
          tcp6       0      0 ::1:3350                :::*                    LISTEN      446/xrdp-sesman     
          tcp6       0      0 :::3389                 :::*                    LISTEN      461/xrdp            
          udp        0      0 0.0.0.0:5353            0.0.0.0:*                           318/avahi-daemon: r 
          udp        0      0 0.0.0.0:68              0.0.0.0:*                           348/dhcpcd          
          udp        0      0 0.0.0.0:47216           0.0.0.0:*                           318/avahi-daemon: r 
          udp6       0      0 :::5353                 :::*                                318/avahi-daemon: r 
          udp6       0      0 :::34261                :::*                                318/avahi-daemon: r 
          

          I am surprised to see Electron already listening on port 8081, though I have not started the MagicMirror.
          In the next step I launch Magic Mirror by calling: npm start &

          Unfortunately I see again a EADDRINUSE message (port 8081):

          Server started ...
          Connecting socket for: updatenotification
          Connecting socket for: calendar
          Starting node helper for: calendar
          Connecting socket for: newsfeed
          Starting module: newsfeed
          Sockets connected & modules started ...
          Whoops! There was an uncaught exception...
          { Error: listen EADDRINUSE 127.0.0.1:8081
              at Server.setupListenHandle [as _listen2] (net.js:1330:14)
              at listenInCluster (net.js:1378:12)
              at GetAddrInfoReqWrap.doListen [as callback] (net.js:1492:7)
              at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:55:10)
            errno: 'EADDRINUSE',
            code: 'EADDRINUSE',
            syscall: 'listen',
            address: '127.0.0.1',
            port: 8081 }
          MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
          If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
          Launching application.
          

          While the mirror is running I execute again sudo netstat -lnptu and get:

          pi@raspberrypi:~/MagicMirror $ sudo netstat -lnptu
          Aktive Internetverbindungen (Nur Server)
          Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
          tcp        0      0 127.0.0.1:8081          0.0.0.0:*               LISTEN      888/electron.js     
          tcp6       0      0 :::21                   :::*                    LISTEN      435/vsftpd          
          tcp6       0      0 ::1:3350                :::*                    LISTEN      450/xrdp-sesman     
          tcp6       0      0 :::3389                 :::*                    LISTEN      465/xrdp            
          udp        0      0 0.0.0.0:42644           0.0.0.0:*                           318/avahi-daemon: r 
          udp        0      0 0.0.0.0:5353            0.0.0.0:*                           318/avahi-daemon: r 
          udp        0      0 0.0.0.0:68              0.0.0.0:*                           354/dhcpcd          
          udp6       0      0 :::42148                :::*                                318/avahi-daemon: r 
          udp6       0      0 :::5353                 :::*                                318/avahi-daemon: r 
          

          This is strange. The launch of the mirror npm start & tells me a multiple use of the port 8080 or 8081 (whatever it set in config.js) but netstat -lnptu does not know anything about a duplicate use.

          As advised I also added below line right after if (event.type === “VEVENT”) { in ftp://192.168.178.36/home/pi/MagicMirror/modules/default/calendar/calendarfetcher.js

          console.log("have event title="+event.summary);
          

          Unfortunately the console outcome again is: “EADDRINUSE”

          Initializing new module helper ...
          Module helper loaded: calendar
          Initializing new module helper ...
          Module helper loaded: newsfeed
          All module helpers loaded.
          Starting server on port 8081 ... 
          Server started ...
          Connecting socket for: updatenotification
          Connecting socket for: calendar
          Starting node helper for: calendar
          Connecting socket for: newsfeed
          Starting module: newsfeed
          Sockets connected & modules started ...
          Whoops! There was an uncaught exception...
          { Error: listen EADDRINUSE 127.0.0.1:8081
              at Server.setupListenHandle [as _listen2] (net.js:1330:14)
              at listenInCluster (net.js:1378:12)
              at GetAddrInfoReqWrap.doListen [as callback] (net.js:1492:7)
              at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:55:10)
            errno: 'EADDRINUSE',
            code: 'EADDRINUSE',
            syscall: 'listen',
            address: '127.0.0.1',
            port: 8081 }
          MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
          If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
          Launching application.
          

          I feel a little bit lost … … …

          S 1 Reply Last reply Reply Quote 0
          • S Offline
            sdetweil @drfukc
            last edited by

            @drfukc is mirror starting on boot with PM2?

            go to console and do

            pm2 list
            is something, get its name and pm2 stop name

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            1 Reply Last reply Reply Quote 0
            • D Offline
              drfukc
              last edited by

              Thanks for your advise. After launching the mirror I do a pm2 list with the following result:

              pi@raspberrypi:~/MagicMirror $ pm2 list
              +-------------------------------------------------------+
              ¦ Name        ¦ id ¦ mode ¦ status ¦ ? ¦ cpu ¦ memory   ¦
              +-------------+----+------+--------+---+-----+----------¦
              ¦ MagicMirror ¦ 0  ¦ fork ¦ online ¦ 0 ¦ 0%  ¦ 2.5 MB   ¦
              +-------------------------------------------------------+
               Use `pm2 show <id|name>` to get more details about an app
              

              With this information I stop the MagicMirror by the following command: pm2 stop 0

              pi@raspberrypi:~ $ pm2 stop 0
              [PM2] Applying action stopProcessId on app [0](ids: 0)
              [PM2] [MagicMirror](0) ?
              +------------------------------------------------------+
              ¦ Name        ¦ id ¦ mode ¦ status  ¦ ? ¦ cpu ¦ memory ¦
              +-------------+----+------+---------+---+-----+--------¦
              ¦ MagicMirror ¦ 0  ¦ fork ¦ stopped ¦ 0 ¦ 0%  ¦ 0 B    ¦
              +------------------------------------------------------+
              Use `pm2 show <id|name>` to get more details about an app
              
              

              By surprise the running MagicMirror survives and I kill the Electron instance with kill
              After the MagicMirror instance is terminated I relaunch MagicMirror again with npm start &
              The funny thing is that the naughty EADDRINUSE message is gone by now, but the calendar is still not working:

              pi@raspberrypi:~/MagicMirror $ npm start &
              [2] 1279
              [1]   Fertig                  npm start
              pi@raspberrypi:~/MagicMirror $ 
              > magicmirror@2.7.1 start /home/pi/MagicMirror
              > sh run-start.sh
              
              Starting MagicMirror: v2.7.1
              Loading config ...
              Loading module helpers ...
              No helper found for module: alert.
              Initializing new module helper ...
              Module helper loaded: updatenotification
              No helper found for module: clock.
              Initializing new module helper ...
              Module helper loaded: calendar
              Initializing new module helper ...
              Module helper loaded: newsfeed
              All module helpers loaded.
              Starting server on port 8081 ... 
              Server started ...
              Connecting socket for: updatenotification
              Connecting socket for: calendar
              Starting node helper for: calendar
              Connecting socket for: newsfeed
              Starting module: newsfeed
              Sockets connected & modules started ...
              Launching application.
              Create new calendar fetcher for url: http://www.calendarlabs.com/templates/ical/US-Holidays.ics - Interval: 300000
              Create new news fetcher for url: http://www.tagesschau.de/xml/rss2 - Interval: 300000
              

              OK, as said above I have relaunched the mirror by npm start & and try to evaluate what is going on with pm2 list:

              pi@raspberrypi:~ $ pm2 list
              +------------------------------------------------------+
              ¦ Name        ¦ id ¦ mode ¦ status  ¦ ? ¦ cpu ¦ memory ¦
              +-------------+----+------+---------+---+-----+--------¦
              ¦ MagicMirror ¦ 0  ¦ fork ¦ stopped ¦ 0 ¦ 0%  ¦ 0 B    ¦
              +------------------------------------------------------+
               Use `pm2 show <id|name>` to get more details about an app
              

              It’s funny, pm2 list tells me that the Mirror has stopped, while it is still running, but I still do not recieve any Calendar updates.
              What is wrong here?

              S 1 Reply Last reply Reply Quote 0
              • S Offline
                sdetweil @drfukc
                last edited by

                @drfukc that calendar,

                url: "webcal://www.calendarlabs.com/templates/ical/US-Holidays.ics"
                

                is thru 2018…

                this one contains thru 2019

                url: "webcal://www.calendarlabs.com/ical-calendar/ics/76/US_Holidays.ics"
                

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                1 Reply Last reply Reply Quote 0
                • D Offline
                  drfukc
                  last edited by

                  @sdetweil
                  Thanks a lot, - this helped :-) , it is so much easier if things are done right straight from the beginning :-D

                  In addition I also found the root cause for above reported “EADDRINUSE” error.
                  Simple again: I have enabled MagicMirror autostart in /home/pi/MagicMirror/installers/mm.sh, but don’t see it since I use a Remote Desktop connection (RDP) that gives me a different X-Window in comparison to the native Raspberry desktop.
                  Now launching Magic Mirror a second time on a different desktop and the same port causes the issue.
                  Since I disabled MM autostart Magic Mirror boots up without these errors.
                  Maybe I should get back from XRDP and switch to the preinstalled VNC to avoid having multiple desktops.

                  Again, thanks a lot for your support :-)

                  S 1 Reply Last reply Reply Quote 0
                  • S Offline
                    sdetweil @drfukc
                    last edited by

                    @drfukc I ssh to my mirrors… one autostarts, one does not…

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    1 Reply Last reply Reply Quote 0
                    • 1
                    • 2
                    • 2 / 2
                    • First post
                      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