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.

    "Out of memory" issues - where do I begin?

    Scheduled Pinned Locked Moved Solved Troubleshooting
    65 Posts 2 Posters 27.1k Views 2 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.
    • S Offline
      sdetweil @ember1205
      last edited by sdetweil

      @ember1205 the only way I have found to prevent caching is the startup parm,

      there is another way, but I haven’t been able to make it work in MagicMirror

      const { webFrame } = require(‘electron’)

      and then, periodically
      webFrame.clearCache();
      https://discuss.atom.io/t/single-page-application-show-image-use-too-much-ram/18722

      BUT… this won’t work in a node helper, and I haven’t found a way to get access to electron in the module.js (as there are no requires() allowed)

      I do have this working in a different mirror runtime, and it does what I wanted.

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      1 Reply Last reply Reply Quote 0
      • E Offline
        ember1205
        last edited by

        I’m not sure that this is a caching error as it seems related very directly to the displaying of images but “rears up” differently based on the module. In the prior module I was using, displaying ANY graphical content lead to a quick demise of the system (within 15 minutes or so, typically). With the current module, everything was 100% fine until I cropped some of the images. The current module is one you are using with zero images, so there has to be something about the crop method I used that threw things out of whack.

        Even if it IS a straight-up caching issue, I can’t disable caching because the image display process looks poor. I’ve tried with caching disabled and it is not at all smooth, and I also haven’t tested that anywhere near enough to actually validate that it corrects anything.

        Is there a way for me to be able to at least understand the process in effect when this error gets thrown? The entry in the error log seems super generic with no real information along with it.

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

          @ember1205 i have been chasing these gremlins for the last 3 years without any real success.

          the addition of the call to webFrame.clearCache() has eliminated all my instability

          with the updated MMM-ImagePhotos you shouldn’t have any slow painting… as my code waits til the image is ready to show. I use it EVERY day on multiple systems and OS’s) , and don’t see any slow paint.

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          1 Reply Last reply Reply Quote 0
          • E Offline
            ember1205
            last edited by

            Turns out I’m wrong on two counts…

            1. I -have- been testing the caching disable extensively as it’s currently disabled. :)

            2. There is not a slow-paint issue for images with caching disabled.

            Unfortunately, I can now say that I’m pretty comfortable with the assessment of this NOT being a caching issue. With caching disabled for electron, the issue has now occurred multiple times in just the last 4-5 hours.

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

              @ember1205 s, I might try going thru each of the images u have adjusted with the electron browser on the pi and see what happens

              from a commandline

              cd ~/MagicMirror
              export DISPLAY=:0
              pi@raspberrypi4:~/MagicMirror $ node_modules/.bin/electron file://{url to pic}
              

              mine looked like (from my mounted server volume)

               node_modules/.bin/electron file:///media/buildserver/media/Photos/DCIM/2018\ vacation/Page\ Arizona/DSC_0323.JPG
              

              then close the browser, and use a different url

              now… we are running electron 3.0.13, which is quite old…
              you could try upgrading that to something newer… next version will use 6.0.12 (if my change is accepted)

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              1 Reply Last reply Reply Quote 0
              • E Offline
                ember1205
                last edited by

                What would I be looking for?

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

                  @ember1205 the browser having trouble, crashing maybe

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  1 Reply Last reply Reply Quote 0
                  • E Offline
                    ember1205
                    last edited by ember1205

                    I used an iterative command for this because there are so many photos:

                    cd ~MagicMirror
                    find < path to images >/* -exec node_modules/.bin/electron file:///{} \;
                    

                    For each file in that directory, it would launch the electron browser and open the image. Because electron continues to run until it is terminated, this puts one image at a time on the screen. After each one loaded, I would simply click “X” to close the browser and it would move on to the next image.

                    While I -did- see one specific image file appear to load but not actually show any content (initially), I believe this may have been an issue with the fact that I walked away from the process for about ten minutes. Expanding the browser window caused it to re-render and it displayed fine. Additionally, this is an image that I have personally seen on the screen many times with no apparent link to any crashes.

                    It seems that any image-specific issues are possibly cumulative since loading each one in turn starts with a fresh memory allocation as the browser exits after each image.

                    1 Reply Last reply Reply Quote 0
                    • E Offline
                      ember1205
                      last edited by

                      Thought I would update this…

                      Still broken.

                      I have the latest MM as a fresh install on a brand new RPi with a new power adapter, using a brand new SDCard, connected to a different monitor, using a different HDMI cable, and it’s all plugged in to an outlet at an entirely different house in a different area of the state (different sections of the grid). I have the same few, basic modules installed and have added the photos module discussed here. It crashes and hangs randomly with “out of memory” errors just like the other one.

                      The only thing the same between the two is the photo collection. I’ve not found any consistency in the past on it failing with any specific photos so troubleshooting this seems like it’s going to be impossible.

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

                        @ember1205 debugging is indeed very difficult w these problems.

                        I wonder if running w chromium browser would produce different results.

                        easiest way to test
                        download the run-start.sh script from here
                        https://github.com/sdetweil/MagicMirror_scripts
                        into the MagicMirror folder
                        edit the package.json and change the start command to

                        "start":"./run-start.sh",
                        

                        edit config.js
                        and set

                         serverOnly:"local",
                        

                        this will start mm in server mode, and use chromium to display instead of electron

                        Sam

                        How to add modules

                        learning how to use browser developers window for css changes

                        1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 3
                        • 4
                        • 5
                        • 6
                        • 7
                        • 4 / 7
                        • 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