Bug 15651 - Image Viewer crashes with thousands of files in the root of the storage media
: Image Viewer crashes with thousands of files in the root of the storage media
Status: CLOSED FIXED
Product: SB Controller
Classification: Unclassified
Component: Screensavers
: unspecified
: Other Ubuntu Linux
: P3 normal (vote)
: 7.5.0
Assigned To: Michael Herger
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-02-07 03:02 UTC by Mikkel Herold
Modified: 2010-04-08 17:26 UTC (History)
6 users (show)

See Also:
Category: ---


Attachments
Log file from Image Viewer when trying to view images from an SD card with 10.000+ images (56.76 KB, text/plain)
2010-02-22 13:51 UTC, Mikkel Herold
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mikkel Herold 2010-02-07 03:02:08 UTC
I am running the latest beta firmware on my SB Controller (7.5.0-r8462), and I have found out that the Image Viewer screensaver crashes when I try to make it show pictures from a 32GB SDHC card.

I have 10.000+ pictures on a card, but when I direct Image Viewer to it to show the images, the screen goes black for 5-10 seconds, and then the Controller reboots.

It works well with a 2GB SD card.
Comment 1 Chris Owens 2010-02-08 09:48:37 UTC
Do you know what filesystem is on that card by any chance?
Comment 2 Mikkel Herold 2010-02-08 11:54:56 UTC
(In reply to comment #1)
> Do you know what filesystem is on that card by any chance?

Yep, it's FAT32.
Comment 3 Chris Owens 2010-02-08 13:30:38 UTC
Felix, is this something you could look at?
Comment 4 Michael Herger 2010-02-08 21:22:09 UTC
FWIW: I've added an aritificial limitation to 1000 images. It wouldn't read more. But it's very likely you're still running out of memory. I mostly tested this on Touch. 

Can you monitor memory usage eg. running "top -d1" in a shell when you start the image viewer?
Comment 5 Michael Herger 2010-02-08 22:25:21 UTC
BTW: you didn't mention the number of files on the smaller card. Some more things we should check:

- would the same or similar amount of files on the smaller card crash too?
- would the large card with a smaller amount of files crash too?
- does it crash on a particular file? 
- would it still crash if you renamed the first few folders (assuming that renaming will change the order in which the images are displayed)?
- could you please create a /log folder on your SD card to have the device log to it instead of RAM - then upload the messages file

But this is definitely not a show stopper for 7.5/Touch
Comment 6 SVN Bot 2010-02-10 07:02:51 UTC
 == Auto-comment from SVN commit #8475 to the  repo by mherger ==
 == https://svn.slimdevices.com/?view=revision&revision=8475 ==

Bug: 15651
Description: log file to be displayed when using inserted media. This should help debugging crashes in the ImageViewer
Comment 7 Michael Herger 2010-02-10 07:06:37 UTC
Mikkel - I don't think this is due to the number of files or the SD card. I'd rather suspect the image being too big or something. I've added some more logging (in tomorrow's firmware, r8475 or later) which should show you what file it tries to display. If you haven't done so, please set the sort order in the ImageViewer settings to random. Does it still crash? Could you identify the problem picture, copy it to the other card and see whether it would still crash?

Tested with a Sandisk Ultra II 16GB SDHC card with about 1600 images (10-14 megapixels). Reading the folder structure stopped after the first 1000 items as expected ("WARN   applet.ImageViewer - ImageSourceCard.lua:101 we're not going to show more than 1000 pictures - stop here").
Comment 8 Michael Herger 2010-02-15 04:41:44 UTC
Mikkel - any news?
Comment 9 SVN Bot 2010-02-19 01:28:08 UTC
 == Auto-comment from SVN commit #8525 to the  repo by mherger ==
 == https://svn.slimdevices.com/?view=revision&revision=8525 ==

