Leanfront idle for backend shutdown? [solved]

For discussion of topics specific to MythTV on Android devices
Post Reply
Linuxgrrl
Junior
Posts: 63
Joined: Mon Oct 26, 2020 12:46 am
United States of America

Leanfront idle for backend shutdown? [solved]

Post by Linuxgrrl » Sun Feb 07, 2021 1:39 am

Hi,
I’ve been running Leanfront on a Fire Stick 4K and it’s really wonderful. It seamlessly handles all of the file formats that I’ve thrown at it. Unlike kodi it can jump and ff quickly with no hiccups, and live tv works great.
My backend no longer goes to sleep, though, and I think it’s because it views leanfront as a connected client even after I leave it and return to the main fire stick menu using the back key.

I tried forcing Leanfront to quit via adb, but that corrupted some MySQL tables so I won’t be doing that again. What is the correct way to handle this?
Last edited by Linuxgrrl on Mon Feb 08, 2021 10:04 pm, edited 1 time in total.

User avatar
jfabernathy
Senior
Posts: 355
Joined: Wed Feb 18, 2015 2:37 pm
United States of America

Re: Leanfront idle for backend shutdown?

Post by jfabernathy » Sun Feb 07, 2021 2:41 am

I have seen over the years a number of problems posted that were related to the backend going to sleep. I've rarely had a Linux system come out of Sleep correctly 100% of the time. So I never use sleep. In fact my backend/NAS server has not been off for at least a year. If my math is right my backend cost me $0.26/day in power.

User avatar
bill6502
Developer
Posts: 1871
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: Leanfront idle for backend shutdown?

Post by bill6502 » Sun Feb 07, 2021 2:58 am

Try: mythbackend --setverbose idle (on a running backend).

Look in the backend logs for a message containing:

Code: Select all

Blocking shutdown because of delay request from external application
mythbackend --setverbose idle:notice turns off the additional logging.

Leanfront has code that keeps the backend up while its running. It sends a
Services API message periodically that delays shutdown 5 minutes. I'd be sure
Leanfront has exited normally and wait 5 minutes. mythshutdown --check may
help as well (if there are other things holding the backend up).

Linuxgrrl
Junior
Posts: 63
Joined: Mon Oct 26, 2020 12:46 am
United States of America

Re: Leanfront idle for backend shutdown?

Post by Linuxgrrl » Sun Feb 07, 2021 12:22 pm

jfabernathy wrote:
Sun Feb 07, 2021 2:41 am
I have seen over the years a number of problems posted that were related to the backend going to sleep. I've rarely had a Linux system come out of Sleep correctly 100% of the time.
Fair enough. But you’ve gotta admit, when it *does* start and stop on cue, you feel pretty smart though right? :lol: I know I do.
mythbackend --setverbose idle:notice turns off the additional logging.

Leanfront has code that keeps the backend up while its running. It sends a
Services API message periodically that delays shutdown 5 minutes. I'd be sure
Leanfront has exited normally and wait 5 minutes

I will check the log message when my family wakes up. But I think my problem is more basic. When I ran the adb equivalent of “ps aux”, it showed leanfront as still running even after I exited using the back key. Is there a quit button somewhere that I am not seeing?

Linuxgrrl
Junior
Posts: 63
Joined: Mon Oct 26, 2020 12:46 am
United States of America

Re: Leanfront idle for backend shutdown?

Post by Linuxgrrl » Sun Feb 07, 2021 2:44 pm

Look in the backend logs for a message containing:

Code: Select all

Blocking shutdown because of delay request from external application
Confirming, yes, I do have that message in my log. Is there a way to fully close / shut down Leanfront when I'm not using it?

User avatar
pgbennett
Developer
Posts: 404
Joined: Mon Apr 27, 2015 5:41 pm
United States of America

Re: Leanfront idle for backend shutdown?

Post by pgbennett » Sun Feb 07, 2021 4:18 pm

If you repeatedly press return until it goes away, or press the home key, it is effectively shut down and will not keep the backend awake.

Leanfront will not send the keep awake messages to mythbackend when leanfront is not visible on screen. If there is some situation where it is doing that, please let me know. (Open a ticket in github).

Also if you have your TV CEC mode set to power off external devices when powering off or similar setting, when you power off the TV, leanfront will be sent to background, stopping the keep awake messages.

Please make sure you have the latest version of leanfront, as there were some changes recently in the way the wakeup messages are sent.

If you look at the mythbackend log, every 15 minutes on the 15 minute interval, it puts out a message as to why it is not shutting down. This will tell you what is really happening.

Note that in Android, applications that end are still "running" and will only be removed from memory when android needs the memory. This is not a problem, it is the way it is designed to work.

Linuxgrrl
Junior
Posts: 63
Joined: Mon Oct 26, 2020 12:46 am
United States of America

Re: Leanfront idle for backend shutdown?

Post by Linuxgrrl » Mon Feb 08, 2021 5:10 pm

Thank you for that explanation. I'm not sure what I was doing wrong before, but I was finally able to pry my family members off watching Leanfront and give it another test. As of this morning, auto shutdown of the backend is working normally and wake-on-lan is working also.
I really appreciate all the effort that went into making this terrific software!

User avatar
Steve Goodey
Moderator
Posts: 157
Joined: Fri Feb 07, 2014 6:30 pm
Location: Colchester, England
Great Britain

Re: Leanfront idle for backend shutdown?

Post by Steve Goodey » Mon Feb 08, 2021 8:16 pm

If you're happy with the fix could you possibly added [Solved] to the subject line in the first post?

Ta.
Don't forget the Wiki.

Post Reply