kolbyjack / MMM-Wallpaper

MagicMirror module to display wallpapers from various online sources
https://magicmirror.builders/
MIT License
99 stars 31 forks source link

Possible crashing MM? #5

Closed mlcampbe closed 5 years ago

mlcampbe commented 5 years ago

I have a suspicion that I am seeing the same problem as reported in issue #3. I have MMM-Wallpaper installed and on occasion I am seeing that the screen goes black and I have a core dump generated. I am seeing out of memory issues on at various times.

ATTENTION: default value of option force_s3tc_enable overridden by environment.
[16831:0413/111826.964220:FATAL:memory.cc(22)] Out of memory. size=79556608
ATTENTION: default value of option force_s3tc_enable overridden by environment.
ATTENTION: default value of option force_s3tc_enable overridden by environment.
[11331:0415/142933.736368:FATAL:memory.cc(22)] Out of memory. size=120422400
ATTENTION: default value of option force_s3tc_enable overridden by environment.
ATTENTION: default value of option force_s3tc_enable overridden by environment.
getrandom indicates that the entropy pool has not been initialized. Rather than continue with poor entropy, this process will block until entropy is available.
ATTENTION: default value of option force_s3tc_enable overridden by environment.
ATTENTION: default value of option force_s3tc_enable overridden by environment.
[1700:0415/233524.137869:FATAL:memory.cc(22)] Out of memory. size=96002048
ATTENTION: default value of option force_s3tc_enable overridden by environment.
ATTENTION: default value of option force_s3tc_enable overridden by environment.
ATTENTION: default value of option force_s3tc_enable overridden by environment.
[6522:0416/101829.273887:FATAL:memory.cc(22)] Out of memory. size=155766784
ATTENTION: default value of option force_s3tc_enable overridden by environment.

I'm not concerned about the force_s3tc_enable messages but the out of memory errors are crashing my MM and causing the black screen.

I have not 100% confirmed the issue is from MMM-WallPaper but I have the exact same error. I’m running a pi3B, and I believe it’s showing through electron not via browser.

In my case I am setting my source to "/r/EarthPort+unitedstatesofamerica".

Any ideas?

kolbyjack commented 5 years ago

This probably is the same issue as #3, the earthporn images are huge and take up a lot of memory. reddit's api does return alternate sizes for image posts, if I find the time, I'll look into adding support for them and loading the smallest size that's still at least as large as the screen in each dimension. Or you could open a PR for it.

mlcampbe commented 5 years ago

Does this only affect the earthporn reddit? I suspect not but I have changed my source to /r/LandscapePhotography+NaturePics+ITookAPicture+CampingandHiking and will see what happens.

kolbyjack commented 5 years ago

No, it's just that the earthporn subreddit is more likely to have very large images. /r/LandscapePhotography sounds like another one that's going to have big images, so I would expect to see the issue there too.

kolbyjack commented 5 years ago

I just pushed a change that may help, can you try it and report back?

mlcampbe commented 5 years ago

Sure will do but note it may be a day or 2 before I can say one way or another. I will reset my source to use only earthporn and let it run. I will report back once I have more info.

mlcampbe commented 5 years ago

So far so good but it is way too early to tell. However, I was reviewing the source and while I am no means a javascript programmer I wanted to ask about a potential problem I see. In MMM-Wallpaper.js in the getDom() function you create a wrapper div element and then use appendChild to add 2 images and a title. Is there any possibility that you are not clearing out the old elements on each call to getDom() (and garbage collection is not occurring) and thus over time the div just has a lot of entries appended to it thus filling memory?

That would not explain why the problem only occurs with the reddit source unless the other sources just use way smaller images and it would take a much longer time to use up the memory. Just a thought.

kolbyjack commented 5 years ago

MagicMirror's core handles replacing the old div with the new one generated by getDom(), so that's not going to be the issue.

mlcampbe commented 5 years ago

Like I said I'm not a programmer but thought it was worth a shot.

mlcampbe commented 5 years ago

Nope, still crashed on Friday afternoon. I took a look at your changes and they are focused on the variants in the reddit json output. However, very if any of the reddit entries even have a variant defined at all.

kolbyjack commented 5 years ago

Actually, try disabling crossfade in your config, I remember adding that to help with some crashes on my pi zero

mlcampbe commented 5 years ago

No still crashing even with the new changes and crossfade=false. For now I am going to remove earthporn from the source and go with some other subreddits and see if they fail or not.

mlcampbe commented 5 years ago

I've been using the module without the EarthPorn pictures for 10+ days and still no crash since then.

mlcampbe commented 5 years ago

Do you think that this might have to do with the setting for maximumEntries? I see you build a list of maximum entries but are you downloading all of them at one time? If so do you think that using a smaller value for maximumEntries would help?

kolbyjack commented 5 years ago

No, the most that would ever be loaded at once is two, during the crossfade time if crossfade is set to true. With that set to false, only one image should ever be loaded at a time. I really think it just comes down to the earthporn images being huge. The only other thing I can think of is to tweak the logic around choosing an alternate size, and just have a maximum size allowed instead of choosing the smallest size that still covers the whole screen. If I get some time, I'll try to put something on a branch for you to try

On Fri, May 10, 2019 at 11:33 AM Mike Campbell notifications@github.com wrote:

Do you think that this might have to do with the setting for maximumEntries? I see you build a list of maximum entries but are you downloading all of them at one time? If so do you think that using a smaller value for maximumEntries would help?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kolbyjack/MMM-Wallpaper/issues/5#issuecomment-491331417, or mute the thread https://github.com/notifications/unsubscribe-auth/AACCGR6GCVUTEZCIVYFR4SDPUWIS3ANCNFSM4HGUW6PA .

kolbyjack commented 5 years ago

I've added maxWidth/maxHeight config settings, try updating and setting maxWidth: 1920 in your config, that should prevent the huge images from loading. Unfortunately, that will mean that anything larger than 1920 width will only load at a width of 1080, as that's the largest non-native variant reddit provides

mlcampbe commented 5 years ago

Ok I've updated and added the maxWidth setting. I presume I don't need to add maxHeight at all if I have the max width defined. I'll see what happens and let you know.

mlcampbe commented 5 years ago

so far so good and no crashes

kolbyjack commented 5 years ago

I'm going to go ahead and close this issue, then, go ahead and reopen it if it starts happening again, I guess

mlcampbe commented 5 years ago

Jon,

I’d have to say the problem is fixed. I’ve been running with EarthPorn as the only source for almost 10 days now and no crashes at all. Thanks for the hard work!


Mike Campbell mlcampbell@gmail.com

On May 15, 2019, at 7:09 PM, Jon Kolb notifications@github.com wrote:

Closed #5 https://github.com/kolbyjack/MMM-Wallpaper/issues/5.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kolbyjack/MMM-Wallpaper/issues/5?email_source=notifications&email_token=ADINDLK57LESM4TVTGY5CN3PVSQ3NA5CNFSM4HGUW6PKYY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGORPCJOVA#event-2344916820, or mute the thread https://github.com/notifications/unsubscribe-auth/ADINDLJRMKUWN4IIKKCD4EDPVSQ3NANCNFSM4HGUW6PA.