Bug: 15651
Description: don't download & render new image before previous is drawn. Move heavy image handling to a task to leave room for other SP activity.
Comment 10 Mikkel Herold 2010-02-20 15:28:16 UTC
(In reply to comment #8)
> Mikkel - any news?

Sorry for my absence - not really much news: I'm on firmware 8539, but it still doesn't work.

I have all my pictures stored directly in the root of the SD card (makes it easier to use the card in my photo frame), but in the Image Viewer settings you cannot set the path to just "/" (I will make a new bug report on that), so mine is still set to the default "/media".

Thus, I'm not even sure that the Image Viewer tries to access any image file at all - it just crashes and restarts about 30 seconds after pressing "Start slideshow".

Is there anywhere I can see some debug info so I can maybe find out what it does before it crashes?
Comment 11 Michael Herger 2010-02-21 23:14:03 UTC
> I have all my pictures stored directly in the root of the SD card (makes  

What fileformat are you using? The wide spread fat (used in digicams) is limited to 512 items in the root. 10000 sounds like a crazy idea...

> is still set to the default "/media".

That's where your cards are mounted. Latest firmware has a "SD Card" item as a shortcut.

> all - it just crashes and restarts about 30 seconds after pressing "Start
> slideshow".

I wonder whether it crashes as SP takes too long to read the full directory. There's a watchdog which will restart it if it can't process a command withing a given time. Reading 10000+ items might take too long.

> Is there anywhere I can see some debug info so I can maybe find out what  
> it does before it crashes?

Please see my comment #5.
Comment 12 Mikkel Herold 2010-02-22 12:17:01 UTC
(In reply to comment #11)
> What fileformat are you using? The wide spread fat (used in digicams) is
> limited to 512 items in the root. 10000 sounds like a crazy idea...

It's FAT32 (see comment #2). I didn't know about that limitation - the card works well in my photo frame, although it does take a while for it to start showing the images.

> > is still set to the default "/media".
> 
> That's where your cards are mounted. Latest firmware has a "SD Card" item as a
> shortcut.

Thanks for clarifying - I didn't know that.

> I wonder whether it crashes as SP takes too long to read the full directory.
> There's a watchdog which will restart it if it can't process a command withing
> a given time. Reading 10000+ items might take too long.

That's what I was thinking as well. If I SSH-connect to the Controller and browse the media folder, it takes quite a while for the files to list (well over 60 seconds using WinSCP over a wireless connection).

I will make a log and see what it says.
Comment 13 Mikkel Herold 2010-02-22 13:50:28 UTC
(In reply to comment #12)
> > That's where your cards are mounted. Latest firmware has a "SD Card" item as a
> > shortcut.

Just upgraded to 8540, and now mine has "Local storage media", "Memory card" and "URL list" - what's the difference between the first and the second option?

> I will make a log and see what it says.

I set mine to "Local storage media" and pressed Start. The resulting log file is below.
Comment 14 Mikkel Herold 2010-02-22 13:51:49 UTC
Created attachment 6553 [details]
Log file from Image Viewer when trying to view images from an SD card with 10.000+ images

All images are now stored in a subfolder in the root.
Comment 15 SVN Bot 2010-02-22 23:33:51 UTC
 == Auto-comment from SVN commit #8547 to the  repo by mherger ==
 == https://svn.slimdevices.com/?view=revision&revision=8547 ==

Fixed Bug: 15651
Description: give SP air to breath when scanning large folders for images. Idle task every 100 items, check the max items inside the folder too.
Comment 16 Michael Herger 2010-02-22 23:36:18 UTC
Mikkel - I was finally able to reproduce the issue. The latest change should fix the behaviour: previously the scan would starve the system, the watchdog would trigger a reboot as it didn't get any feedback from the process. The code was only idling after scanning a folder, but not _while_ scanning that folder. I changed this to idle every 100 items, which made it work in my test environment. Please give today's firmware a try and let me know if it didn't help. Thanks!
Comment 17 Mikkel Herold 2010-02-25 03:17:24 UTC
(In reply to comment #16)
> Please give today's firmware a try and let me know if it didn't
> help. Thanks!

It works! As of 8563 the problem is gone. And even with 10.000+ images on the card, the first image shows after just a few seconds - great job!
Comment 18 Michael Herger 2010-02-25 03:48:42 UTC
Thanks for testing!

Please note that while it doesn't crash any more, it's currently limited to the first 1000 images it finds. Even if you enable random order you'll never see all your pictures. This is to protect SP from running out of memory - SP and audio playback has all priority, as we'd rather see an incomplete slideshow than the music stop :-)
Comment 19 Mikkel Herold 2010-02-25 03:54:09 UTC
(In reply to comment #18)
> Please note that while it doesn't crash any more, it's currently limited to the
> first 1000 images it finds. Even if you enable random order you'll never see
> all your pictures.

Okay, so it will always be the first 1000 images, or does it create a set of 1000 random files every time?

> This is to protect SP from running out of memory - SP and
> audio playback has all priority, as we'd rather see an incomplete slideshow
> than the music stop :-)

Agreed :-D
Comment 20 Michael Herger 2010-02-25 05:02:52 UTC
first 1000. Maybe we'll review this limitation at some point. But right now we want to get Touch out the door.
Comment 21 Chris Owens 2010-04-08 17:26:20 UTC
This bug has been marked fixed in a released version of Squeezebox Server or the accompanying firmware or mysqueezebox.com release.

If you are still seeing this issue, please let us know!