Bug 15860 - Tiny SC shutdown breaks access to MSB.com
: Tiny SC shutdown breaks access to MSB.com
Status: CLOSED FIXED
Product: SB Touch
Classification: Unclassified
Component: TinySC
: 7.5.0
: PC Windows XP
: -- critical (vote)
: 7.5.0
Assigned To: Alan Young
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-03-08 16:53 UTC by Ryan
Modified: 2010-09-13 11:56 UTC (History)
6 users (show)

See Also:
Category: ---


Attachments
Patch for connection fast-fail (521 bytes, patch)
2010-03-12 07:10 UTC, Alan Young
Details | Diff
Patch for Switch Library problem (807 bytes, patch)
2010-03-12 07:12 UTC, Alan Young
Details | Diff
Patch for Switch Library problem (807 bytes, patch)
2010-03-12 07:13 UTC, Alan Young
Details | Diff
Patch for Switch Library problem (807 bytes, patch)
2010-03-12 07:13 UTC, Alan Young
Details | Diff
Patch for connection disconnect (477 bytes, patch)
2010-03-17 04:09 UTC, Alan Young
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan 2010-03-08 16:53:24 UTC
Since Fw 8637  this I have been experiencing poor response connecting to MSB.com features after having once run and shutdown Tiny SC. 

Steps to replicate

Perform a factory reset and set up the touch.
Select and play internet radio or other MSB.com (plays okay)
Insert SD card or USB stick.
Wait for Squeezebox server to start.
Select Squeezebox server status.
Wait for scanning media to complete.
Select and play content on inserted media (plays okay).
Select and play internet radio (plays okay)
Eject SD or USB card to shutdown TinySC. Receive message there is a problem connecting to MSB.com try again. *1
Attempt to play internet radio or other MSB.com application.  Get a frozen Spinny or continuous spinny.

I have had a touch spontaneously recover after approx 5-30 or longer. However a factory  reset  is a faster path to recovery. 


*1 You cannot make a safe eject of the media at this point.
Comment 1 Michael Herger 2010-03-08 21:17:12 UTC
If you can't make a safe eject, then don't just pull it. You've been warned not to do so when you inserted it. If you still do, then expect many kind of oddities, up to data loss.
Comment 2 Michael Herger 2010-03-08 21:18:36 UTC
That said - do you see the same or similar problem if you cleanly unmount the media?
Comment 3 Ryan 2010-03-11 15:13:12 UTC
fw 8649

You cannot cleanly un-mount the media!!!!  Also even if you do not remove the SD card after the request to eject fails, you still get the issues MSB.com functions

I have discovered that the only recovery path to get MSB.com functions working again is a Factory reset. 

I recall there was a bug awhile ago where you could not play MSB.com content after ejecting and it was fixed but it seems to have come back but worse.
Comment 4 Alan Young 2010-03-12 06:52:22 UTC
Ryan, what did you mean by: "I have had a touch spontaneously recover after approx 5-30 or longer."?
Comment 5 Alan Young 2010-03-12 07:09:43 UTC
I have been unable to reproduce the specific problem of it giving a forever spinny trying to connect to mysb.

After ejecting the SD card, my first action results in a spinny which times out after 20s. The resulting "Problem Connecting" menu offers me the following choices: Try Again, Switch Library, Go Home, Choose Player.

Switch Library is only presented if other compatible SbSs are available. At least in my case it is inoperative (fails - just flashes and does not bring up a new menu when selected). I have a fix for this.

Go Home takes me to the home menu, from which I can select Internet Radio and, when I try to go deeper, I get prompted to connected to mysqeezebox.com. This works.

The 20s spinny could fail more quickly. I have a simple fix for that, using the same fail-fast mechanism as for ChooseMusicSource.
Comment 6 Alan Young 2010-03-12 07:10:55 UTC
Created attachment 6642 [details]
Patch for connection fast-fail
Comment 7 Alan Young 2010-03-12 07:12:33 UTC
Created attachment 6643 [details]
Patch for Switch Library problem
Comment 8 Alan Young 2010-03-12 07:13:02 UTC
Created attachment 6644 [details]
Patch for Switch Library problem
Comment 9 Alan Young 2010-03-12 07:13:12 UTC
Created attachment 6645 [details]
Patch for Switch Library problem
Comment 10 Ryan 2010-03-12 14:03:01 UTC
fw8652

It still gets stuck after removing the SD card.

In reply to the question.  What did you mean by: "I have had a touch spontaneously recover after approx 5-30 or longer."?

