Problem understood (sort of) but not solved. @Paul, you were right, it
is related to TIME_WAIT but in a bizarre wait. Consider the following
TCP dumps

Code:
--------------------
    
  success
  3684  381.383533      192.168.6.15    192.168.6.194   TCP     54      [TCP 
Retransmission] 9000 → 52422 [FIN, ACK] Seq=9305427 Ack=54 Win=262656 
Len=0
  3685  381.387417      192.168.6.194   192.168.6.15    TCP     60      52422 
→ 9000 [ACK] Seq=54 Ack=9305428 Win=131328 Len=0
  3686  381.387417      192.168.6.194   192.168.6.15    TCP     60      52422 
→ 9000 [FIN, ACK] Seq=54 Ack=9305428 Win=131328 Len=0
  3687  381.387526      192.168.6.15    192.168.6.194   TCP     54      9000 
→ 52422 [ACK] Seq=9305428 Ack=55 Win=262656 Len=0
  
  failed
  5375  508.721495      192.168.6.15    192.168.6.194   TCP     54      [TCP 
Retransmission] 9000 → 52436 [FIN, ACK] Seq=5584802 Ack=54 Win=262656 
Len=0
  5376  508.724054      192.168.6.194   192.168.6.15    TCP     60      52436 
→ 9000 [ACK] Seq=54 Ack=5584803 Win=961024 Len=0
  6039  628.728483      192.168.6.15    192.168.6.194   TCP     54      9000 
→ 52436 [RST, ACK] Seq=5584803 Ack=54 Win=0 Len=0
  
--------------------

In both cases, the whole file has been sent to the Bridge and LMS sends
a FIN,ACK but in the successful case, the Bridge answers with a FIN,ACK
wand all ends normally. In the failed case, although the bridge asnwers
with an ACK to the last segment, the FIN never arrives and 120s later,
LMS uses a RST. 

Now, my understanding is that I get kind of unlucky because what happens
is that all is well received by the TCP layer, including the FIN, but
for a graceful shutdown, the application layer should call close() so
that the FIN,ACK can be sent in response. But because the application
layer is blocked, it does not call close() and have a TIME_WAIT
expiration instead. When finally the application layer (the streaming
thread) runs, it's too late and recv() return <0 because of the RST and
last segments in kernel buffers are lost. 

Crap, crap and crap



LMS 8.2 on Odroid-C4 - *SqueezeAMP!*, 5xRadio, 5xBoom, 2xDuet, 1xTouch,
1xSB3. Sonos PLAY:3, PLAY:5, Marantz NR1603, Foobar2000, ShairPortW,
2xChromecast Audio, Chromecast v1 and v2, Squeezelite on Pi,  Yamaha
WX-010, AppleTV 4, Airport Express, GGMM E5, RivaArena 1 & 3
------------------------------------------------------------------------
philippe_44's Profile: http://forums.slimdevices.com/member.php?userid=17261
View this thread: http://forums.slimdevices.com/showthread.php?t=104614

_______________________________________________
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins

Reply via email to