大家好:
不知道大家在开发网络程序的过程有没有出现过这种问题:
(1) tcp服务器部署在linux机器上.
(2) 压力测试的过程中出现失败的情况, 查看服务器的套接字的状态. 看到一些close_wait状态.
(3) 这时,我用简陋的测试客户端(windows socket)向服务器发数据. 跟踪发现.客户端connect成功.send也成功.客户端的recv会阻塞一会,返回返回-1, WSAGetLastError()时返回WSAECONNRESET. 但是服务器好像没有接收到客户端的这次连接(给人的感觉好你服务器进程死了).但此时服务器进程没crash. 监听端口的状态为LISTEN.
另外:我没有修改linux下对进程打开的文件数的限制. 默认为1024.
有经验的朋友,知道原因吗?
谢谢.
附:
用tcpdump在服务器端的输出
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
03:07:03.596489 IP localhost.mtportmon > localhost.8005: Flags [S], seq 1346912161, win 65535, options [mss 1460,nop,nop,sackOK], length 0
03:07:03.596545 IP localhost.8005 > localhost.mtportmon: Flags [S.], seq 2966971840, ack 1346912162, win 5840, options [mss 1460,nop,nop,sackOK], length 0
03:07:03.597111 IP localhost.mtportmon > localhost.8005: Flags [.], ack 1, win 65535, length 0
03:07:07.049852 IP localhost.mtportmon > localhost.8005: Flags [P.], ack 1, win 65535, length 78
03:07:09.914679 IP localhost.mtportmon > localhost.8005: Flags [P.], ack 1, win 65535, length 78
03:07:11.047173 IP localhost.8005 > localhost.mtportmon: Flags [S.], seq 2966971840, ack 1346912162, win 5840, options [mss 1460,nop,nop,sackOK], length 0
03:07:11.047997 IP localhost.mtportmon > localhost.8005: Flags [.], ack 1, win 65535, length 0
03:07:15.925132 IP localhost.mtportmon > localhost.8005: Flags [P.], ack 1, win 65535, length 78
03:07:22.814229 IP localhost.8005 > localhost.mtportmon: Flags [S.], seq 2966971840, ack 1346912162, win 5840, options [mss 1460,nop,nop,sackOK], length 0
03:07:22.815033 IP localhost.mtportmon > localhost.8005: Flags [.], ack 1, win 65535, length 0
03:07:27.946022 IP localhost.mtportmon > localhost.8005: Flags [P.], ack 1, win 65535, length 78
03:07:46.315183 IP localhost.8005 > localhost.mtportmon: Flags [S.], seq 2966971840, ack 1346912162, win 5840, options [mss 1460,nop,nop,sackOK], length 0
03:07:46.316047 IP localhost.mtportmon > localhost.8005: Flags [.], ack 1, win 65535, length 0
03:07:51.878459 IP localhost.mtportmon > localhost.8005: Flags [P.], ack 1, win 65535, length 78
03:08:21.930662 IP localhost.mtportmon > localhost.8005: Flags [P.], ack 1, win 65535, length 78
03:08:33.793200 IP localhost.8005 > localhost.mtportmon: Flags [S.], seq 2966971840, ack 1346912162, win 5840, options [mss 1460,nop,nop,sackOK], length 0
03:08:33.794037 IP localhost.mtportmon > localhost.8005: Flags [.], ack 1, win 65535, length 0
03:10:07.713080 IP localhost.8005 > localhost.mtportmon: Flags [S.], seq 2966971840, ack 1346912162, win 5840, options [mss 1460,nop,nop,sackOK], length 0
03:10:07.713957 IP localhost.mtportmon > localhost.8005: Flags [R], seq 1346912162, win 0, length 0
[ 本帖最后由 sugar 于 2010-4-27 19:18 编辑 ] |