hermanho / MMM-GooglePhotos

Display your photos on MagicMirror from Google Photos.
MIT License
170 stars 65 forks source link

MM freeze @UnhandledPromiseRejectionWarningls #107

Closed kritch83 closed 3 years ago

kritch83 commented 3 years ago

Sorry for the accidental early creation of this...

So I've been using the MMM-GooglePhotos module on one raspberry pi and it works great. I'm trying to setup another with the same setup and running into problems. What happens, once its all loaded, it may work for 20min or 2 hours but eventually the entire Magic Mirror UI freezes. I noticed my CPU utilization is at 100% while it is frozen. It looks like "electron" is using 100% of the cpu resources indifferently. I use PM2 and it indicates that the GooglePhotos module is having error every min until it freezes the MM UI and dominates the CPU. Here is the error that keeps getting triggered:

[12.04.2021 12:27.06.219] [ERROR] (node:858) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 51)

[12.04.2021 12:28.06.243] [ERROR] (node:858) UnhandledPromiseRejectionWarning: Error: Request failed with status code 400
    at createError (/home/pi/MagicMirror/modules/MMM-GooglePhotos/node_modules/axios/lib/core/createError.js:16:15)
    at settle (/home/pi/MagicMirror/modules/MMM-GooglePhotos/node_modules/axios/lib/core/settle.js:17:12)
    at IncomingMessage.handleStreamEnd (/home/pi/MagicMirror/modules/MMM-GooglePhotos/node_modules/axios/lib/adapters/http.js:236:11)
    at IncomingMessage.emit (events.js:327:22)
    at endReadableNT (_stream_readable.js:1220:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)`

When I restart the rpi it works again for awhile. Im thinking the error has to do with the fact my google photos, although different albums, are erroring when its trying to update? This error wont happen unless both Magic Mirrors are on at once. I'm using different OAuth keys so I would think this shouldn't be a problem. Also tried using different albums with no luck.

Any advice would be appreciated.

aneaville commented 3 years ago

How many photos are in your album? If your first raspberry pi is turned off, does your new unit run smoothly?

kritch83 commented 3 years ago

I have one sourcing a album containing 226 pictures, and the smaller screen one sourcing a 3 photo album. They both were using the same album as their source in the config but for testing I created another album with only 3 pictures in it and set one to that. It still is behaving the same though. Two days ago, I also completely wiped both rpis & started from scratch & only modified by apt upgrade, installed MM and its dependencies, pm2, and then the MMM-GooglePhotos plugin. Issue returned shortly after both started running online.

If your first raspberry pi is turned off, does your new unit run smoothly? What I have noticed, is that once the issue starts, regardless if one is off, the issue persists. If I go in and rerun the Google OAuth part, even keeping the same OAuth ID it will start working again as long as the other stays off. I'm waiting for one to crash to view the logs on it with only itself on.

Last night, I deleted one of the OAuth IDs and created a new one and reran the google setup and that rpi hasn't been having any issues today. Its been playing uninterrupted in my living room tv all day. The smaller screen one is still having issues. I just turned off the one that has been working all day and rebooted the smaller one to see if it will still have issues. its happening pretty often so will know fairly soon. Let me know if you want any log files or whatever.

aneaville commented 3 years ago

Were you able to get this working?

I'm curious if having the pi's use different 'user IDs' would help.

The status 400 response means 'bad request'. I'm wondering if they both try to scan at the same time, google can't tell the difference and deems it a 'bad request'.

If you turn debug: true in your config, there is some extra debug info that can help pinpoint which part is causing you issues: the album checking/ album scanning/ or refreshing of the pictures.

Sorry for the slow response..... almost 2 months.

aneaville commented 3 years ago

No response in quite awhile. I'm going to close the issue. If you still would like help, feel free to reopen.