Kodi - Windows PC shutdown
#1
Hi all,

Wonder if anybody else experience this and have any suggestions for troubleshooting:

Basically I want to shutdown my machine when I'm done, I can issue shutdown from Power menu or remotely through Web interface, in 90% of cases Kodi just exits and PC keeps running, sometimes it really did shutdown. I also use CEC adapter so TV/AVR going down as they supposed to. Log just showing this:

Code:
2024-08-08 00:36:37.494 T:5696 debug <general>: CMMNotificationClient::OnDeviceStateChanged: New device state is DEVICE_STATE_UNPLUGGED
2024-08-08 00:36:38.386 T:7976 debug <general>: ------ Window Init (DialogBusy.xml) ------
2024-08-08 00:36:38.386 T:9804 debug <general>: PERIPHERALS::CPeripheralCecAdapter:Tonguerocess - CEC adapter processor thread ended
2024-08-08 00:36:38.386 T:9804 debug <general>: Thread CECAdapter 9804 terminating
2024-08-08 00:36:38.387 T:9812 debug <general>: Thread PeripEventScan 9812 terminating
2024-08-08 00:36:38.387 T:9752 debug <general>: Thread PeripBusUSB 9752 terminating
2024-08-08 00:36:38.387 T:7836 info <general>: Shutdown Windows...
2024-08-08 00:36:38.387 T:9756 debug <general>: Thread PeripBusCEC 9756 terminating
2024-08-08 00:36:38.887 T:9760 debug <general>: Thread PeripBusAddon 9760 terminating
2024-08-08 00:36:39.387 T:7976 info <general>: unload skin
2024-08-08 00:36:39.388 T:7976 debug <general>: FreeVisualisation() done
2024-08-08 00:36:39.408 T:7976 debug <general>: ------ Window Deinit (DialogBusy.xml) ------
2024-08-08 00:36:39.411 T:7976 debug <general>: ------ Window Deinit (MyVideoNav.xml) ------
2024-08-08 00:36:39.411 T:7976 debug <general>: FreeVisualisation() done
2024-08-08 00:36:39.429 T:7976 info <general>: Skipped 1 duplicate messages..
2024-08-08 00:36:39.429 T:7976 debug <general>: CTextureBundleXBT::CloseBundle - Closed bundle
2024-08-08 00:36:40.108 T:7976 info <general>: Unloaded skin
2024-08-08 00:36:40.108 T:7976 debug <general>: DX:Big GrineviceResources::ReleaseBackBuffer: release buffers.
2024-08-08 00:36:40.661 T:7976 info <general>: unload sections
2024-08-08 00:36:40.673 T:7836 debug <general>: Thread CWin32PowerStateWorker 7836 terminating
2024-08-08 00:36:40.674 T:10924 debug <general>: Thread Timer 10924 terminating
2024-08-08 00:36:40.676 T:7976 debug <general>: CWinSystemWin32::RestoreDesktopResolution: restoring desktop resolution for 'QCQ95S #1'.
2024-08-08 00:36:40.676 T:7744 debug <general>: Thread RemoteControl 7744 terminating
2024-08-08 00:36:40.693 T:8528 debug <general>: Thread Announce 8528 terminating
2024-08-08 00:36:40.693 T:7976 info <general>: Exiting the application...

Don't have / don't use any addons, just latest Kodi install.
As a follow up question: I would happily just keep Kodi in Suspended state, which works, but when I wake up machine by any means Kodi is just hanging, it was like this from day one many versions ago, so I just gave up and start doing Shutdown.

Thank you for any suggestions,
K.
Reply
#2
Power off system in the Power menu works on my three Win PC (1 Win 10 Pro & 2 Win 11 Pro).
Reply
#3
(2024-08-09, 00:26)Pashator Wrote: Hi all,

Wonder if anybody else experience this and have any suggestions for troubleshooting:

Basically I want to shutdown my machine when I'm done, I can issue shutdown from Power menu or remotely through Web interface, in 90% of cases Kodi just exits and PC keeps running, sometimes it really did shutdown. I also use CEC adapter so TV/AVR going down as they supposed to. Log just showing this:

