crash on profile switch

Issue #22 open
Former user created an issue

Hello, I have two XBMC profiles. I have only configured spotify for my primary profile. When I switch profiles there is usually no problem but every time I switch back from my secondary profile to my primary one XBMC crashes. This is the last error trace I got:

14:43:45 T:7420 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<-- - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS! Error Type: <type 'exceptions.WindowsError'> Error Contents: exception: access violation reading 0x00000000 Traceback (most recent call last): File "C:\Users\player\AppData\Roaming\XBMC\addons\plugin.audio.spotlight\server_addon.py", line 26, in <module> Server().start_rpc_server() File "C:\Users\player\AppData\Roaming\XBMC\addons\plugin.audio.spotlight\spotlight\service\Server.py", line 43, in init self.set_up_session() File "C:\Users\player\AppData\Roaming\XBMC\addons\plugin.audio.spotlight\spotlight\service\Server.py", line 100, in set_up_session self.session = SessionFactory(callbacks, self.settings).create_session() File "C:\Users\player\AppData\Roaming\XBMC\addons\plugin.audio.spotlight\spotlight\service\session\SessionFactory.py", line 43, in create_session initially_unload_playlists=False, File "C:\Users\player\AppData\Roaming\XBMC\addons\plugin.audio.spotlight\resources\libs\PyspotifyCtypes-0.6-py2.4.egg\spotify\session.py", line 310, in init err = self.__session_interface.create(ctypes.byref(config), ctypes.byref(self.__session_struct)) File "C:\Users\player\AppData\Roaming\XBMC\addons\plugin.audio.spotlight\resources\libs\PyspotifyCtypes-0.6-py2.4.egg_spotify\session.py", line 130, in create )(*args) WindowsError: exception: access violation reading 0x00000000 -->End of Python script error report<--

Also both switching profile and shuting down XBMC seems to take significantly longer after installing spotilight so I suspect the plugin might not be shutting down properly, when told to do so by XBMC, leading to delays and XBMC probably kills the plugin in the end which can't be good.

Comments (3)

  1. Dariusz Biskup repo owner

    Too be honest I haven't tested it with profiles. I guess that libspotify session gets created twice or more. libspotify should get unloaded and session destroyed on shutdown or profile switch. Apparently, there is something wrong with this.

  2. graag

    AFAIU spotlight correctly creates and destroys libspotify sessions upon profile switches.

    However libspotify crashes when creating and destroying a session multiple times in a process lifetime. I've created a minimal test case based on spotlight code: https://gist.github.com/graag/93cd24fcb495a19cd205

    Therefore I've separated session creation into a background service started on XBMC launch. Upon XBMC profile login user is logged in using his/hers spotlight settings. So far I've not noticed any issues with this approach. Settings seem to be properly reloaded during profile change.

    The only problem I was not able to solve is that now all profiles are required to use the same xmlrpc server port number. I have no idea how to ask the server to reload its settings without sending a request over the http. It would be easier if XBMC would provide some mechanism to notify background services ...

    I've created a pull request #5. So that my implementation could be reviewed.

  3. Log in to comment