{"action":"created","issue":{"url":"https://api.github.com/repos/xbianonpi/xbian/issues/728","labels_url":"https://api.github.com/repos/xbianonpi/xbian/issues/728/labels{/name}","comments_url":"https://api.github.com/repos/xbianonpi/xbian/issues/728/comments","events_url":"https://api.github.com/repos/xbianonpi/xbian/issues/728/events","html_url":"https://github.com/xbianonpi/xbian/issues/728","id":76384655,"number":728,"title":"Upstart bridge fails when using profiles without autologin","user":{"login":"RabidArts","id":1357985,"avatar_url":"https://avatars.githubusercontent.com/u/1357985?v=3","gravatar_id":"","url":"https://api.github.com/users/RabidArts","html_url":"https://github.com/RabidArts","followers_url":"https://api.github.com/users/RabidArts/followers","following_url":"https://api.github.com/users/RabidArts/following{/other_user}","gists_url":"https://api.github.com/users/RabidArts/gists{/gist_id}","starred_url":"https://api.github.com/users/RabidArts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RabidArts/subscriptions","organizations_url":"https://api.github.com/users/RabidArts/orgs","repos_url":"https://api.github.com/users/RabidArts/repos","events_url":"https://api.github.com/users/RabidArts/events{/privacy}","received_events_url":"https://api.github.com/users/RabidArts/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-05-14T14:56:08Z","updated_at":"2015-05-28T17:19:45Z","closed_at":null,"body":"Hi all\r\n\r\nI had this situation with a kodi installation, specifically with profiles set up, and no auto-login.\r\n\r\nKodi would throw an error on startup (onscreen) saying that the xbian upstart bridge script failed.\r\nFollowing that, a number of other things in kodi are unstable - I would get random reboots.\r\nThis is likely due to memory leaks.\r\n\r\nI have already fixed the issue on my system, and am contributing the cause and solution to the community.\r\n\r\n# Investigation: #\r\n\r\nIn the kodi log (~/.kodi/temp/kodi/log) you will find that the upstart bridge script fails on line 119.\r\n\r\n## Example kodi log error: ##\r\n\r\n    ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--\r\n                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!\r\n                                            Error Type: <type 'exceptions.KeyError'>\r\n                                            Error Contents: ('result',)\r\n                                            Traceback (most recent call last):\r\n                                              File \"/usr/local/share/kodi/addons/script.service.xbian.upstart-bridge/service.py\", line 202, in <module>\r\n                                                service = UpstartBridge()\r\n                                              File \"/usr/local/share/kodi/addons/script.service.xbian.upstart-bridge/service.py\", line 20, in __init__\r\n                                                self.monitor = XBMCMonitor(self)\r\n                                              File \"/usr/local/share/kodi/addons/script.service.xbian.upstart-bridge/service.py\", line 120, in __init__\r\n                                                json_version = json_response['result']['version']\r\n                                            KeyError: ('result',)\r\n                                            -->End of Python script error report<--\r\n\r\nLooking on line 119 you find the following:\r\n\r\n\t\t# This should never fail\r\n        json_response = json.loads(xbmc.executeJSONRPC('{\"jsonrpc\": \"2.0\", \"id\": \"ApiVersion\", \"method\": \"JSONRPC.Version\"}'))\r\n        json_version = json_response['result']['version']\r\n        self.jsonrpc_api_ver = (json_version['major'], json_version['minor'], json_version['patch'])\r\n\r\nIf you log the return value from JSONRPC, you'll find that it says 'Method not found'\r\n\r\nBTW, the *This should never fail* comment really cracked me up.\r\nNice one **Anaconda**! :D (https://github.com/xbianonpi/xbian-package-upstart-xbmc-bridge/commit/de89836e2578ba4f1d18123bdba7d534e7df3b33)\r\n\r\n# **TL;DR: ** #\r\n\r\n# Cause: #\r\nThe JSON RPC service is not started when xbian starts, only once you log in.\r\nIf you have multiple profiles, well, you can guess the rest.\r\n\r\n# Solution: #\r\nChange the xbian upstart script to run on login, not on startup.\r\n\r\nHow, you say?\r\nsudo nano /usr/local/share/kodi/addons/script.service.xbian.upstart-bridge/addon.xml\r\nFind the line with:\r\n```\r\n     <extension point=\"xbmc.service\" library=\"service.py\" start=\"startup\"/>\r\n```\r\nReplace start=\"startup\" with start=\"login\"\r\nSave, reboot, celebrate, profit!\r\n\r\n# Confirmation: #\r\nI logged out the response from JSONRPC.Version in the xbian upstart script - result is:\r\nXBian XBMC-Upstart bridge: JSON RPC Version Response: { \" i d \" : \" A p i V e r s i o n \" , \" j s o n r p c \" : \" 2 . 0 \" , \" r e s u l t \" : { \" v e r s i o n \" : { \" m a j o r \" : 6 , \" m i n o r \" : 2 1 , \" p a t c h \" : 2 } } }\r\n"},"comment":{"url":"https://api.github.com/repos/xbianonpi/xbian/issues/comments/106502025","html_url":"https://github.com/xbianonpi/xbian/issues/728#issuecomment-106502025","issue_url":"https://api.github.com/repos/xbianonpi/xbian/issues/728","id":106502025,"user":{"login":"Smultie","id":3634003,"avatar_url":"https://avatars.githubusercontent.com/u/3634003?v=3","gravatar_id":"","url":"https://api.github.com/users/Smultie","html_url":"https://github.com/Smultie","followers_url":"https://api.github.com/users/Smultie/followers","following_url":"https://api.github.com/users/Smultie/following{/other_user}","gists_url":"https://api.github.com/users/Smultie/gists{/gist_id}","starred_url":"https://api.github.com/users/Smultie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Smultie/subscriptions","organizations_url":"https://api.github.com/users/Smultie/orgs","repos_url":"https://api.github.com/users/Smultie/repos","events_url":"https://api.github.com/users/Smultie/events{/privacy}","received_events_url":"https://api.github.com/users/Smultie/received_events","type":"User","site_admin":false},"created_at":"2015-05-28T17:19:45Z","updated_at":"2015-05-28T17:19:45Z","body":"Yeah, might be something I should've told you from the start; I'm running\nXBian on Jessie.\nhttp://apt1.xbian.org/pool/stable/rpi2-jessie/ and\nhttp://apt1.xbian.org/pool/staging/rpi2-jessie/\n\nOn Thu, May 28, 2015 at 7:10 PM, RabidArts <notifications@github.com> wrote:\n\n> Smultie:\n> I had a look at the code to work out where your problem is, but your\n> version of the usptart bridge addon appears to be quite different.\n> It's either custom-modified or very old - I cannot find your version\n> anywhere online.\n>\n> My advice - uninstall and reinstall the upstart bridge from the xbian\n> config dialog on ssh login.\n> But this is just my suggestion as an amateur - use at your own risk :)\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/xbianonpi/xbian/issues/728#issuecomment-106495752>.\n>\n"}}