Code:
2024-08-08 00:36:37.494 T:5696 debug <general>: CMMNotificationClient::OnDeviceStateChanged: New device state is DEVICE_STATE_UNPLUGGED
2024-08-08 00:36:38.386 T:7976 debug <general>: ------ Window Init (DialogBusy.xml) ------
2024-08-08 00:36:38.386 T:9804 debug <general>: PERIPHERALS::CPeripheralCecAdapter:Tonguerocess - CEC adapter processor thread ended
2024-08-08 00:36:38.386 T:9804 debug <general>: Thread CECAdapter 9804 terminating
2024-08-08 00:36:38.387 T:9812 debug <general>: Thread PeripEventScan 9812 terminating
2024-08-08 00:36:38.387 T:9752 debug <general>: Thread PeripBusUSB 9752 terminating
2024-08-08 00:36:38.387 T:7836 info <general>: Shutdown Windows...
2024-08-08 00:36:38.387 T:9756 debug <general>: Thread PeripBusCEC 9756 terminating
2024-08-08 00:36:38.887 T:9760 debug <general>: Thread PeripBusAddon 9760 terminating
2024-08-08 00:36:39.387 T:7976 info <general>: unload skin
2024-08-08 00:36:39.388 T:7976 debug <general>: FreeVisualisation() done
2024-08-08 00:36:39.408 T:7976 debug <general>: ------ Window Deinit (DialogBusy.xml) ------
2024-08-08 00:36:39.411 T:7976 debug <general>: ------ Window Deinit (MyVideoNav.xml) ------
2024-08-08 00:36:39.411 T:7976 debug <general>: FreeVisualisation() done
2024-08-08 00:36:39.429 T:7976 info <general>: Skipped 1 duplicate messages..
2024-08-08 00:36:39.429 T:7976 debug <general>: CTextureBundleXBT::CloseBundle - Closed bundle
2024-08-08 00:36:40.108 T:7976 info <general>: Unloaded skin
2024-08-08 00:36:40.108 T:7976 debug <general>: DX:Big GrineviceResources::ReleaseBackBuffer: release buffers.
2024-08-08 00:36:40.661 T:7976 info <general>: unload sections
2024-08-08 00:36:40.673 T:7836 debug <general>: Thread CWin32PowerStateWorker 7836 terminating
2024-08-08 00:36:40.674 T:10924 debug <general>: Thread Timer 10924 terminating
2024-08-08 00:36:40.676 T:7976 debug <general>: CWinSystemWin32::RestoreDesktopResolution: restoring desktop resolution for 'QCQ95S #1'.
2024-08-08 00:36:40.676 T:7744 debug <general>: Thread RemoteControl 7744 terminating
2024-08-08 00:36:40.693 T:8528 debug <general>: Thread Announce 8528 terminating
2024-08-08 00:36:40.693 T:7976 info <general>: Exiting the application...

Don't have / don't use any addons, just latest Kodi install.
As a follow up question: I would happily just keep Kodi in Suspended state, which works, but when I wake up machine by any means Kodi is just hanging, it was like this from day one many versions ago, so I just gave up and start doing Shutdown.

Thank you for any suggestions,
K.
No I have not experienced the issue.

But you should provide the full debug log (wiki) as it lists the system hardware. - Do not post logs on this site, just link them-
The provided segment really does not tell much.
Reply
#4
Thanks, I'll capture another log today and post it. As for hardware there's really nothing special a bit old i5 / 16g memory, SSD, nvidia video, media is coming from the network, no streaming addons or anything else. The whole thing is that log saying "Shutting down" and after "Exiting" and machine stays up even when AVR and TV are off. I'll try to correlate Windows event to Shutdown.

K.
Reply
#5
After some weeks of troubleshooting I think I've finally pinpoint why my Kodi behaves like this, I have a CEC USB adapter connected to my media PC and I want to turn off TV and AVR when Kodi / MediaPC shutting down. As I understand the chain of things happening at shutdown:
1. Command issued - usually I do that remotely.
2. Kodi starts preparing for PC shutdown and send CEC command to turn AVR and TV off.
3. Video / Audio output device disappear, Kodi tries to perform re-detection and adjustments.
4. Some conflict between shutdown and re-detection, Kodi crashes never initiating PC shutdown.

Kodi log kind of confirms that, but I would be glad if somebody can have another look.
Kodi log

As soon as I turned off setting in CEC to turn off TV / AVR Kodi started to shutdown normally except of course not turning them off.
Judging that a lot of variables involved here I'm not sure this even can be fixed. Anyway would be glad if somebody with CEC perform the similar test to confirm my findings.

