jellyfin / jellyfin-kodi

Jellyfin Plugin for Kodi
https://jellyfin.org
GNU General Public License v3.0
845 stars 113 forks source link

Possible Memory Leak - Error On Startup #934

Open My-Random-Thoughts opened 2 days ago

My-Random-Thoughts commented 2 days ago

Describe the bug When starting Kodi the below error message is shown in the Kodi log file. After a few hours (4-6) kodi locks up and needs to be hard reset. Running on Raspberry Pi 4

To Reproduce Reboot/Start Kodi with JellyFin plugin

Expected behavior No memory leak or errors in the log file

Logs

2024-10-30 12:18:15.823 T:1110     info <general>: JELLYFIN -> INFO::jellyfin_kodi/jellyfin/__init__.py:98 ---[ START JELLYFINCLIENT ]---
2024-10-30 12:18:15.837 T:1110     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.connection_manager -> INFO::jellyfin_kodi/jellyfin/connection_manager.py:182 Begin connect
2024-10-30 12:18:15.841 T:1110     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.connection_manager -> INFO::jellyfin_kodi/jellyfin/connection_manager.py:58 Begin getAvailableServers
2024-10-30 12:18:18.674 T:1110     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.connection_manager -> INFO::jellyfin_kodi/jellyfin/connection_manager.py:244 Found Servers: []
2024-10-30 12:18:18.684 T:1110     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.connection_manager -> INFO::jellyfin_kodi/jellyfin/connection_manager.py:185 connect has 1 servers
2024-10-30 12:18:18.689 T:1110     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.connection_manager -> INFO::jellyfin_kodi/jellyfin/connection_manager.py:156 begin connectToServer
2024-10-30 12:18:18.701 T:1110     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.api -> INFO::jellyfin_kodi/jellyfin/api.py:434 Sending get request to system/info/public
2024-10-30 12:18:18.767 T:1110     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.connection_manager -> INFO::jellyfin_kodi/jellyfin/connection_manager.py:165 calling onSuccessfulConnection with server doc-jellyfin
2024-10-30 12:18:18.780 T:1110     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.api -> INFO::jellyfin_kodi/jellyfin/api.py:434 Sending get request to system/info
2024-10-30 12:18:18.855 T:1110     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.client -> INFO::jellyfin_kodi/jellyfin/client.py:57 User is authenticated.
2024-10-30 12:18:18.969 T:1112     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.ws_client -> INFO::jellyfin_kodi/jellyfin/ws_client.py:60 Websocket url: ws://{jellyfin-server}/socket?api_key={jellyfin-token}&device_id=1d340938-aff5-4765-b7dc-0cc8bd4a6d51
2024-10-30 12:18:18.995 T:1112     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.ws_client -> INFO::jellyfin_kodi/jellyfin/ws_client.py:80 --->[ websocket opened ]
2024-10-30 12:18:19.282 T:1114     info <general>: JELLYFIN.jellyfin_kodi.library -> INFO::jellyfin_kodi/library.py:85 --->[ library ]
2024-10-30 12:18:19.369 T:1110     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.http -> ERROR::jellyfin_kodi/jellyfin/http.py:131 500 Server Error: Internal Server Error for url: http://{jellyfin-server}/Sessions?DeviceId=1d340938-aff5-4765-b7dc-0cc8bd4a6d51
2024-10-30 12:18:19.380 T:1110     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.http -> ERROR::jellyfin_kodi/jellyfin/http.py:160 --[ 500 response ] 500 Server Error: Internal Server Error for url: http://{jellyfin-server}/Sessions?DeviceId=1d340938-aff5-4765-b7dc-0cc8bd4a6d51
2024-10-30 12:18:19.386 T:1110    error <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'TypeError'>
                                                   Error Contents: 'NoneType' object is not subscriptable
                                                   Traceback (most recent call last):
                                                     File "/storage/.kodi/addons/plugin.video.jellyfin/jellyfin_kodi/monitor.py", line 177, in onNotification
                                                       self.server_instance(data["ServerId"])
                                                     File "/storage/.kodi/addons/plugin.video.jellyfin/jellyfin_kodi/monitor.py", line 195, in server_instance
                                                       server.config.data["app.session"] = session[0]["Id"]
                                                                                           ~~~~~~~^^^
                                                   TypeError: 'NoneType' object is not subscriptable
                                                   -->End of Python script error report<--

