smb file listing cached
#1
Bug 
Version of Kodi: 16
Distribution and version: osmc 2016.02-04
What version of the Pi: RPi 3
Skin: confluence

Hello,

I've a USB hard drive connected to my internet router. Via SMB share I can access the files with Kodi. That worked for a long time without any issues.

Beginning with Kodi 16, I noticed that there are sometimes new files missing in the Kodi listing. It seems the listing is cached in some way. So when I copy new files to the USB drive, Kodi sometimes does not recognize them. A reboot sometimes fixes the problem, but not always. If that don't fix it, I have to "play around". Entering Directorys and accessing files in that share to somehow force a refresh. Very annoying :-(

The problem is very similar to: http://forum.kodi.tv/showthread.php?tid=218685
Only difference: I cannot tweak the samba configuration on my internet router. (and I also don't want to do that, because it worked fine for a long time before updating Kodi)

The debug log for the time I accessed a "cached" listing:

Code:
19:57:58 455.328003 T:1958240816   DEBUG: Keyboard: scancode: 0x1c, sym: 0x000d, unicode: 0x0000, modifier: 0x0
19:57:58 455.408447 T:1958240816   DEBUG: OnKey: return (0xf00d) pressed, action is Select
19:57:58 455.410370 T:1958240816   DEBUG: Activating window ID: 10025
19:57:59 455.656586 T:1958240816   DEBUG: ------ Window Deinit (Home.xml) ------
19:57:59 455.707001 T:1958240816   DEBUG: ------ Window Init (MyVideoNav.xml) ------
19:57:59 455.712555 T:1958240816   DEBUG: CGUIMediaWindow::GetDirectory (smb://FRITZ-NAS/FRITZ.NAS/USBHD/neues/)
19:57:59 455.712708 T:1958240816   DEBUG:   ParentPath = [smb://FRITZ-NAS/FRITZ.NAS/USBHD/neues/]
19:57:59 455.713593 T:1958240816   DEBUG: Loading items: 23, directory: smb://FRITZ-NAS/FRITZ.NAS/USBHD/neues/ sort method: 0, ascending: true
19:57:59 455.717865 T:1958240816   DEBUG: RunQuery took 1 ms for 40 items query: SELECT  files.strFilename, files.playCount,  bookmark.timeInSeconds, bookmark.totalTimeInSeconds FROM files  LEFT JOIN bookmark ON    files.idFile = bookmark.idFile AND bookmark.type = 1  WHERE files.idPath=1
19:57:59 455.723511 T:1734968304   DEBUG: Thread BackgroundLoader start, auto delete: false
19:58:00 457.250763 T:1734968304   DEBUG: Thread BackgroundLoader 1734968304 terminating

This is how it looks like when I get a "fresh" smb file listing:

Code:
20:31:45 2481.722412 T:1958240816   DEBUG: Keyboard: scancode: 0x1c, sym: 0x000d, unicode: 0x0000, modifier: 0x0
20:31:45 2481.911133 T:1958240816   DEBUG: OnKey: return (0xf00d) pressed, action is Select
20:31:45 2481.920410 T:1958240816   DEBUG: Activating window ID: 10025
20:31:45 2482.168457 T:1958240816   DEBUG: ------ Window Deinit (Home.xml) ------
20:31:45 2482.207275 T:1958240816   DEBUG: ------ Window Init (MyVideoNav.xml) ------
20:31:45 2482.211670 T:1958240816   DEBUG: CGUIMediaWindow::GetDirectory (sources://video/)
20:31:45 2482.211914 T:1958240816   DEBUG:   ParentPath = [sources://video/]
20:31:45 2482.217529 T:1625289712   DEBUG: Thread BackgroundLoader start, auto delete: false
20:31:45 2482.231201 T:1625289712   DEBUG: Thread BackgroundLoader 1625289712 terminating
20:31:46 2483.385498 T:1958240816   DEBUG: Keyboard: scancode: 0x6c, sym: 0x0112, unicode: 0x0000, modifier: 0x0
20:31:46 2483.385742 T:1958240816   DEBUG: OnKey: down (0xf081) pressed, action is Down
20:31:47 2483.635742 T:1958240816   DEBUG: Keyboard: scancode: 0x6c, sym: 0x0112, unicode: 0x0000, modifier: 0x0
20:31:47 2483.640137 T:1958240816   DEBUG: OnKey: down (0xf081) pressed, action is Down
20:31:49 2485.547119 T:1958240816   DEBUG: Keyboard: scancode: 0x1c, sym: 0x000d, unicode: 0x0000, modifier: 0x0
20:31:49 2485.666748 T:1958240816   DEBUG: OnKey: return (0xf00d) pressed, action is Select
20:31:49 2485.681641 T:1958240816   DEBUG: Clearing cached fileitems [smb://FRITZ-NAS/FRITZ.NAS/USBHD/neues/]
20:31:49 2485.682861 T:1958240816   DEBUG: CGUIMediaWindow::GetDirectory (smb://FRITZ-NAS/FRITZ.NAS/USBHD/neues/)
20:31:49 2485.682861 T:1958240816   DEBUG:   ParentPath = [sources://video/]
20:31:49 2486.158447 T:1958240816   DEBUG: RunQuery took 2 ms for 40 items query: SELECT  files.strFilename, files.playCount,  bookmark.timeInSeconds, bookmark.totalTimeInSeconds FROM files  LEFT JOIN bookmark ON    files.idFile = bookmark.idFile AND bookmark.type = 1  WHERE files.idPath=1
20:31:49 2486.169922 T:1625289712   DEBUG: Thread BackgroundLoader start, auto delete: false
20:31:50 2487.207275 T:1625289712   DEBUG: Thread BackgroundLoader 1625289712 terminating

I guess the interesting line is: "20:31:49 2485.681641 T:1958240816 DEBUG: Clearing cached fileitems [smb://FRITZ-NAS/FRITZ.NAS/USBHD/neues/]"

On the second successful try I used "Videos - Files - neues" to access the smb share, where on the first attemp I used the shortcut on my home screen.

Was there a change in Kodi 16 regarding caching remote content?

PS: I've basically the same issue with an addon I've written myself: http://forum.kodi.tv/showthread.php?tid=262422

Thanks in advance for any help/hints.

Casper
Reply
#2
Yep, directories are cached for performance reasons.
https://github.com/xbmc/xbmc/blob/master...yCache.cpp

The number of directories cached was increased from 10 to 50 in Jarvis
https://github.com/xbmc/xbmc/pull/8288

This is not a bug. If you don't like the behaviour then perhaps a request in the feature request forum.
Reply
#3
xbmcvfs.exists() no longer returns cached values or was it added back in jarvis?
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Help?
Reply
#4
Thank you for the fast reply popcornmix. I removed the "bug" label.

Is there a way to configure the limit maybe in advancedsettings or so? Or a other always working workaround?

Don't get me wrong, but I cannot imagine a case where someone wants a listing containing removed obsolet files or new ones missing.

Independently of that, I will follow your advice and open a feature request.
Reply
#5
(2016-03-14, 22:28)casperklein Wrote: Don't get me wrong, but I cannot imagine a case where someone wants a listing containing removed obsolet files or new ones missing.

Well if it is ten times faster to display the cached files when you are browsing through directories and you rarely change files while you are browsing then I can understand the reason.

There are some ways of accessing files without using the directory cache, but I'm not sure of the specifics.
Lunatixz may well be right about xbmcvfs.exists().
There have been a few changes to the cache lately, but my recollection is that they were to avoid the cache is specific cases, rather than to use the cache more.
Reply
#6
Thank you for clarification and your help!
Reply

Logout Mark Read Team Forum Stats Members Help
smb file listing cached0