MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    1. Home
    2. ember1205
    3. Posts
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.
    E Offline
    • Profile
    • Following 0
    • Followers 1
    • Topics 14
    • Posts 194
    • Groups 0

    Posts

    Recent Best Controversial
    • RE: "Out of memory" issues - where do I begin?

      @sdetweil I can appreciate that - I work for a software company, and know about inter-dependencies and the headaches they can cause.

      MM is, in a very basic sense, a web server. Electron is a web browser. There shouldn’t be inter-dependencies between a web server and browser, and that seems to be apparent with Chromium not having an issue running against the MM server. So, I would hope that Electron could be brought forward or at least Chromium be documented as an solid alternative.

      posted in Troubleshooting
      E
      ember1205
    • RE: "Out of memory" issues - where do I begin?

      UPDATE: At this point, I’m closing in on a full week of operating two mirrors without issue. I’ve changed to running Chromium instead of Electron and it’s working well all around. Here are some details of the operation in case it’s useful:

      • Pi 3 Model B (one UK, one China)
      • MM 2.12.0
      • Native modules configured: WeatherForecast, CurrentWeather (both weather modules set to different locations as the two Pi’s are in different locations), clock, calendar (2 instances, 2 different Google calendars), alert, updatenotification
      • Third-party modules: MMM-ImagesPhotos (@sdetweil version)
      • Customizations:
        • Modified the WeatherForecast module according to this thread to get 5 days of forecast data back after recent MM update: https://forum.magicmirror.builders/topic/13187/weatherforecast-showing-only-two-days/31?_=1601303807634
        • Converted to using Chromium instead of Electron locally as detailed in this thread
        • Chromium update / notice disabled via the step from a couple of posts prior to this one
        • Allow connections from local LAN addresses
      • Pi connected to a smart plug that turns on each day at 7AM, cron job to execute “init 0” each day at 11PM, smart plug turns off at 11:05PM

      Prior to successfully switching over to Chromium, the devices would crash at least once every other day (at least one of them would crash during a 48 hour window), although it was much more common to see each one crash multiple times per day. There was no consistency to which one would crash, why, when, etc. The “crash” in question was a black screen on the mirror and no visible info being output although the mouse cursor would sometimes appear. I wrote a cron job that would run every five minutes, look up the location of the pm2 error logs, check to see if there was an “out of memory” error in the log, and do a restart of MM if there was (the restart consisted of shut down, log flush, and start). This job ran every five minutes and would silently exit if there was no error as the mirror was running ok.

      Since the switchover, I have seen zero crashes on either device in almost seven days of operation.

      Electron has been discussed ad nauseum as having a variety of shortcomings, bugs, issues, etc. - especially in the old version being used with MM. At this point, I have to wonder why it’s still not only the default but the ‘only’ browser that’s really discussed for use with MM. It would seem that it’s time to either forklift an upgrade to it within MM or switch to something else (at a minimum, at least provide a well-documented alternative).

      I’m grateful to @sdetweil for his assistance with this, especially since it really took a calendar year almost to get to a point where it’s seemingly working as expected now.

      posted in Troubleshooting
      E
      ember1205
    • RE: "Out of memory" issues - where do I begin?

      I’m now about 2.5 days into two MM’s running without crashes using Chromium instead of Electron. I’ve also not seen a return of the pop up from Chromium about needing to be updated.

      For those that might need to correct the update issue, here’ s what I did on my mirrors:

      sudo touch /etc/chromium-browser/customizations/01-disable-update-check;echo CHROMIUM_FLAGS=\"\$\{CHROMIUM_FLAGS\} --check-for-update-interval=31536000\" | sudo tee /etc/chromium-browser/customizations/01-disable-update-check
      
      posted in Troubleshooting
      E
      ember1205
    • RE: weatherforecast showing only two days.

      Can anyone explain why the Free API from OpenWeatherMap shows 7 Day Forecast but the discussion here (and what I actually see) is only being able to retrieve 5 days?

      In looking at the documentation from the weather site, it appears that the URL should be constructed differently than how this weather module is building it out. Specifically, the URL should be something like:

      https://api.openweathermap.org/data/2.5/onecall?lat={lat}&lon={lon}&exclude={part}&appid={API key}
      

      But the URL is -actually- being built as:

      https://api.openweathermap.org/data/2.5/forecast?id={id}&appid={API key}
      

      It seems that the URL needs be different?

      posted in Troubleshooting
      E
      ember1205
    • RE: "Out of memory" issues - where do I begin?

      You can’t make this stuff up…

      Mirror has been running for a couple of hours now without crashing as it has been doing intermittently in the past. However, there is now a “pop up” on the screen stating that Chromium couldn’t be updated and that I’m missing out on features and fixes.

      I found what might be a fix in the way of potentially “configuring” Chromium to ignore updates, but I won’t know if this truly works until probably tomorrow at the earliest.

      posted in Troubleshooting
      E
      ember1205
    • RE: "Out of memory" issues - where do I begin?

      I simply opened the github page, copied the link, and used wget to download it to the mirror. So, it’s entirely possible that the way I downloaded it was partly to blame. Figured I would mention it because I’m likely not the only one that might run into this, and at a minimum it could become a troubleshooting step if others run into issues.

      posted in Troubleshooting
      E
      ember1205
    • RE: "Out of memory" issues - where do I begin?

      Based on the directions you gave in this thread, the run-start.sh script won’t work. I didn’t take the time to look through the github content to see if this is covered there, but you have to do

      chmod +x run-start.sh
      

      Or the script won’t actually execute. Based on old habits, I was executing the chmod statement without even thinking about it. But, after downloading the newest script, I purposefully left it untouched and it wouldn’t run.

      posted in Troubleshooting
      E
      ember1205
    • RE: "Out of memory" issues - where do I begin?

      Cool. I download the latest one and try it out.

      Glad I can help you keep improving your code! lol

      posted in Troubleshooting
      E
      ember1205
    • RE: "Out of memory" issues - where do I begin?

      One tweak to the run-start.sh script seems to have fixed it. I changed this line:

      serveronly=$(grep -v '^[[:blank:]]*//'  config/config.js | grep -i serveronly: | awk '{print tolower($2)}' | tr -d ,\"\'\\r)
      

      To this:

      serveronly=$(grep -v '^[[:blank:]]*//'  config/config.js | grep -i serveronly: | awk '{print tolower($1)}' | tr -d ,\"\'\\r)
      

      The awk command seems to have been looking for a variable that wasn’t being passed and by changing the variable number that it was looking for, it no longer starts electron and now starts chromium.

      posted in Troubleshooting
      E
      ember1205
    • RE: "Out of memory" issues - where do I begin?

      Welp…

      No change. System still crashes on the Pi using Chromium.

      In looking at the most recent core file, it’s still showing that electron is what’s faulting.

      There are no running processes of chromium and electron is still being started. Something is amiss with the configuration to where your run-start.sh script is either not being called or is not launching the correct browser for some reason.

      I’ve made no changes to run-start.sh, I’ve edited package.json so that this line is gone:

      "start": "DISPLAY=\"${DISPLAY:=:0}\" ./node_modules/.bin/electron js/electron.js",
      

      And has been replaced with this one:

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

      config/config.js has the following setting:

      var config = {
      	address: "0.0.0.0", 	// Address to listen on, can be:
      							// - "localhost", "127.0.0.1", "::1" to listen on loopback interfac
      e
      							// - another specific IPv4/6 to listen on a specific interface
      							// - "0.0.0.0", "::" to listen on any interface
      							// Default, when address config is left out or empty, is "localhost
      "
      	port: 8080,
      	basePath: "/", 	// The URL path where MagicMirror is hosted. If you are using a Reverse proxy
      					// you must set the sub path here. basePath must end with a /
      	ipWhitelist: ["127.0.0.1", "192.168.192.0/24", "::1"], 	// Set [] to allow all IP addresses
      															// 
      or add a specific IPv4 of 192.168.1.5 :
      															// 
      ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"],
      															// 
      or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format :
      															// 
      ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"],
      
      	useHttps: false, 		// Support HTTPS or not, default "false" will use HTTP
      	httpsPrivateKey: "", 	// HTTPS private key path, only require when useHttps is true
      	httpsCertificate: "", 	// HTTPS Certificate path, only require when useHttps is true
      
      	language: "en",
      	logLevel: ["INFO", "LOG", "WARN", "ERROR"],
      	timeFormat: 24,
      	units: "metric",
      	// serverOnly:  true/false/"local" ,
      	serverOnly:"local",
      
      posted in Troubleshooting
      E
      ember1205
    • RE: "Out of memory" issues - where do I begin?

      Good info.

      I’m interested to see how for the MM will make it now using Chromium instead of Electron. Since I have two with the same setup, I’ll set both to use Chromium for an additional level of testing it out.

      Why was Electron chosen as the browser up to this point? And, what potential downsides are there to Chromium?

      posted in Troubleshooting
      E
      ember1205
    • RE: "Out of memory" issues - where do I begin?

      I’ve made the change to Chromium - we’ll see how that does going forward.

      I do recall reading plenty about the severe lag of Electron in terms of the version that’s part of MM, so that part wasn’t “news” really. What I genuinely don’t understand is why this specific, basic configuration continues to have issues for me while Electron mostly does what it needs to do for so many others without creating this sort of problem.

      posted in Troubleshooting
      E
      ember1205
    • RE: "Out of memory" issues - where do I begin?

      I have confirmed that only Electron crashes on the Pi itself. The MM server does not experience any hiccups and remote browser connections remain functional.

      I at least now understand WHAT is crashing. Next steps might be to figure out WHY it’s crashing and potentially remedy it.

      posted in Troubleshooting
      E
      ember1205
    • RE: "Out of memory" issues - where do I begin?

      Hmmm. Not sure about other browsers since I had shut those down. I’ll wait until it crashes again and see if a secondary browser will keep running.

      posted in Troubleshooting
      E
      ember1205
    • RE: "Out of memory" issues - where do I begin?

      Well, it isn’t a LOT of progress, but it’s progress.

      It’s still crashing. But I managed to get a core dump. And it says that it’s Electron that’s crashing. The initial output from bt has me a little confused as I can’t tell if it didn’t load the symbol file correctly, or if the info just “unknown”. Here’s what I get from a bt command:

      Core was generated by `/home/pi/MagicMirror/node_modules/electron/dist/electron --type=renderer --auto'.
      Program terminated with signal SIGTRAP, Trace/breakpoint trap.
      #0  0x02760514 in ?? ()
      [Current thread is 1 (LWP 6298)]
      (gdb) bt
      #0  0x02760514 in ?? ()
      #1  0x027603d8 in ?? ()
      Backtrace stopped: previous frame identical to this frame (corrupt stack?)
      

      Not really sure if there’s anywhere to go from here. :/

      posted in Troubleshooting
      E
      ember1205
    • RE: "Out of memory" issues - where do I begin?

      So, the extra “stress” isn’t actually stress on the Pi at all?

      posted in Troubleshooting
      E
      ember1205
    • RE: "Out of memory" issues - where do I begin?

      Updated and restarted the MM process. I will keep the three browsers hitting it and wait and see if it errors out again. Sometimes, this can literally take days while other times it can occur multiple times in an hour.

      posted in Troubleshooting
      E
      ember1205
    • RE: "Out of memory" issues - where do I begin?

      should it be:

      img=null;
      

      ???

      posted in Troubleshooting
      E
      ember1205
    • RE: "Out of memory" issues - where do I begin?

      In my situation, the UI goes all black and the cursor appears (no mouse or keyboard connected). There’s a generic “out of memory” error entered into the log file. Restarting MM is the only way I’ve found to get it back up and running.

      The photo module I’m running is your fork with the more recent changes to allow the blurring of the same image behind the full-view image. Any thoughts on anything that could/should be added to try and capture more in the logs? Is there an increased logging level I could be using in MM itself? Stack traces when it fails? Before it fails? Anything come to mind that might give me a new avenue?

      The issue doesn’t seem to appear if I am not using the photo module. But, that could be because the other, more basic modules don’t use resources as intensively. We’ve compared notes on RPi, kernel, build, etc. and not found anything that seems to be materially different with the one exception being the specific image files in use.

      posted in Troubleshooting
      E
      ember1205
    • RE: "Out of memory" issues - where do I begin?

      By adding an external browser, it crashed in only a few minutes. I’m going to let it keep running with the additional external browser to see if it causes it crash much more quickly on a more continuous basis.

      If I can cause it to crash quickly on a repeated basis, it gives me an opportunity to try testing specific image files. It’s possible that this is a cumulative problem that is related to a small memory loss that gets added to on the load of additional errant files.

      UPDATE: So much for that theory… I am currently running Electron plus an external instance of Chrome on Windows and Safari on MacOS. No “quick crashes.”

      posted in Troubleshooting
      E
      ember1205
    • 1 / 1