2024-10-30 12:18:19.523 T:1114     info <general>: JELLYFIN.jellyfin_kodi.database -> INFO::jellyfin_kodi/database/__init__.py:162 Database locked in: /storage/.kodi/userdata/Database/MyVideos131.db
2024-10-30 12:18:19.588 T:1114     info <general>: JELLYFIN.jellyfin_kodi.database -> INFO::jellyfin_kodi/database/__init__.py:162 Database locked in: /storage/.kodi/userdata/Database/MyMusic83.db
2024-10-30 12:18:19.841 T:1056    error <general>: GetDirectory - Error getting library://music/albums.xml/
2024-10-30 12:18:20.155 T:1009     info <general>: Skipped 1 duplicate messages..
2024-10-30 12:18:20.155 T:1009     info <general>: VideoInfoScanner: Starting scan ..
2024-10-30 12:18:20.188 T:1110     info <general>: JELLYFIN.jellyfin_kodi.monitor -> INFO::jellyfin_kodi/monitor.py:42 -->[ kodi scan/video ]
2024-10-30 12:18:20.297 T:1009     info <general>: VideoInfoScanner: Finished scan. Scanning for video info took 155 ms
2024-10-30 12:18:20.312 T:1110     info <general>: JELLYFIN.jellyfin_kodi.monitor -> INFO::jellyfin_kodi/monitor.py:45 --<[ kodi scan/video ]
2024-10-30 12:18:20.949 T:1114     info <general>: JELLYFIN.jellyfin_kodi.objects.kodi.movies -> INFO::jellyfin_kodi/objects/kodi/movies.py:154 Starting migration for Omega database changes
2024-10-30 12:18:20.955 T:1114     info <general>: JELLYFIN.jellyfin_kodi.objects.kodi.movies -> INFO::jellyfin_kodi/objects/kodi/movies.py:164 Omega database migration is complete
2024-10-30 12:18:22.194 T:1114     info <general>: JELLYFIN.jellyfin_kodi.library -> INFO::jellyfin_kodi/library.py:466 --[ retrieve changes ] 2024-10-30T05:58:58z
2024-10-30 12:18:22.786 T:1114     info <general>: JELLYFIN.jellyfin_kodi.library -> INFO::jellyfin_kodi/library.py:432 --<[ retrieve changes ]

System (please complete the following information):

oddstr13 commented 2 days ago

No memory leaks there. That is just a generic message Kodi gives for unhandled errors in addon scripts.

Looks like files were not fully written to disk when you hard reset the Pi.

Session data looks to be empty, but other files that indicate that setup is done do exist.

Reset the jf4kodi settings and database, complete the setup wizard and initial sync, then safely close Kodi and reboot (no forced reset).

This should ensure all files are properly written to disk.

Random loss of files and data is an expected consequence of forced resets or power interruptions in any computer system.

My-Random-Thoughts commented 2 days ago

Thanks for the reply. I get that it's a generic reply, but I am observing an increase in RAM usage - whether it's this plugin or not. I have done all you have asked, but still getting the same error message in the logs.