Thanks,
K.
Reply
#6
I'm sure you have tired this, but ensure your settings>system>power saving>shut down function if set for quit. (works for me).

Suspended mode is pretty much a crap shoot, given that Kodi uses the gfx engine extensively and how windows restores or not gfx memory, is the usual failure point. I have noted that if there is any process in the background still running, windows will not go down without human intervention. Is windows still operational after Kodi exits..? or do you see a Kodi screen?
Reply
#7
I have this exact same issue, but without the CEC problem. 

My system is controlled via Control 4 Home Automation. System powers up TV, AVR, sends WOL to PC to startup, auto runs Kodi - all good, up and running perfectly.

On Room Turn Off - TV goes off, AVR goes off,  the Kodi Shutdown signal is sent via JSON within the Kodi Control 4 Driver, Kodi commences the Shutdown process. Process is halted as for the reason above. The log shows the display is not detected, so Kodi, the program itself, just closes to the Windows desktop and the PC never shuts down.

If I leave the AVR and TV on, and activate the Kodi Shutdown directly through the Control 4 Driver (within Control 4 Composer Pro Software) using the drivers off functionality, it works perfectly.

So it is this re-detection of the display, or lack of display signal, that causes the proces to not complete and activate the Windows PC shutdown.
Reply
#8
(2024-11-11, 03:49)Rolly Wrote: I have this exact same issue, but without the CEC problem. 

My system is controlled via Control 4 Home Automation. System powers up TV, AVR, sends WOL to PC to startup, auto runs Kodi - all good, up and running perfectly.

On Room Turn Off - TV goes off, AVR goes off,  the Kodi Shutdown signal is sent via JSON within the Kodi Control 4 Driver, Kodi commences the Shutdown process. Process is halted as for the reason above. The log shows the display is not detected, so Kodi, the program itself, just closes to the Windows desktop and the PC never shuts down.

If I leave the AVR and TV on, and activate the Kodi Shutdown directly through the Control 4 Driver (within Control 4 Composer Pro Software) using the drivers off functionality, it works perfectly.

So it is this re-detection of the display, or lack of display signal, that causes the proces to not complete and activate the Windows PC shutdown.

are you reporting an issue you are trying to fix?

if yes, wouldn't the solution here to be put the kodi shutdown at the beginning of the command chain be the solution? instead of AVR, TV then Kodi?
assuming your setup is robust enough then perhaps simplify and allow Kodi to shut off the AVR+TV via CEC when it is commanded off via JSON

-----

i do such a thing, my primary device commands other devices via CEC i then command the primary device via automation
f.e. each week day my AVR+TV+Primary Device are all turned on at the time my alarm goes off, as well as pertinent lights so i don't have to stumble around
but the only thing commanded on in my home theater is my primary device which then commands the others on

at the same time i have an evening routine which does the opposite and shuts off the primary device which in turn turns off the AVR+TV, then certain lights off followed by lights commanded On which are pertinent to my end of day routine

all that is to say, automation is as robust as you make it but commands have to occur in order and some instances you can utilize other functionality (CEC) to control a group of devices with a single command so that everything works
Reply
#9
This is a bug in the Shutdown process of Kodi - simple. Kodi, for some reason, when it gets a Shutdown signal, doesn't pass the shutdown command to windows as it gets interrupted by the display not being available.
The home automation part is not as simple with Control 4 and encrypted drivers, when it comes to ordering shutdown of devices. Work-arounds for bugs in a program are just that - work-arounds.
If the bug didn't exist, there wouldn't be a problem.
Reply
#10
(2024-11-12, 00:55)Rolly Wrote: This is a bug in the Shutdown process of Kodi - simple. Kodi, for some reason, when it gets a Shutdown signal, doesn't pass the shutdown command to windows as it gets interrupted by the display not being available.
The home automation part is not as simple with Control 4 and encrypted drivers, when it comes to ordering shutdown of devices. Work-arounds for bugs in a program are just that - work-arounds.
If the bug didn't exist, there wouldn't be a problem.

i see, you want to report a bug

bug reports go on github - https://github.com/xbmc/xbmc/issues
Reply

Logout Mark Read Team Forum Stats Members Help
Kodi - Windows PC shutdown0