Profiles not exiting cleanly?
#1
I'm not sure if it's a bug or intended to work this way. I've discovered when switching profiles, Kodi does not return true for abortRequested() - Kodi monitor (it only does the first time, but then after it doesn't seem to).

Is there a cue we can use with the api, to know if the profile is being switched so we can cleanly terminate python code? This current issue causes threads to not terminate. The add-on is a service add-on and it's set to load with the profile:
Code:
<extension point="xbmc.service" library="service.py" start="login">
  </extension>

First profile switch, everything terminates as it should:
Code:
12:58:22 T:4712  NOTICE: -->Python Interpreter Initialized<--
13:00:25 T:3368  NOTICE: Previous line repeats 1 times.
13:00:25 T:3368  NOTICE: Arctic Zephyr Script --> shutdown requested !
13:00:25 T:3368  NOTICE: LibraryMonitor -> stop :  - stop called
13:00:25 T:3368  NOTICE: arctic zephyr helper version 1.0.9 stopped
13:00:26 T:3368 WARNING: CPythonInvoker(1, C:\Users\Corruption\AppData\Roaming\Kodi\addons\script.arctic.zephyr.helper\service.py): the python script "C:\Users\Corruption\AppData\Roaming\Kodi\addons\script.arctic.zephyr.helper\service.py" has left several classes in memory that we couldn't clean up. The classes include: class XBMCAddon::xbmcgui::Window
13:00:26 T:6320 WARNING: CPythonInvoker(4, C:\Users\Corruption\AppData\Roaming\Kodi\addons\service.skin.widgets\default.py): the python script "C:\Users\Corruption\AppData\Roaming\Kodi\addons\service.skin.widgets\default.py" has left several classes in memory that we couldn't clean up. The classes include: class XBMCAddon::xbmcgui::Window,class PythonBindings::XBMCAddon_xbmc_Player_Director,class PythonBindings::XBMCAddon_xbmc_Monitor_Director
13:00:27 T:2848 WARNING: CPythonInvoker(6, C:\Users\Corruption\AppData\Roaming\Kodi\addons\service.library.data.provider\service.py): the python script "C:\Users\Corruption\AppData\Roaming\Kodi\addons\service.library.data.provider\service.py" has left several classes in memory that we couldn't clean up. The classes include: class XBMCAddon::xbmcgui::Window,class PythonBindings::XBMCAddon_xbmc_Monitor_Director,class PythonBindings::XBMCAddon_xbmc_Player_Director
13:00:27 T:5312  NOTICE: EMBY WebSocketThread -> Stopping Client
13:00:27 T:3024  NOTICE: EMBY LibrarySync -> --- Library Sync Thread stopped ---
13:00:27 T:4896  NOTICE: EMBY WebSocketThread -> Error: tuple index out of range
13:00:27 T:5312  NOTICE: EMBY WebSocketThread -> Stopping Client : KeepRunning set to False
13:00:27 T:4896  NOTICE: EMBY WebSocketThread -> Thread Exited
13:00:27 T:5312  NOTICE: EMBY Service -> ======== STOP EMBY ========
13:00:27 T:7156  NOTICE: EMBY UserClient -> |---- UserClient Stopped ----|
13:00:27 T:5312 WARNING: CPythonInvoker(7, C:\Users\Corruption\AppData\Roaming\Kodi\addons\plugin.video.emby\service.py): the python script "C:\Users\Corruption\AppData\Roaming\Kodi\addons\plugin.video.emby\service.py" has left several classes in memory that we couldn't clean up. The classes include: class XBMCAddon::xbmcgui::Window,class XBMCAddon::xbmcgui::Window,class XBMCAddon::xbmcgui::Window,class XBMCAddon::xbmcgui::Window,class XBMCAddon::xbmcaddon::Addon,class XBMCAddon::xbmcaddon::Addon,class XBMCAddon::xbmcaddon::Addon,class XBMCAddon::xbmcaddon::Addon,class XBMCAddon::xbmcaddon::Addon,class XBMCAddon::xbmcaddon::Addon,class XBMCAddon::xbmcaddon::Addon,class XBMCAddon::xbmc::Player,class PythonBindings::XBMCAddon_xbmc_Monitor_Director,class PythonBindings::XBMCAddon_xbmc_Monitor_Director,class PythonBindings::XBMCAddon_xbmc_Monitor_Director
13:00:28 T:5464  NOTICE: script.tv.show.next.aired: ### abort requested -- stopping background processing
13:00:28 T:6336  NOTICE: ES: Stopping event server
13:00:28 T:6336  NOTICE: Webserver: Stopping...
13:00:28 T:6336  NOTICE: WebServer: Stopped the webserver
13:00:28 T:6336  NOTICE: Webserver: Stopped...
13:00:29 T:3980  NOTICE: ES: UDP Event server stopped
13:00:29 T:6336  NOTICE: special://profile/ is mapped to: special://masterprofile/profiles/Angel-Remote/
13:00:29 T:6336  NOTICE: No settings file to load (special://xbmc/system/advancedsettings.xml)
13:00:29 T:6336  NOTICE: Loaded settings file from special://masterprofile/advancedsettings.xml
13:00:29 T:6336  NOTICE: Contents of special://masterprofile/advancedsettings.xml are...
                                            <advancedsettings>
                                              <videolibrary>
                                                <allitemsonbottom>true</allitemsonbottom>
                                              </videolibrary>
                                              <fanartres>1080</fanartres>
                                              <imageres>1080</imageres>
                                            </advancedsettings>

Second profile switch, abortrequested() didn't return True, leaving threads/connections running:
Code:
13:03:28 T:5424  NOTICE: EMBY WriteKodiVideoDB -> Found embyId: 98b3128a753b35efb2106c8457d91aca in database - kodiId: 388 fileId: 388 type: movie
13:03:28 T:5424  NOTICE: EMBY LibrarySync -> Sync Database, Incremental Sync Setting Last Run Time Saved: 2015-09-20T17:58:28Z
13:03:28 T:3448  NOTICE: Thread VideoInfoScanner start, auto delete: false
13:03:28 T:3448  NOTICE: VideoInfoScanner: Starting scan ..
13:03:28 T:3448  NOTICE: VideoInfoScanner: Finished scan. Scanning for video info took 00:00
13:03:28 T:5180  NOTICE: Thread BackgroundLoader start, auto delete: false
13:03:37 T:6336  NOTICE: Previous line repeats 2 times.
13:03:37 T:6336  NOTICE: ES: Stopping event server
13:03:37 T:6336  NOTICE: Webserver: Stopping...
13:03:37 T:6336  NOTICE: WebServer: Stopped the webserver
13:03:37 T:6336  NOTICE: Webserver: Stopped...
13:03:37 T:2740  NOTICE: ES: UDP Event server stopped
13:03:37 T:6336  NOTICE: special://profile/ is mapped to: special://masterprofile/
13:03:37 T:6336  NOTICE: No settings file to load (special://xbmc/system/advancedsettings.xml)
13:03:37 T:6336  NOTICE: Loaded settings file from special://profile/advancedsettings.xml
13:03:37 T:6336  NOTICE: Contents of special://profile/advancedsettings.xml are...
                                            <advancedsettings>
                                              <videolibrary>
                                                <allitemsonbottom>true</allitemsonbottom>
                                              </videolibrary>
                                              <fanartres>1080</fanartres>
                                              <imageres>1080</imageres>
                                            </advancedsettings>
Reply
#2
As a current workaround, I'm keeping track of the kodi profile the thread was loaded with. If it changes, the thread will auto exit. Seems like the initial profile Kodi loaded with, controls the abortRequested(). If any other profiles are loaded and logged off, they do not send out that message causing threads to keep running.

Hopefully someone will look into this. Smile
Reply
#3
I think I also stumbled over this some time ago, can you go ahead and add a ticket here: http://trac.kodi.tv/
Reply
#4
abortRequested() is when Kodi is shutting down and not when you switch a profile. imo not a bug but different expectation of what you think it does.

If first profile controls it then that is a bug.
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#5
Yea the first profile loaded into Kodi seems to control abortRequested(). When I switch to a different profile, all the threads are properly shut down. Then switching from second profile back to originally loaded profile does nothing and leaves everything running.

If I was to switch between the two profiles constantly, it just loads our add-on with a brand new instance and new threads, leaving the old ones running in an untouchable parrallel universe.

I will open a ticket, thanks for looking it. Smile

Ideally, I would think everytime a new profile is loaded should terminate any add-ons that are services, especially if they are supposed to load with the login method in addons.xml.

If it's a bug, that it triggers abortRequested(), then we need an api endpoint we can use for knowing when a new profile is loaded so we can terminate threads correctly add-on side.

Thank you both, I will link back the ticket here once opened.
Reply
#6
Here is the ticket I've opened, with full Kodi debug if you want to have a look: http://trac.kodi.tv/ticket/16280#ticket
Reply

Logout Mark Read Team Forum Stats Members Help
Profiles not exiting cleanly?0