Read from empty socket

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Read from empty socket

Janko Mivšek-2
Hello,

I have now a reproducible problem and TCP trace of a cause of 'Broken pipe' errors I reported a while ago. And it seems it is also related to "Socket is active until what or when thread" started by Bruce a month ago.

Problem is as follows:

   1. I'm waiting on aSocketAccessor readInto:startingAt:for: to receive
      next data
   2. above method is deblocked but returning zero data
   3. if I repeat, it returns immediately, but again with 0 data
   4. I need to close a connection and start again. This can cause a
      socket close before all data is sent, hence a "broken pipes"

It seems that FIN packets cause above problem. FIN packets somehow deblock a waiting method but they shouldn't. They should raise some exception instead.

Here are two traces on Swazoo done with Ethereal, one with above problem, another without.

1. See packet 10 with FIN, causing Swazoo to read an empty packet, then respond with 400 bad request and close connection with a final packet:

No.Source      Destination    Info
76.8.192.250   213.157.239.24  TCP 33438> http [SYN] Seq=0 Ack=0
213.157.239.24 76.8.192.250    TCP http > 33438 [SYN,ACK] Seq=0 Ack=1
76.8.192.250    213.157.239.24 TCP 33438> http [ACK] Seq=1 Ack=1
76.8.192.250    213.157.239.24 HTTP GET /znamenitosti.html HTTP/1.0
213.157.239.24 76.8.192.250    TCP http > 33438 [ACK] Seq=1 Ack=541
213.157.239.24 76.8.192.250    HTTP HTTP/1.1 200 OK (text/html)
213.157.239.24 76.8.192.250    HTTP "Continuation or non-HTTP traffic
76.8.192.250   213.157.239.24  TCP 33438> http [ACK] Seq=541 Ack=1441
76.8.192.250   213.157.239.24  TCP 33438> http [ACK] Seq=541 Ack=2293
10 76.8.192.250   213.157.239.24 TCP 33438>http[FIN,ACK] Seq=541Ack=2293
11 213.157.239.24 76.8.192.250   HTTP HTTP/1.1 400 Bad Request
12 213.157.239.24 76.8.192.250   TCP http>33438[FIN,ACK] Seq=2714Ack=542

2. Swazoo session without problems:

No.Source      Destination     Info
212.18.33.254  213.157.239.24  TCP  1855 > http [SYN] Seq=0 Ack=0
213.157.239.24 212.18.33.254   TCP  http > 1855 [SYN,ACK] Seq=0 Ack=1
212.18.33.254  213.157.239.24  TCP  1855 > http [ACK] Seq=1 Ack=1
212.18.33.254  213.157.239.24  HTTP GET /znamenitosti.html HTTP/1.1
213.157.239.24 212.18.33.254   TCP  http > 1855 [ACK] Seq=1 Ack=532
213.157.239.24 212.18.33.254   HTTP HTTP/1.1 200 OK (text/html)
213.157.239.24 212.18.33.254   HTTP Continuation or non-HTTP traffic
212.18.33.254  213.157.239.24  TCP  1855 > http [SYN] Seq=0 Ack=0
213.157.239.24 212.18.33.254   TCP  http > 1855 [SYN,ACK] Seq=0 Ack=1
10 212.18.33.254  213.157.239.24 TCP  1855 > http [ACK] Seq=1 Ack=1
11 212.18.33.254  213.157.239.24 HTTP GET /screen.css HTTP/1.1
...etc


I hope this will shed a light on that problem to help it solve as soon as possible.

Janko


-- 
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si