2024-10-30 16:37:13.900 T:1035     info <general>: JELLYFIN.__main__ -> INFO::service.py:57 -->[ service ]
2024-10-30 16:37:13.907 T:1035     info <general>: JELLYFIN.__main__ -> INFO::service.py:58 Delay startup by 0 seconds.
2024-10-30 16:37:13.963 T:1100     info <general>: JELLYFIN.jellyfin_kodi.entrypoint.service -> INFO::jellyfin_kodi/entrypoint/service.py:76 --->>>[ JELLYFIN ]
2024-10-30 16:37:13.967 T:1100     info <general>: JELLYFIN.jellyfin_kodi.entrypoint.service -> INFO::jellyfin_kodi/entrypoint/service.py:77 Version: 1.0.5+py3
2024-10-30 16:37:13.974 T:1100     info <general>: JELLYFIN.jellyfin_kodi.entrypoint.service -> INFO::jellyfin_kodi/entrypoint/service.py:78 KODI Version: 21.1 (21.1.0) Git:21.1-Omega
2024-10-30 16:37:13.981 T:1100     info <general>: JELLYFIN.jellyfin_kodi.entrypoint.service -> INFO::jellyfin_kodi/entrypoint/service.py:79 Platform: LibreElec
2024-10-30 16:37:13.985 T:1100     info <general>: JELLYFIN.jellyfin_kodi.entrypoint.service -> INFO::jellyfin_kodi/entrypoint/service.py:80 Python Version: 3.11.9 (main, Aug 18 2024, 11:33:05) [GCC 13.2.0]
2024-10-30 16:37:13.995 T:1100     info <general>: JELLYFIN.jellyfin_kodi.entrypoint.service -> INFO::jellyfin_kodi/entrypoint/service.py:81 Using dynamic paths: True
2024-10-30 16:37:13.999 T:1100     info <general>: JELLYFIN.jellyfin_kodi.entrypoint.service -> INFO::jellyfin_kodi/entrypoint/service.py:82 Log Level: 1
2024-10-30 16:37:14.093 T:1101     info <general>: JELLYFIN.jellyfin_kodi.monitor -> INFO::jellyfin_kodi/monitor.py:350 --->[ listener ]
2024-10-30 16:37:14.097 T:1100     info <general>: JELLYFIN.jellyfin_kodi.connect -> INFO::jellyfin_kodi/connect.py:34 --[ server/default ]
2024-10-30 16:37:14.133 T:1100     info <general>: JELLYFIN -> INFO::jellyfin_kodi/jellyfin/__init__.py:98 ---[ START JELLYFINCLIENT ]---
2024-10-30 16:37:14.146 T:1100     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.connection_manager -> INFO::jellyfin_kodi/jellyfin/connection_manager.py:182 Begin connect
2024-10-30 16:37:14.150 T:1100     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.connection_manager -> INFO::jellyfin_kodi/jellyfin/connection_manager.py:58 Begin getAvailableServers
2024-10-30 16:37:16.847 T:1100     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.connection_manager -> INFO::jellyfin_kodi/jellyfin/connection_manager.py:244 Found Servers: []
2024-10-30 16:37:16.878 T:1100     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.connection_manager -> INFO::jellyfin_kodi/jellyfin/connection_manager.py:185 connect has 1 servers
2024-10-30 16:37:16.890 T:1100     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.connection_manager -> INFO::jellyfin_kodi/jellyfin/connection_manager.py:156 begin connectToServer
2024-10-30 16:37:16.910 T:1100     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.api -> INFO::jellyfin_kodi/jellyfin/api.py:434 Sending get request to system/info/public
2024-10-30 16:37:17.004 T:1100     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.connection_manager -> INFO::jellyfin_kodi/jellyfin/connection_manager.py:165 calling onSuccessfulConnection with server doc-jellyfin
2024-10-30 16:37:17.014 T:1100     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.api -> INFO::jellyfin_kodi/jellyfin/api.py:434 Sending get request to system/info
2024-10-30 16:37:17.121 T:1100     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.client -> INFO::jellyfin_kodi/jellyfin/client.py:57 User is authenticated.
2024-10-30 16:37:17.241 T:1102     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.ws_client -> INFO::jellyfin_kodi/jellyfin/ws_client.py:60 Websocket url: ws://{jellyfin-server}/socket?api_key={jellyfin-token}&device_id=1d340938-aff5-4765-b7dc-0cc8bd4a6d51
2024-10-30 16:37:17.273 T:1102     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.ws_client -> INFO::jellyfin_kodi/jellyfin/ws_client.py:80 --->[ websocket opened ]
2024-10-30 16:37:17.551 T:1104     info <general>: JELLYFIN.jellyfin_kodi.library -> INFO::jellyfin_kodi/library.py:85 --->[ library ]
2024-10-30 16:37:17.616 T:1100     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.http -> ERROR::jellyfin_kodi/jellyfin/http.py:131 500 Server Error: Internal Server Error for url: http://{jellyfin-server}/Sessions?DeviceId=1d340938-aff5-4765-b7dc-0cc8bd4a6d51
2024-10-30 16:37:17.637 T:1100     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.http -> ERROR::jellyfin_kodi/jellyfin/http.py:160 --[ 500 response ] 500 Server Error: Internal Server Error for url: http://{jellyfin-server}/Sessions?DeviceId=1d340938-aff5-4765-b7dc-0cc8bd4a6d51
2024-10-30 16:37:17.647 T:1100    error <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'TypeError'>
                                                   Error Contents: 'NoneType' object is not subscriptable
                                                   Traceback (most recent call last):
                                                     File "/storage/.kodi/addons/plugin.video.jellyfin/jellyfin_kodi/monitor.py", line 177, in onNotification
                                                       self.server_instance(data["ServerId"])
                                                     File "/storage/.kodi/addons/plugin.video.jellyfin/jellyfin_kodi/monitor.py", line 195, in server_instance
                                                       server.config.data["app.session"] = session[0]["Id"]
                                                                                           ~~~~~~~^^^
                                                   TypeError: 'NoneType' object is not subscriptable
                                                   -->End of Python script error report<--

