-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting "Block backend shutdown" not working #116
Comments
What is the backend version and the Kodi version ? When you enable the setting "Block backend shutdown", the plugin open the control connection with the backend and send the command "BLOCK_SHUTDOWN". The plugin send "ALLOW_SHUTDOWN" when kodi want to sleep after a period of inactivity, and the plugin should send again "BLOCK_SHUTDOWN" after the connection is restored. Also any disconnection (caused by network issue) will allow the backend to shutdown. |
~$ mythbackend --version Frontend version: Despite your description, I still don't understand what could be wrong. You say kodi want to sleep after a period of inactivity. In my case, Kodi is set to shutdown after 30 minutes of inactivity, but my issue is, that Kodi is not inactive, I'm using it to view/hear other things in other plugins, and still the backend goes to sleep despite the block backend shutdown being enabled. Do you mean to say, that the pvr plugin sends allow_shutdown to the backend after a period of not using the plugin (not Kodi in general)? Because then it would make sense what I'm seeing. |
Thanks - I will try to do some more debug logging and testing, and see if I can detect a pattern, and report back. |
Mine is working opposite of yours. I have block shutdown disabled, but the remote backend never shuts down unless I exit kodi. I just posted on kodi forums, but now that I see @janbar's detailed logging instructions I will try to produce a log. |
My log is too big to post to pastebin. If I launch it with the block shutdown setting disabled, I do not see any block_shutdown or allow_shutdown messages in the log. If I enable it, I immediately get:
And after 3 minutes of inactivity when the screen saver kicks on:
Does this indicate that the problem is with the backend? I do not see any messages in the backend log related to this, so I will have to restart it with debug logging enabled and check again. |
My logs were taken yesterday. I checked again and did not see these messages. However, while i have block backend shutdown enabled, things appear to behave correctly. Mythwelcome shows that it is idle when remote kodi is active. After the kodi screensaver turns on, the backend counts down for shutdown. Could it be that when block shutdown is disabled, the allow_shutdown is never being sent, so the backend defaults to blocking shutdown for that client? |
@knappster1 , currently if the setting "Block backend shudown" is disabled, I don't send the command "ALLOW_SHUTDOWN". I considered that the backend allowed shutdown by default. Seems it isn't the case regarding your feedback. |
I released the new version of the addon (5.10.7) which force "ALLOW_SHUTDOWN" on deactivating the gui of kodi, even if the setting "block shutdown" isn't checked. |
Ok, so i have tested some things now, and I actually cannot produce my problem as originally reported. I just sat through an entire cartoon movie on Plex with my daughter, without mythbackend going to sleep, so it seems to be blocked alright. So instead I think my problem might have to do with the allow_shutdown during kodi screensaver. So I always run with the block setting enabled, and that means as soon as my Kodi starts and MythPlugin connects, it sends the block_shutdown, and keeps my backend alive.
exiting Kodi screensaver, and the backend is again blocked from shutdown.
So if the allow_shutdown during Kodi screensaver is intended, it seems to work just fine. Maybe I can work around the problem by aligning the idle time of kodi and my backend, if it's a WOL issue. |
@Miwer, in 5.10.6 it appears that if you disable the block backend setting that it may actually block the shutdown until you exit kodi. @janbar appears to have changed this in 5.10.7, which I have not had an opportunity to test yet. However, if you want to prevent backend shutdown, couldn't you increase the kodi screensaver timer? Alternatively you might be able to create a script that sends a lock command to the backend before launching kodi and unlocking when kodi exits. |
@janbar, I am just waiting for the updated raspbian jessie binary to test this. I would be happy to compile it and test it in the meantime if you can point me in the right direction. I have a follow-up question, though. Whether the setting is enabled or disabled, what happens if kodi restarts (or I suppose this applies even if kodi does not restart and it just stays powered on) while the backend is offline? Will the allow_shutdown be sent when it reconnects or could we end up in a state where kodi tries to send the allow_shutdown command while the backend is offline and does not resend it when the backend comes back online and kodi reconnects? I ask because I recently had to shutdown kodi to get my backend to shutdown again, but everything works as expected most of the time and has worked again since then. I did not think to see what would happen if i just waited for the screensaver again instead of closing kodi... |
@knappster1 , the blocking shutdown is linked with a connection. When the connection is closed, the blocking is no longer enabled. So exiting kodi or sleeping kodi host or disconnecting network, will disable any blocking. |
@janbar thanks for working on this. It affects my systems too. Where should I get the update, as you mentioned you updated version to 5.10.7? If I press update plugin in my Kodi (XBian), it says it's already latest. It is actually 5.10.6 still. Did you just tag it in github, and I should clone it, or should I be able to get new version via GUI? |
Exciting. Now that I enabled the logging, backend all the sudden shuts down nicely. I keep my eye on it with logs for a while. Here's what it does when it works:
|
Currently I cannot test the MythTV feature because my backend is installed on my home file server and never shutdown automatically. IMO to test the backend sleeping, you should disable the addon option "Block backend shutdown", and then check your backend will shutdown when you no longer watch a live show or a recording. Finally if it works as intended you can enable the addon option that will block the shutdown when you keep activated kodi. Normally the addon will send the message "allow_shutdown" when kodi is inactivated or simply the connections will be closed when kodi will sleep or stop, that must allow the backend shutdown. |
@janbar I thought I would report that this still does not quite work as expected for me. I have "Block Backend Shutdown" disabled. It seems to work as expected if my backend is online when I power my kodi box on and/or enable pvr.mythtv on my kodi box. However, if kodi is running with pvr.mythtv enabled when my backend comes back online, it does not shutdown again until kodi is powered down, rebooted, or pvr.mythtv is disabled. My assumption is that since "allow_shutdown" was already sent from pvr.mythtv, it is not sent again when the backend turns off and back on. My workaround has been to add a cron job that disables pvr.mythtv each night and then I will manually enable it again when I want to use it (which could be days later). It's not a major concern for me, but as 8 months have passed and this issue is still open, I thought it worth reporting. The addon works quite well for me otherwise. |
Okay. So I have to recall the backend for allow_shutdown every time we reconnect. |
@janbar based on the behavior I'm experiencing I think that is correct. I don't believe that the mythbackend logs really have any useful information as to why it's behaving this way. My usage may be a unique case since others do not seem to be reporting the same thing. I don't expect you to invest a lot of time trying to fix this, particularly if there are any risks of breaking any other functionality. However, if you push out an update to resolve it, I will happily test it when it becomes available on libreelec. |
You are not alone. I just had a couple weeks of backend constantly on for sone reason. I only use mythtv plugin from Kodi as frontend. It worked for long though, but Now I use another Kodi occasionally, and shut it down often. So my behavior changed, which could bring the problem back. I can report back after holidays. |
I have to add the call here: pvr.mythtv/src/pvrclient-mythtv.cpp Line 307 in 2842043
|
That's weird... If the addon setting 'blockShutdown' is set to false then never the command block_shutdown will be sended to the backend and it should be allowed to shut because this is the default behavior for the backend. |
All about is explained here: https://www.mythtv.org/wiki/Idle_Screen The addon setting blockShutdown has no more effect since the addon connect as frontend (block shutdown is true by default). |
I will change the behavior of the setting blockshutdown, when false The addon will send allow_shutdown on connect and the backend will shutdown even the addon is active or kodi not idle (but not watching). |
After review the current code is right. The behavior is the same as MythFrontend. i.e the allow shutdown is effective only on idle screen. Under the hood we need an event to wake up the backend. This event is the gui becomes active. This is the reason why MythFrontend works like that and I made the same. |
One thing I missed is to allow shutdown again after the backend restart and kodi still in power saving mode. To fix that, I will change the setting 'blockShutdown' to the new one 'allowShutdown' (default = true, so you have nothing to change in the settings), and I will call again allow shutdown on reconnect if Kodi still in power saving mode. I think it will fix all the bugs declared in this issue. |
That is fixed now with the new releases:
The setting block_shutdown is replaced by allow_shutdown and the value is TRUE by default. Allow shutdown is send to the backend on idle state. The idle state is activated when the "screensaver" is activated. So you have to setup the screensaver in the Kodi setting, i.e enabling the black screen. I updated the help in the Kodi wiki: MythTV_PVR |
Thanks @janbar ! I will update it as soon as it becomes available on LibreELEC 😄 |
LibreELEC has not updated yet, but my raspbian box with pipplware repo updated and it is now working as expected for me. Thanks again! Kodi 18.5 |
Nice to heard :-) |
Hi,
I'm wondering if the setting "Block backend shutdown" is working as intended for anyone?
It is not working for me, and it is something that has always annoyed me over several versions of the MythTV plugin.
For example, if I start my kodi, it will WOL my backend, and I can usually start watching TV within seconds.
If I then stop watching TV, and go watch something from other addons, then my backend would usually go to sleep within 15 minutes (as it's setup to do, but only when no clients are connected). This is where I'd think that the setting "Block backend shutdown" would prevent this.
Instead, when I'm done watching other stuff, and want to watch TV again, the backend is sleeping, and the plugin fails to start TV with the "channel unavailable" message. I can then switch between channels (being "unavailable"), and stop/start Live TV a couple of times, before the plugin sends another WOL to wake the backend, before I can successfully start LiveTV.
Any thoughts on this?
The text was updated successfully, but these errors were encountered: