Bug 15741 - media ejection SD and USB unreliable
: media ejection SD and USB unreliable
Status: CLOSED FIXED
Product: SB Touch
Classification: Unclassified
Component: TinySC
: 7.5.0
: PC Windows XP
: P1 normal with 1 vote (vote)
: 7.6.0
Assigned To: Felix Mueller
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-02-19 14:49 UTC by Ryan
Modified: 2011-05-17 16:32 UTC (History)
4 users (show)

See Also:
Category: ---


Attachments
Proposed patch to prevent eject spinny from being killed (732 bytes, text/plain)
2010-03-17 07:23 UTC, Felix Mueller
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan 2010-02-19 14:49:15 UTC
fw 8524 

When ejecting the SD card I get one of two messages.
1. Ejecting SD card followed by "device ejected it is now safe to remove your card".   This is normal and a good result.

2.I get a short almost unnoticeable flash of the (Ejecting SD card) message message followed by, Connecting to player name (SD card) this results in a second message "there is a problem connecting to mysqueezebox.com, with options to Try again, Switch library, go home

Selecting try again repeats the same result.
Select go home and then try to eject the SD card again gives no result. You are stuck unable to eject the card safely except by powering down the system.  

I have also seen the same problem with the USB, but have mostly exercised the SD card.

I have had this problem repeat up to four times 4 time in a row and also had it work successfully 5,6 or more times before messing up again.

I have tried various combination's of playing music from the SD card or internet radio or services before ejecting the SD card to see if something would cause it to repeat consistently.  

This seemed to be working better before the last update
Comment 1 Chris Owens 2010-02-25 10:06:14 UTC
*** Bug 15742 has been marked as a duplicate of this bug. ***
Comment 2 Chris Owens 2010-03-01 09:35:04 UTC
Chris to run his test cases and add or replace this bug.
Comment 3 Chris Owens 2010-03-15 18:02:20 UTC
It seems uncommon to see this problem with a USB drive, from my testing.

However the remaining bugs still exists with the SD card.  Basically, ejecting the SD card doesn't work 1/3 of the time.

My steps to reproduce: 

1) Start from a reboot (power off/on, or reset button)
2) Put in an SD card with some music files
3) Watch the 'Starting Squeezebox Server' fullscreen spinny
4) Press 'Squeezebox Server Status'
5) Wait until 'Discovering Files: Complete' is shown
6) Hold down the back arrow in the upper left to return to the home menu
7) Click 'My Music' and browse to some music, play it.
8) Hold down the back arrow in the upper left to return to the home menu
9) Press Eject SD Card
10) "Connecting to... Mysqueezebox.com (fullscreen spinny)"
11) "There is a problem connecting to mysqueezebox.com Try Again -> Switch Library-> Go home->"
12) After this, all further attempts to 'Eject SD Card' will fail.  Going to the Eject SD card menu, you get options for 'Cancel ->' and 'Eject SD Card ->'.  Eject SD card beeps and highlights briefly, but stays on that screen.

This happened to me 2 times out of 6 attempts.

I know Ben said we can never be perfect at this, but 1/3 of the time is not good, and the failure mode is also ugly (impossible to eject SD card)

Felix, is this something you could look at?
Comment 4 Felix Mueller 2010-03-16 09:57:44 UTC
Michael - What is the reason that TinySC is stopped in case an SD card but not when an USB drive is ejected?

SqueezeCenter.lua - _unmountAction()

  if item.SCDrive then
    self:_stopServer(silent)
  else
    log:debug('This is not the SCDrive, so ')
  end
Comment 5 Michael Herger 2010-03-16 10:47:46 UTC
item.SCDrive shouldn't be limited to either of these, but should hold whatever drive is being used. Or do I not understand the question?
Comment 6 Felix Mueller 2010-03-16 13:36:24 UTC
Yeah, sorry, never mind, I've somehow read SDDrive. But I guess this check is to distinguish between a drive used for SC or something else like image viewer.
Comment 7 Felix Mueller 2010-03-17 07:22:25 UTC
It looks like sometimes when TinySC is stopped via ejecting SD card / USB drive a (re-)connection spinny comes up and kills the ejection spinny preventing the eject process to finish properly.

Making sure the ejection spinny cannot be interrupted and let it finish either when the SD card / USB drive is successfully ejected or a timeout has occured, fixes the issue reported.
Comment 8 Felix Mueller 2010-03-17 07:23:09 UTC
Created attachment 6660 [details]
Proposed patch to prevent eject spinny from being killed
Comment 9 Chris Owens 2010-03-17 10:08:18 UTC
Michael, since you're already cc'ed on the bug, could you review Felix's change?  I would like to commit it sooner rather than later for maximal testing.