2024-10-30 16:37:17.772 T:1104     info <general>: JELLYFIN.jellyfin_kodi.database -> INFO::jellyfin_kodi/database/__init__.py:162 Database locked in: /storage/.kodi/userdata/Database/MyVideos131.db
2024-10-30 16:37:17.823 T:1104     info <general>: JELLYFIN.jellyfin_kodi.database -> INFO::jellyfin_kodi/database/__init__.py:162 Database locked in: /storage/.kodi/userdata/Database/MyMusic83.db
2024-10-30 16:37:18.062 T:1004    error <general>: GetDirectory - Error getting library://music/albums.xml/
2024-10-30 16:37:18.387 T:1012     info <general>: Skipped 1 duplicate messages..
2024-10-30 16:37:18.387 T:1012     info <general>: VideoInfoScanner: Starting scan ..
2024-10-30 16:37:18.400 T:1012     info <general>: VideoInfoScanner: Finished scan. Scanning for video info took 25 ms
2024-10-30 16:37:18.483 T:1100     info <general>: JELLYFIN.jellyfin_kodi.monitor -> INFO::jellyfin_kodi/monitor.py:42 -->[ kodi scan/video ]
2024-10-30 16:37:18.488 T:1100     info <general>: JELLYFIN.jellyfin_kodi.monitor -> INFO::jellyfin_kodi/monitor.py:45 --<[ kodi scan/video ]
2024-10-30 16:37:18.750 T:1104     info <general>: JELLYFIN.jellyfin_kodi.objects.kodi.movies -> INFO::jellyfin_kodi/objects/kodi/movies.py:154 Starting migration for Omega database changes
2024-10-30 16:37:18.764 T:1104     info <general>: JELLYFIN.jellyfin_kodi.objects.kodi.movies -> INFO::jellyfin_kodi/objects/kodi/movies.py:164 Omega database migration is complete
2024-10-30 16:37:20.069 T:1104     info <general>: JELLYFIN.jellyfin_kodi.library -> INFO::jellyfin_kodi/library.py:466 --[ retrieve changes ] 2024-10-30T16:33:43z
2024-10-30 16:37:20.337 T:1104     info <general>: JELLYFIN.jellyfin_kodi.library -> INFO::jellyfin_kodi/library.py:432 --<[ retrieve changes ]