-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256


Hello all, 

So... i fired up wireshark and i can see that the socket get in hanged
state when i get a first "TCP spurious retransmission".

This is how it goes:

Local [Syn] -> Remote
Local [Syn] -> Remote
Remote [SYN ACK] -> Local
Local [ACK] -> Remote
Remote [SYN ACK] -> Local
Local [ACK] -> Remote
Remote [SYN ACK] -> Local (TCP Spurious Retransmission)
Local [ACK] -> Remote (TCP Dup ACK #1)
Remote [SYN ACK] -> Local (TCP Spurious Retransmission)
Local [ACK] -> Remote (TCP Dup ACK #1)
Remote [SYN ACK] -> Local (TCP Spurious Retransmission)
Local [ACK] -> Remote (TCP Dup ACK #2)
Remote [SYN ACK] -> Local (TCP Spurious Retransmission)
Local [ACK] -> Remote (TCP Dup ACK #2)
Remote [SYN ACK] -> Local (TCP Spurious Retransmission)
Local [ACK] -> Remote (TCP Dup ACK #3)
Remote [SYN ACK] -> Local (TCP Spurious Retransmission)
Local [ACK] -> Remote (TCP Dup ACK #3)
Remote [SYN ACK] -> Local (TCP Spurious Retransmission)
Local [ACK] -> Remote (TCP Dup ACK #4)
Remote [SYN ACK] -> Local (TCP Spurious Retransmission)
Local [ACK] -> Remote (TCP Dup ACK #4)
Remote [SYN ACK] -> Local (TCP Spurious Retransmission)
Local [ACK] -> Remote (TCP Dup ACK #5)
Remote [SYN ACK] -> Local (TCP Spurious Retransmission)
Local [ACK] -> Remote (TCP Dup ACK #5)
Remote [SYN ACK] -> Local (TCP Spurious Retransmission)

No more packets exchanged.
After this the socket simply gets in zombie state. Not dead, but not
alive.

The connection timeout doesn't work, the receive timeout (SO_RCVTIMEO)
and send timeout (SO_SNDTIMEO) does work.

Is there any way to recover from this?



On Mon, 12 Oct 2015 18:58:42 +0200
David Emanuel da Costa Santiago <deman...@gmail.com> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> 
> Hello all!
> 
> I'm creating some sockets to a remote server and from time to time,
> the sockets get "frozen".
> 
> I'm creating the socket as:
> 
>     $socket = IO::Socket::INET->new (
>                                    PeerAddr => $server,
>                                    PeerPort => $port,
>                                    Blocking => 1,
>                                    Proto => 'tcp',
>                                    Timeout => 20, #connection
> timeout ) or die "Error: Failed to
>     connect : $!\n";
> 
> 
> So far so good, but when i try to make a first read, the read hangs
> (always on the first read - If the first read is successfull all the
> other reads will succeed). No error whatsoever (the connection doesn't
> even drop!).
> 
> I'm reading the socket as: 
> 
> sub _read_from_socket{
>   my ($socket) = @_;
> 
>   my ($output, $buffer) = ('', '');
>   while(1){
>     my $status = $socket->read($buffer, 1);
>     die "Error: $!" if(!defined $status);
>     $output .= $buffer;
>     last if $output =~ /\r\n$|^\z/;
>   }
> 
>   return $output;
> }
> 
> 
> The same happens even with a sysread (both on windows and linux
> platforms). This hanging doesn't happen everytime, it's like 1 in 6
> tries.
> 
> If i check with netstat i see the connection with state ESTABLISHED.
> 
> Do you guys know what's going on? 
> 
> 
> 
> Regards,
> David Santiago
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2
> 
> iQEcBAEBCAAGBQJWG+bCAAoJEJ/OLjwuDYzKX3wIAKT0pH1gdcUMxmgGrN6v5vbJ
> MVvNx85HJ9Z83LEe8hewsxVLLxcYVgVCIm/VAdRuDKREZmnL7xdraaHmu3a2wHzG
> /yNedRGs/CWJdZB0jt+o7Y3RbH9dFo9YMSpRugUHrQPbhe4fY5PbWws7RPleR2fv
> AXpKRd3wx4zxdzbrbVieXtLNCgqRvEEFJ9Jpq0SYXQ9Tv+E7BoJ4+u2Zx4jfQMfv
> 54YOx6lEMiMRLCUdDe+bft26J6OoYWZCk88Dk92VurCdvIsSXKsqFeB84B3B1lva
> J7/BJQdFsbzTsSy7egdbiQUKApRR1uhW6IeClEkhbFzrfpF/lKJGZXU022PrJTE=
> =TeGg
> -----END PGP SIGNATURE-----

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJWHDYfAAoJEJ/OLjwuDYzKHuUH/jeK+sXsCxZvx8WtEDFpbB1u
w2ouv2bxbg8mwH0AHfGjFBaJoGL2R8SoBPPhObfzvQMFV5ZD1XXmoc3qoUiJf3Ot
zYxdfkq7P0QX24sUa7Ky9HMkxIg75bVTrOK4Sw5xVrjoHK/Q7tWzdWquP+cWWeqA
eL+kM0Dnu42FkW2FqQzEcp8nLk0nUioQ9JJ4HpkaM/UN2NbK97jPBseEAr4nbMRi
BP/8R7w0096C2vrXjzzF/sDCgnHTSkagPPbTs3of+dGTXtTPS95C53d+7rG4qWJx
Lk7P6nnuotrK3MeRGd+Di7nWfyZ+/bpbqFvrRE1pyXdKqTj37EcNO2Su2sDJx00=
=PxuA
-----END PGP SIGNATURE-----

Reply via email to