When I have persisted to try to get a unit to connect to MSB.com content by reinserting an SD card power on reset etc. or retry playing internet radio multiple times I was able to eventually get a unit to become responsive again. This happened more than once.  The 5-30 minutes was a guess of how long the unit was un-responsive. I should have said 5 and 30 minutes. I also had one begin working after it had been left in an idle state not trying to connect or play anything for a very long time.

Since fw 8649 I have not been able to recover one without a factory reset.
Comment 11 Alan Young 2010-03-15 00:30:04 UTC
On the subject of the core problem raised by the bug report, I have not yet found the cause. On one occasion we had SN service instance on test.mysqueezebox.com in a state where it:

    * had an (apparently) active TCP connection to the player;
    * this connection was reflected internally in the %Slim::Networking::Slimproto::sock2client structure;
    * Slim::Player::Client::clientCount() returned 0 and it generally appeared that the instanced did not think that it really had an clients connected;
    * no Slimproto heartbeat polls were being sent out - if they had been then the other end of the TCP connection would have been discovered to have been closed;
    * the SN database had the player registered as connected;
    * the player had no active Slimproto connection to any server;
    * test.mysqueezebox.com Comet was reporting the player as connected.

Cumulatively, this set of conditions led to an irrecoverable situation with respect to connectivity to SN. Andy and I have examined the relevant code and cannot see how this set of conditions could have arisen.

I can only speculate that such a situation was responsible for Ryan's original problem.
Comment 12 Alan Young 2010-03-17 04:08:55 UTC
The Client::forgetClient method does not force the Slimproto TCP connection to be closed, if it is not already closed. This means that the %sock2client entry is not deleted.

If SDI::Service::Heartbeat::report_status() happens to run before the Slimproto disconnect from the player arrives, then it can reinitiate the connected status in the DB, via SDI::Service::Model::Player->verify_connected() using the contents of %Slim::Networking::Slimproto::sock2client as the indication of the connected clients.

The only way that SDI::Service::Control->disconnectClient() can be called, which removes the connected status from the DB, is via SDI::Service::Player::SqueezeNetworkClient::forgetClient(). Ordinarily this would be called by Slimproto::slimproto_close() when the TCP disconnect actually comes in but a check in Slimproto::slimproto_close() will not do this if the player has already been forgotten.

My guess is that the correct thing to do is to call Slimproto::slimproto_close() from Client::forgetClient().
Comment 13 Alan Young 2010-03-17 04:09:50 UTC
Created attachment 6658 [details]
Patch for connection disconnect
Comment 14 SVN Bot 2010-03-17 05:21:18 UTC
 == Auto-comment from SVN commit #30383 to the slim repo by ayoung ==
 == https://svn.slimdevices.com/slim?view=revision&revision=30383 ==

bug 15860: Tiny SC shutdown breaks access to MSB.com 
Force close of Slimproto connection when forgetting client.
Comment 15 SVN Bot 2010-03-17 07:11:29 UTC
 == Auto-comment from SVN commit #30384 to the slim repo by ayoung ==
 == https://svn.slimdevices.com/slim?view=revision&revision=30384 ==

bug 15860: Tiny SC shutdown breaks access to MSB.com 
After issuing a clientConnectCommand, give player time to have output queue flushed and disconnect cleanly
before forcing a client-forget.
Comment 16 SVN Bot 2010-03-17 23:43:03 UTC
 == Auto-comment from SVN commit #8658 to the jive repo by ayoung ==
 == https://svn.slimdevices.com/jive?view=revision&revision=8658 ==

bug 15860: Tiny SC shutdown breaks access to MSB.com 
Fix problem with Switch Server menu after failure to contact current server.
Comment 17 SVN Bot 2010-03-17 23:44:26 UTC
 == Auto-comment from SVN commit #8659 to the jive repo by ayoung ==
 == https://svn.slimdevices.com/jive?view=revision&revision=8659 ==

bug 15860: Tiny SC shutdown breaks access to MSB.com 
Fast-fail when current server is discovered to be unavailable rather than wait for 20s timeout.
Comment 18 Ryan 2010-03-19 15:16:01 UTC
fw 8660

fw 8660

I just tested this multiple times on multiple units and have been able to perform MSB.com functions after SD card ejection okay. This was with a unit operating independently. That is not serving any other device, or synced to any other device.  A bit slow sometimes, but much better than it was.
Comment 19 Alan Young 2010-03-29 05:32:12 UTC
*** Bug 15941 has been marked as a duplicate of this bug. ***
Comment 20 Chris Owens 2010-09-13 11:56:47 UTC
This bug has now been fixed in a released version of the Squeezeplay firmware (SB Touch, SB Radio, and SB Controller).  If you are still seeing this bug, please make certain you are running firmware 9009 or higher, and re-open it.

Thanks!