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.

    Unable to determine reason for MM/electron decaying/dying/hanging

    Scheduled Pinned Locked Moved Bug Hunt
    20 Posts 4 Posters 2.9k Views 5 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.
    • B Offline
      benrlewis7450G
      last edited by benrlewis7450G

      Platform: Raspbery Pi 4
      Node Version: v10.17.0
      MagicMirror Version:2

      Description: Magic Mirror or Electron is dying/hanging when rotating through pictures. I’ve tried to use any of the various image rotation modules and ultimately end up getting the same results. After several minutes rotating through pictures, the whole operation hangs. Clock stops ticking, pictures stop rotating, ssh becomes unresponsive, etc. I believe this may be an Electron issue, but can’t be certain (my diagnostic skills are lacking to an extent). I have put MM in server only mode and used Safari on my Mac and everything appears to function normally and continuously - this is why I am leaning toward Electron being the problem. I also attempted to use Chromium in place of electron running on the pi and it hangs just as electron (common algorithms?). Adding Watchdog helps keep things going to a certain extent - it still crashes, but at least MM restarts. But even after a while with that happening, the system gets bogged down to the point that its non-responsive and needs a hard reboot.

      Steps to Reproduce: Run magic mirror with any of [MMM-BackgroundSlideshow, MMM-ImageSlideshow, MMM-RandomPhoto] modules

      Expected Results: continuous run rotating through pictures

      Actual Results: MM dies when both server and client are running on same machine - will restart if running Watchdog, MM continues to run on Safari client and Raspi 4 server. No obvious indications as to why when running with the debug console open - just disconnects.

      Configuration:
      {
      address: “localhost”,
      port: 8080,
      ipWhitelist: [“127.0.0.1”, “::ffff:127.0.0.1”, “::1”],
      language: “en”,
      timeFormat: 24,
      units: “metric”,

      modules: [
      	{
      		module: "alert",
      	},
      	{
      		module: "MMM-WatchDog",
      	},
      	{
      		module: "updatenotification",
      		position: "top_bar"
      	},
      	{
      		module: "clock",
      		position: "top_left"
      	},
      	{
      		module: "calendar",
      		header: "Calendar",
      		position: "top_left",
      		config: {
      			calendars: [
      				{
      					symbol: "calendar-check",
      					url: "private",
      					maximumNumberOfDays: 7,
      				},
      				{
      					symbol: "car",
      					url:"private",
      					maximumNumberOfDays: 7,
      				},
      				{
      					symbol: "kiwi-bird",
      					url: "private",
      					maximumNumberOfDays: 7,
      				},
      			]
      		}
      	},
      
      
      	{
      		module: "MMM-RandomPhoto",
      		position: "fullscreen_below",
      		config: {
      			url: ['http://localhost/getPhoto.php'],
      			updateInterval:60
      		}
      	},
      	{
      		module: "currentweather",
      		position: "top_right",
      		config: {
      			units: "imperial",
      			location: "Home",
      			locationID: "private",  //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
      			appid: "private"
      		}
      	},
      	{
      		module: "weatherforecast",
      		position: "top_right",
      		header: "Weather Forecast",
      		config: {
      			location: "Home",
      			locationID: "private",  //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
      			appid: "private"
      		}
      	},
      	{
      		disabled: false,
      		module: "MMM-PilotWX",
      		position:"bottom_left",
      		config: {
      			ICAO: "private",
      			colorCode: "Alternative",
      			mode: "Static",
      			sym: "@",
      			tempUnits: "C",
      			measure: "SM",
      			time: "Local",
      			maxWidth:"100%",
      			useAltHeader:true,
      			header: "Conditions",
      		}
      	},
      	{
      		module: "MMM-Sonos",
      		position: "bottom_right",
      		config: {
      			showStoppedRoom: false,
      			showRoomName: false,
      		}
      	},
      ]
      

      };

      Additional Notes: I have isolated every module to make sure that adding the image rotation modules is in fact the cause of the issue. I though for sure it was a resources issue, but then I upgraded from the pi3 to the 4 and that hasn’t helped. In fact, it almost seems to have gotten worse. I moved the images to a USB 3 SSD and that didn’t help. The php script is literally just picking a random photo from my hard drive and serving it as is. Is there something missing from these modules that they are leaking resources? I’ve been on the hunt casually for more than a year, but have really hit it hard the last two weeks and I’m just hitting a brick wall. Not sure where to look anymore. I love the platform. I’ve helped edit at least one module, I’m starting to write another, but I’m at a complete loss as to how to track down this problem. The wife wants a family dashboard with rotating pictures!! Help!

      1 Reply Last reply Reply Quote 0
      • hedmikH Offline
        hedmik
        last edited by

        I have the same problem…MM runs a couple seconds up to minutes and hours…
        I’ve also tried to remove more or less everything from config file but with no success.
        I’m using one RP4 4GB and two RP4 2GB with the same config.
        What i’ve found out is that if i restart mm at the same time they almost die at the same time…could there be some kind of network/integration problem that is not taking care of errors making MM to die/hang?

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

          adding the line below to MagicMirror/js/electron.js has helped for me

          function createWindow() {
          	app.commandLine.appendSwitch("autoplay-policy", "no-user-gesture-required");
          	app.commandLine.appendSwitch('disable-http-cache');  // < ---- add this line
          	var electronOptionsDefaults = {
          

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          hedmikH 1 Reply Last reply Reply Quote 0
          • hedmikH Offline
            hedmik @sdetweil
            last edited by

            @sdetweil thanks for reaching out!
            I’ve made the change you proposed but MM hangs again :-(
            What i can see from MagicMirror-error.log is this:

            [21:32:49.843] [ERROR] (node:6386) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.

            Below the MagicMirror-out.log:

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

            [21:32:45.141] [LOG] Starting MagicMirror: v2.10.0
            [21:32:45.149] [LOG] Loading config …
            [21:32:45.155] [LOG] Loading module helpers …
            [21:32:45.157] [LOG] No helper found for module: alert.
            [21:32:45.196] [LOG] Initializing new module helper …
            [21:32:45.197] [LOG] Module helper loaded: updatenotification
            [21:32:45.198] [LOG] No helper found for module: clock.
            [21:32:45.566] [LOG] Initializing new module helper …
            [21:32:45.567] [LOG] Module helper loaded: MMM-SystemStats
            [21:32:45.626] [LOG] Initializing new module helper …
            [21:32:45.626] [LOG] Module helper loaded: MMM-Remote-Control
            [21:32:46.275] [LOG] Initializing new module helper …
            [21:32:46.277] [LOG] Module helper loaded: MMM-Vasttrafik-PublicTransport
            [21:32:46.278] [LOG] No helper found for module: currentweather.
            [21:32:46.278] [LOG] No helper found for module: weatherforecast.
            [21:32:46.305] [LOG] Initializing new module helper …
            [21:32:46.305] [LOG] Module helper loaded: MMM-telldusLive
            [21:32:46.733] [LOG] Initializing new module helper …
            [21:32:46.734] [LOG] Module helper loaded: MMM-NowPlayingOnSpotify
            [21:32:46.737] [LOG] Initializing new module helper …
            [21:32:46.737] [LOG] Module helper loaded: MMM-SolarEdge
            [21:32:46.738] [LOG] No helper found for module: compliments.
            [21:32:46.738] [LOG] All module helpers loaded.
            [21:32:46.739] [LOG] Starting server on port 8080 …
            [21:32:46.745] [INFO] You’re using a full whitelist configuration to allow for all IPs
            [21:32:46.753] [LOG] Server started …
            [21:32:46.754] [LOG] Connecting socket for: updatenotification
            [21:32:46.755] [LOG] Connecting socket for: MMM-SystemStats
            [21:32:46.755] [LOG] Connecting socket for: MMM-Remote-Control
            [21:32:46.756] [LOG] Starting node helper for: MMM-Remote-Control
            [21:32:46.763] [LOG] Connecting socket for: MMM-Vasttrafik-PublicTransport
            [21:32:46.776] [LOG] 21:32:46 MMM-Vasttrafik-PublicTransport: Starting helper: MMM-Vasttrafik-PublicTransport
            [21:32:46.777] [LOG] Connecting socket for: MMM-telldusLive
            [21:32:46.777] [LOG] Connecting socket for: MMM-NowPlayingOnSpotify
            [21:32:46.778] [LOG] Connecting socket for: MMM-SolarEdge
            [21:32:46.779] [LOG] Starting node helper: MMM-SolarEdge
            [21:32:46.779] [LOG] Sockets connected & modules started …
            [21:32:46.915] [LOG] Launching application.
            [21:32:49.759] [LOG] 21:32:49 MMM-Vasttrafik-PublicTransport: socketNotificationReceived
            [21:32:49.761] [LOG] 21:32:49 MMM-Vasttrafik-PublicTransport: CONFIG event received
            [21:32:49.780] [LOG] Telldus config received!
            [21:32:49.780] [LOG] Telldus sent fetch
            [21:32:49.834] [LOG] Notification: GET_SOLAR Payload: [object Object]
            [21:32:50.089] [LOG] Refreshed access token because it has expired. Expired at: 21:32:49 now is: 21:32:50
            [21:40:06.915] [LOG]

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

              look at

              free -m

              u may need to increase swap space u have a bunch of stuff running
              https://wpitchoune.net/tricks/raspberry_pi3_increase_swap_size.html

              also, open the developers window, ctrl-shift-i on the keyboard, select the tab labeled ‘console’ and scroll up, looking for any errors (usually red text)… or any other errors reported

              the terminal window messages are from the module node_helpers
              the dev window are from the modules main file (we call it the modulename.js as its name matches the module name)

              no single place collects it all

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              hedmikH 1 Reply Last reply Reply Quote 0
              • hedmikH Offline
                hedmik @sdetweil
                last edited by

                @sdetweil I have lot of free memory, no swap at all what i can see :-)
                But i found theese errors in the console (maybe hard to tell why…):

                • Refused to apply style from ‘http://raspberrypi4:8080/css/custom.css’ because its MIME type (‘text/html’) is not a supported stylesheet MIME type, and strict MIME checking is enabled.
                • loader.js:203 Error on loading stylesheet: css/custom.css
                  stylesheet.onerror @ loader.js:203
                • TypeError: Cannot read property ‘split’ of undefined
                  at Class.getDom (compliments.js:176)
                  at main.js:112
                  at new Promise ()
                  at updateDom (main.js:111)
                  at main.js:55
                  at Array.forEach ()
                  at createDomObjects (main.js:24)
                  at Object.modulesStarted (main.js:476)
                  at startModules (loader.js:59)
                  at loader.js:40
                • Failed to load resource: the server responded with a status of 401 (Unauthorized)
                • Refused to apply style from ‘http://raspberrypi4:8080/css/custom.css’ because its MIME type (‘text/html’) is not a supported stylesheet MIME type, and strict MIME checking is enabled.
                S 1 Reply Last reply Reply Quote 0
                • S Offline
                  sdetweil @hedmik
                  last edited by sdetweil

                  @hedmik said in Unable to determine reason for MM/electron decaying/dying/hanging:

                  TypeError: Cannot read property ‘split’ of undefined

                  do you have a custom compliments configuration?

                  this is part of a fix I put in for compliments with embedded ‘\n’ newline characters

                  but the code said that it came up with no compliment to use from the list of morning/afternoon/evening/anytime configured compliments

                  if u want to turn that module off, then add
                  disabled: true,

                  to its config entry (after module: ‘compliments’,)

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  hedmikH 1 Reply Last reply Reply Quote 0
                  • hedmikH Offline
                    hedmik @sdetweil
                    last edited by

                    @sdetweil Hi again, and i’m very grateful for you helping me out :-)
                    Yes, i have both the standard and also a custom compliments module and by turning that custome module off MM is still running since one hour!!!
                    I’m so happy back on track again (cross my fingers) :-)
                    I will now focus on enhancing MMM-Telldus and MMM-Vastrafik modules.
                    I’ve also seen nice enhancements made for Weather forcast module (more descriptive text and translated to Swedish). Hope to get those enhancements otherwise i’ll do it mysfelf.
                    I’m also planning to develop a module for Engage (showing electricity consumption within the household).
                    Once again, big thanks!

                    S 2 Replies Last reply Reply Quote 0
                    • S Offline
                      sdetweil @hedmik
                      last edited by

                      @hedmik said in Unable to determine reason for MM/electron decaying/dying/hanging:

                      Yes, i have both the standard and also a custom compliments module and by turning that custome module off MM is still running since one hour!!!

                      fantastic…!!

                      it might be a mispelling or something but it can’t find ANY actual compliment text…

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      M 1 Reply Last reply Reply Quote 0
                      • M Offline
                        max64 @sdetweil
                        last edited by

                        @sdetweil
                        What exactly do you mean by a “custom compliments module”? I am using the default “compliments” module but with “remoteFile” for the quotes. Is that what you are referring to as “custom”?

                        Since upgrading from a Pi Zero W running Stretch, I have been having the same issues as both of you (RP3B+/Buster/Latest MM/and then did the Electron upgrade to electron@6.0.12 as mentioned in the updated installation documentation).

                        When running MMM-BackgroundSlideshow on Zero before I would occasionally get race events, so I recently moved to RP3 with a fresh install, and I turned on “transitions” between photos as I thought the beefier CPU would handle it. But it would hang after a while and I’ve been trying to diagnose ever sense. I’ve set “transitions” back to false and the Pi still hangs. I’ve increased swap. I’ve increased GPU mem. Tracked with nmon, and except for the occasional CPU wait% going up every once in a while, I was never low on memory or disk.

                        I just happened to run across this thread and it seems almost exactly the same issues.

                        I’m slowly adding back in all the modules and will now put back in MMM-BackgroundSlideshow before adding compliments. I really never thought one of the default modules would be the issue. I actually thought it was some incompatibility between Buster and Electron.

                        I’ll report my findings.

                        S M 2 Replies Last reply Reply Quote 0
                        • 1
                        • 2
                        • 1 / 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