Bug pvr.mythtv filehandle leak
#1
Been trying to track down an issue where the 'new' version of the mythtv plugin has been crashing/bugging out the OpenElec beta in random weird ways when enabled. Eventually tracked it down to random errors of this kind "Unable to load /usr/lib/kodi/system/ImageLib-arm.so, reason: /usr/lib/kodi/system/ImageLib-arm.so: cannot open shared object file: Too many open files" in the logs. (Logs on request if you need them.)

OpenElec has a pretty low per-process ulimit on files of 1024 due to embeded operation, and a quick check of lsof showed:
Code:
#lsof
[...]
780    /usr/lib/kodi/kodi.bin    /storage/.kodi/userdata/addon_data/pvr.mythtv/cache/fanart/1012_1396734960_000
780    /usr/lib/kodi/kodi.bin    /storage/.kodi/userdata/addon_data/pvr.mythtv/cache/coverart/1012_1397076960_000
780    /usr/lib/kodi/kodi.bin    /storage/.kodi/userdata/addon_data/pvr.mythtv/cache/fanart/1012_1397076960_000
780    /usr/lib/kodi/kodi.bin    /storage/.kodi/userdata/addon_data/pvr.mythtv/cache/coverart/1012_1410476160_000
780    /usr/lib/kodi/kodi.bin    /storage/.kodi/userdata/addon_data/pvr.mythtv/cache/fanart/1012_1410476160_000
780    /usr/lib/kodi/kodi.bin    /storage/.kodi/userdata/addon_data/pvr.mythtv/cache/coverart/1012_1411604760_000
780    /usr/lib/kodi/kodi.bin    /storage/.kodi/userdata/addon_data/pvr.mythtv/cache/fanart/1012_1411604760_000
780    /usr/lib/kodi/kodi.bin    /storage/.kodi/userdata/addon_data/pvr.mythtv/cache/coverart/1012_1412209560_000
780    /usr/lib/kodi/kodi.bin    /storage/.kodi/userdata/addon_data/pvr.mythtv/cache/fanart/1012_1412209560_000
780    /usr/lib/kodi/kodi.bin    /storage/.kodi/userdata/addon_data/pvr.mythtv/cache/coverart/1012_1412814960_000
780    /usr/lib/kodi/kodi.bin    /storage/.kodi/userdata/addon_data/pvr.mythtv/cache/fanart/1012_1412814960_000
[...]
#lsof | wc -l
1285

The obvious work around was to nerf the fanart and coverart cache directories to prevent the plugin creating and accessing those files, and that appears to work. However, this looks like a pretty serious bug that'll kill embedded clients, and cause performance issues on everything else.
Reply
#2
Hi,

I will check soon if all opened fileHandles are closed by the addon and let you know about. In normal case all are closed after been cached but maybe here caching fail. Is files are empty ? What is the version of the addon ?
Reply
#3
I checked using Kodi RC3 and "lsof | grep cache" returns nothing. Here i have 302 cached arts. I will review what happen if caching operation failed.
Reply
#4
Hi, so i checked leak when cache operation fails : arts or icon cannot to be downloaded from backend for obvious reason: missed file. And YES there is a leak. I fixed it with commit https://github.com/janbar/xbmc-pvr-addon...009c3fdb3f . But it will not merged with kodi release since team don't want any more update. So Kodi will live or die with this bug. You could build from my sources. Thanks.
Reply
#5
You can checkout last compiled version for RPI arm from my cloud: https://www.canneasucre.org/owncloud/pub...h=%2Fhelix
Reply
#6
Pretty sure that release freezes do are not supposed to apply to show-stopper/crash bugs, so you should submit this anyway and say it's a show-stopper/crash fix not a feature fix.
Reply
#7
as a "workaround" in openelec 5.0, we have increased the max file open limit for kodi. but this should be fixed in pvr.mythtv

EDIT: ah I see it xbmc-pvr-addons/pull/393 thanks @janbar
Reply
#8
(2014-12-18, 12:53)stefansaraev Wrote: as a "workaround" in openelec 5.0, we have increased the max file open limit for kodi. but this should be fixed in pvr.mythtv

EDIT: ah I see it xbmc-pvr-addons/pull/393 thanks @janbar

Hi, fix has been merged but too late: after kodi release ! So it is not included with kodi 14. Really you should clone from my repository instead: I could provide a new project including only pvr.mythtv like notspiff done for kodi-cmake.

EDIT: This is a pity for users. Testing rush starts with the first RC, but at this time our fix/improvement PR are refused. Drives me crazy. notspiff will save us ...
Reply

Logout Mark Read Team Forum Stats Members Help
pvr.mythtv filehandle leak0