I am running a Apache server on Linux 2.2.17. I continuously send
static HTTP requests without Keep-alive from one client to the server,
making around 3000 connections/s with a file size of ~1 Kbyte. The
local port range on the client is set to 1024-65535. After around 20
seconds, all the ports on the client is used up and I started to see
messages like "Address already in use".
The thing I don't understand is that on the server side, I am seeing
a lot of sockets staying in the SYN_RECV state, and some of these are
duplicates. Under what circumstances can same socket pairs remain in
the SYN_RECV state simultaneously? The following is part of the
'netstat -na' output. The number of connections eventually reach 128
(backlog) and the server is stuck until the SYN_RECV's are gone.
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address
State
tcp 0 0 192.168.11.101:1844 192.168.11.101:1779
TIME_WAIT
tcp 0 0 192.168.11.101:1843 192.168.11.101:1772
TIME_WAIT
tcp 0 0 192.168.11.101:1842 192.168.11.101:1773
TIME_WAIT
tcp 0 0 192.168.11.101:513 192.168.11.203:1021
ESTABLISHED
tcp 0 0 192.168.11.171:80 192.168.11.203:33866
SYN_RECV
tcp 0 0 192.168.11.171:80 192.168.11.203:33866
SYN_RECV
tcp 0 0 192.168.11.171:80 192.168.11.203:17589
SYN_RECV
tcp 0 0 192.168.11.171:80 192.168.11.203:17592
SYN_RECV
tcp 0 0 192.168.11.171:80 192.168.11.203:17591
SYN_RECV
tcp 0 0 192.168.11.171:80 192.168.11.203:18422
SYN_RECV
tcp 0 0 192.168.11.171:80 192.168.11.203:18434
SYN_RECV
tcp 0 0 192.168.11.171:80 192.168.11.203:21527
SYN_RECV
tcp 0 0 192.168.11.171:80 192.168.11.203:22979
SYN_RECV
tcp 0 0 192.168.11.171:80 192.168.11.203:25546
SYN_RECV
tcp 0 0 192.168.11.171:80 192.168.11.203:26302
SYN_RECV
tcp 0 0 192.168.11.171:80 192.168.11.203:26301
SYN_RECV
tcp 0 0 192.168.11.171:80 192.168.11.203:26303
SYN_RECV
tcp 0 0 192.168.11.171:80 192.168.11.203:26322
SYN_RECV
tcp 0 0 192.168.11.171:80 192.168.11.203:26321
SYN_RECV
tcp 0 0 192.168.11.171:80 192.168.11.203:33866
SYN_RECV
tcp 0 0 192.168.11.171:80 192.168.11.203:17589
SYN_RECV
tcp 0 0 192.168.11.171:80 192.168.11.203:17591
SYN_RECV
tcp 0 0 192.168.11.171:80 192.168.11.203:17592
SYN_RECV
tcp 0 0 192.168.11.171:80 192.168.11.203:18422
SYN_RECV
tcp 0 0 192.168.11.171:80 192.168.11.203:18434
SYN_RECV
tcp 0 0 192.168.11.171:80 192.168.11.203:21527
SYN_RECV
tcp 0 0 192.168.11.171:80 192.168.11.203:22979
SYN_RECV
tcp 0 0 192.168.11.171:80 192.168.11.203:25546
SYN_RECV
tcp 0 0 192.168.11.171:80 192.168.11.203:26301
SYN_RECV
tcp 0 0 192.168.11.171:80 192.168.11.203:26302
SYN_RECV
...
I would really appreciate it if you can give me an idea of what's
going on. Thank you.
Andy
Another thing you could do on your client software to prevent cycling all of
its ephemeral ports is to bind to a particular ports, and use socket option
SO_REUSEADDR, and SO_LINGER.
Regards
Liang Cheng
Andy Chan <andy...@abeona.com> wrote in message
news:ec7926fd.01082...@posting.google.com...