IO::Socket TCP stack problems on OSX

[email protected] (Stuart Gall)
Newsgroups perl.macosx
Message-ID <[email protected]>
Hello,
I have written a script using IO::Socket::INET to read and write data  
to modbus devices.
This is running on OSX V 10.4.11
I have the latest IO::Socket Library from CPAN.
Using perl 5.8.6 from OSX and I built perl 5.10 which has the same issue
The script will work for a few loops, maybe doing 100 or so modbus  
read/writes
Then the sockets are closed for no apparent reason.

I did a tcpdump, what seams to be happening is that when an error  
occurs in the TCP packet, the OSX end gets stuck in a loop requesting  
and re requesting the packet.
Until eventually the other end sends RST and force-ably closes the  
socket.
Then everything goes bad, if I just close the problem socket then one  
by one the other sockets close.
(This is confirmed with IO::Select)
When I get this block I have to close all sockets and reopen them to  
clear it.

I copied the same script to another OSX machine running 10.4.11 and I  
have the exact same problem.

I copied the script to a machine running Mandrivia 2009 and it works  
just fine!


Any Ideas what might be going on ?


TCPDUMP  (192.168.251.3 is the OSX machine)

10:17:19.508241 IP 192.168.251.3.52312 > 192.168.251.102.502: P  
160:172(12) ack 90 win 65535 <nop,nop,timestamp 1360281049 65303>
10:17:19.514522 IP 192.168.251.102.502 > 192.168.251.3.52312: P 90:101 
(11) ack 172 win 5669 <timestamp 65461 1360281049,nop,nop>
10:17:19.514544 IP 192.168.251.3.52312 > 192.168.251.102.502: . ack  
101 win 65535 <nop,nop,timestamp 1360281049 65461>
That was a request and reply acknowledged - Normal
10:17:19.747871 IP 192.168.251.3.52312 > 192.168.251.102.502: P  
172:187(15) ack 101 win 65535 <nop,nop,timestamp 1360281049 65461>
Request
10:17:19.752164 IP 192.168.251.102.502 > 192.168.251.3.52312: P  
101:113(12) ack 187 win 5654 <timestamp 163 1360281049,nop,nop>
Reply
10:17:19.752183 IP 192.168.251.3.52312 > 192.168.251.102.502: . ack  
101 win 65535 <nop,nop,timestamp 1360281050 65461>
Rejected
10:17:20.501290 IP 192.168.251.102.502 > 192.168.251.3.52312: P  
101:113(12) ack 187 win 5654 <timestamp 912 1360281050,nop,nop>
Resent
10:17:20.501355 IP 192.168.251.3.52312 > 192.168.251.102.502: . ack  
101 win 65535 <nop,nop,timestamp 1360281051 65461>
Rejected
10:17:20.750835 IP 192.168.251.3.52312 > 192.168.251.102.502: P  
172:187(15) ack 101 win 65535 <nop,nop,timestamp 1360281051 65461>
Resend request (even though it was acknowledged) Is that legal ??
10:17:20.762936 IP 192.168.251.102.502 > 192.168.251.3.52312: . ack  
187 win 5654 <timestamp 1174 1360281051,nop,nop>
Accept
10:17:21.929985 IP 192.168.251.102.502 > 192.168.251.3.52312: P  
101:113(12) ack 187 win 5654 <timestamp 2341 1360281051,nop,nop>
Reply Again
10:17:21.930046 IP 192.168.251.3.52312 > 192.168.251.102.502: . ack  
101 win 65535 <nop,nop,timestamp 1360281054 65461>
Rejected
10:17:21.931308 IP 192.168.251.102.502 > 192.168.251.3.52312: P  
101:113(12) ack 187 win 5654 <timestamp 2342 1360281054,nop,nop>
Resent
10:17:21.931324 IP 192.168.251.3.52312 > 192.168.251.102.502: . ack  
101 win 65535 <nop,nop,timestamp 1360281054 65461>
Rejected
10:17:21.932624 IP 192.168.251.102.502 > 192.168.251.3.52312: . ack  
187 win 5654 <timestamp 2343 1360281054,nop,nop>
?

And so on
10:17:22.751058 IP 192.168.251.3.52312 > 192.168.251.102.502: P  
172:187(15) ack 101 win 65535 <nop,nop,timestamp 1360281055 65461>
10:17:22.759845 IP 192.168.251.102.502 > 192.168.251.3.52312: . ack  
187 win 5654 <timestamp 3171 1360281055,nop,nop>
10:17:24.778286 IP 192.168.251.102.502 > 192.168.251.3.52312: P  
101:113(12) ack 187 win 5654 <timestamp 5189 1360281055,nop,nop>
10:17:24.778318 IP 192.168.251.3.52312 > 192.168.251.102.502: . ack  
101 win 65535 <nop,nop,timestamp 1360281060 65461>
10:17:24.779660 IP 192.168.251.102.502 > 192.168.251.3.52312: . ack  
187 win 5654 <timestamp 5190 1360281060,nop,nop>
10:17:26.751479 IP 192.168.251.3.52312 > 192.168.251.102.502: P  
172:187(15) ack 101 win 65535 <nop,nop,timestamp 1360281063 65461>
10:17:26.758087 IP 192.168.251.102.502 > 192.168.251.3.52312: . ack  
187 win 5654 <timestamp 7169 1360281063,nop,nop>
10:17:30.470519 IP 192.168.251.102.502 > 192.168.251.3.52312: P  
101:113(12) ack 187 win 5654 <timestamp 10881 1360281063,nop,nop>
10:17:30.470583 IP 192.168.251.3.52312 > 192.168.251.102.502: . ack  
101 win 65535 <nop,nop,timestamp 1360281071 65461>
10:17:30.471828 IP 192.168.251.102.502 > 192.168.251.3.52312: . ack  
187 win 5654 <timestamp 10882 1360281071,nop,nop>
10:17:34.752192 IP 192.168.251.3.52312 > 192.168.251.102.502: P  
172:187(15) ack 101 win 65535 <nop,nop,timestamp 1360281079 65461>
10:17:34.754071 IP 192.168.251.102.502 > 192.168.251.3.52312: . ack  
187 win 5654 <timestamp 15164 1360281079,nop,nop>
10:17:37.576828 IP 192.168.251.102.502 > 192.168.251.3.52312: P  
101:113(12) ack 187 win 5654 <timestamp 17987 1360281079,nop,nop>
10:17:37.576875 IP 192.168.251.3.52312 > 192.168.251.102.502: . ack  
101 win 65535 <nop,nop,timestamp 1360281085 65461>
10:17:37.578139 IP 192.168.251.102.502 > 192.168.251.3.52312: . ack  
187 win 5654 <timestamp 17988 1360281085,nop,nop>
10:17:50.754009 IP 192.168.251.3.52312 > 192.168.251.102.502: P  
172:187(15) ack 101 win 65535 <nop,nop,timestamp 1360281111 65461>
10:17:50.761068 IP 192.168.251.102.502 > 192.168.251.3.52312: R  
249188453:249188453(0) win 0
Now I thing 192.168.251.102 gets fed up and boots us off

TIA
Stuart.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.