Thanks!
Comment 10 Michael Herger 2010-03-17 10:15:35 UTC
I think this is fine - though I'm no expert in that field at all...
Comment 11 Ben Klaas 2010-03-17 10:29:06 UTC
that patch is fine, presuming of course that the popup will timeout in a reasonable amount of time on failure. I did exactly the same code change for the "attaching" spinny, and also brought the attach timeout from 30 to 20 seconds so a failure wouldn't take as long.
Comment 12 Felix Mueller 2010-03-17 10:36:51 UTC
The unmount timeout is currently set to 10 seconds.
Comment 13 SVN Bot 2010-03-17 10:44:04 UTC
 == Auto-comment from SVN commit #8657 to the jive repo by fmueller ==
 == https://svn.slimdevices.com/jive?view=revision&revision=8657 ==

Bug: 15741 
Description: Make sure eject spinny cannot be terminated before it has done its task.
Comment 14 Chris Owens 2010-03-17 13:44:27 UTC
Thanks everyone!
Comment 15 Ryan 2010-03-19 16:18:22 UTC
Fw 8660
There is still a problem here I have received a problem disconnecting SD card message 1 out of 4 times. However; I have on one occasion received the “It is now safe to remove your SD card” message just after receiving the first problem message. It is better than it was. It does eventually un-mount. Just sometimes it takes an extra attempt.

Since  bug 15742 was made a duplicate of this one, I will report I am still having difficulty when the SD card is installed  as well. When you go to play music from it I keep getting messages to switch library. 
The way I have been most successful has been to install the SD check the Squeezebox server status then wait an additional minute before attempting to play any music files. Even then when I get to where I see the album and select it the display jumps to a switch library prompt.
Comment 16 Felix Mueller 2010-03-22 05:31:19 UTC
Alan - any idea what Ryan might be seeing here when he reports that he was repeatedly getting the 'switch library' message? (Second paragraph of comment 15)
Comment 17 Alan Young 2010-03-22 06:50:49 UTC
I think that the problem is that, after completing the initial scan, TinySC sets up the mechanism that watches for changes to the library filesystem. Although this runs in other threads, I think that it hits the filesystem so hard that TinySC stops responding (just does not get enough CPU cycles) and so Squeezeplay times out the connection and offers Switch Library as the only option in My Music while it is trying to re-establish a connection. I find that simply waiting a little logger is sufficient.

This is only a theory based on a variety of observations and I do not have specific, causal evidence.
Comment 18 Chris Owens 2010-03-22 09:16:21 UTC
Chris to review Ryan's remaining symptom and target the remaining work, if any.
Comment 19 Ryan 2010-03-24 15:45:52 UTC
Fw 8665

  Ejecting SD card media has worked correctly for on the first try for 6 times in a row.

Installing SD card not so good, if the library path is unchanged it does okay. If you were accessing TinySC on the SD card then ejected it. Then insert the SD card again. It finds it okay. 

But if you have to switch from another library or MSB.com to access Tiny SC . Then you MAY run into the repetitive switch library prompt as mentioned in comment 15 paragraph 2. Once the SD card has been successfully selected switching between libraries performs okay as long at they are available and you do not eject and reinstall the SD card.

In general this is working much better than it was.
Comment 20 Chris Owens 2010-03-29 09:24:57 UTC
Chris to re-evaluate after SD UI changes
Comment 21 Mike 2010-04-28 03:41:25 UTC
I recently had an issue with USB connectivity.
My Touch had been left powered for a couple of days with a USB HDD attached.  
My Touch is used standalone, with no server/PC based slimserver running.

On checking the Touch today, I found that it wasn't running TinySS and that it would not eject the connection to my USB HDD.
I did try rebooting the Touch and also powering up SS on my PC.  These did not resolve the issue.

I then rebooted my USB HDD (power on and off), at which point the Touch gave me the usual warning message, rebooted TinySS and worked fine.
Comment 22 Chris Owens 2010-05-03 10:33:39 UTC
Hi Mike,

That seems outside the scope of 'media ejection unreliable'.  Could I trouble you to file a new bug?  Thanks!
Comment 23 SVN Bot 2011-02-03 02:26:01 UTC
 == Auto-comment from SVN commit #9301 to the jive repo by fmueller ==
 == http://svn.slimdevices.com/jive?view=revision&revision=9301 ==

Bug: 15741 
Description: Fix media eject (SD and USB) by allowing iterator to finish - this closes the directory actively.
Comment 24 SVN Bot 2011-03-14 06:50:23 UTC
 == Auto-comment from SVN commit #9359 to the jive repo by fmueller ==
 == http://svn.slimdevices.com/jive?view=revision&revision=9359 ==

Bug: 15741 
Description: Automatically hide eject success window when SD card / USB device is removed.
Comment 25 Felix Mueller 2011-04-26 01:06:18 UTC
Ben reports that the behavior is much better and my own additional test showed the same.
Comment 26 Paul Chandler 2011-05-17 16:32:04 UTC
Ejection of USB and SD cards is working now --7.6.0.32427