arnesongit / plugin.audio.tidal2

TIDAL music streaming addon for Kodi
GNU General Public License v3.0
31 stars 5 forks source link

Tidal2 slows Kodi down. Possible memory leak. #11

Closed ThreeDeeJay closed 1 year ago

ThreeDeeJay commented 1 year ago

Recently, I noticed Kodi's framerate would start dropping a lot, seemingly at random, so I checked Process Monitor and noticed this.

Procmon64_sTfzMjkAbG

Seems like something's sending Tidal2 into an infinite loop, even if it's disabled, but uninstalling it fixes the framedrops. Also, if I try quitting Kodi, it freezes, and if I close the window, the loop keeps Kodi running in the background so I have to use task manager to kill it completely.

The only relevant thing I saw in the log was this:

EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
 - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <class 'SystemExit'>
Traceback (most recent call last):
  File "C:\Users\PC\AppData\Roaming\Kodi\addons\plugin.audio.tidal2\resources\lib\tidal2\monitor.py", line 357, in onSettingsChanged
    self.settings = TidalConfig(tidal_addon=xbmcaddon.Addon(__addon_id__))
  File "C:\Users\PC\AppData\Roaming\Kodi\addons\plugin.audio.tidal2\resources\lib\tidal2\config.py", line 39, in __init__
    self.load()
  File "C:\Users\PC\AppData\Roaming\Kodi\addons\plugin.audio.tidal2\resources\lib\tidal2\config.py", line 83, in load
    self.handle_deprecated_settings()
  File "C:\Users\PC\AppData\Roaming\Kodi\addons\plugin.audio.tidal2\resources\lib\tidal2\config.py", line 166, in handle_deprecated_settings
    self.setSetting('dash_aac_mode', '1')
  File "C:\Users\PC\AppData\Roaming\Kodi\addons\plugin.audio.tidal2\resources\lib\tidal2\config.py", line 57, in setSetting
    self.addon.setSetting(setting, value)
SystemExit
-->End of Python script error report<--

I've barely even used the plugin and haven't even configured it with an account or anything. Also the readme only includes up to version 19 so perhaps the newer builds/python is what's causing it image

arnesongit commented 1 year ago

It seems that the function handle_deprecated_settings in the config.py file do a lot of setSettings calls that causes the CPU load. This function is only used to modify deprecated settings from older TIDAL2 versions. Please try to set the command "return" as the first command in the function handle_deprecated_settings. Let me know if this solves ths problem !

ThreeDeeJay commented 1 year ago

Thanks, the issue is now fixed! I was gonna submit a PR but then I realized this is just a temporary workaround, but here it is for anyone stumbling upon this issue https://github.com/ThreeDeeJay/plugin.audio.tidal2/commit/8ef1aa44d38dcb43c6821590d42629cdaece9456