Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

question about netstat Recv-Q

1 view
Skip to first unread message

zhangyef...@gmail.com

unread,
Sep 3, 2008, 5:52:04 AM9/3/08
to
I encouter a strange problem. my server program go wrong when it is
running for a while. when server close end point socket ,the client
end point socket is keeping alive. when I use tcpdump in a computer
connected to server long ago , surprising , I found packet coming from
server that should being send to another computer .

i want to cry ,how is it?

and I found end port socket that should being closed before,
now it's stat is close_wait ,and the Recv-Q is not zero.

whe the problen occur, i telnet to the server ,and I found the new
socket created by accept read ago's data that is the end point
that's stat is close_wait ,and the Recv-Q is not zero.

i am going to become craze.
anybody save me ?
thank you very muth for your help.

David Schwartz

unread,
Sep 3, 2008, 2:52:14 PM9/3/08
to
On Sep 3, 2:52 am, "zhangyefei.ye...@gmail.com"

There's a bug in your program. How much more can we say without seeing
the code?

DS

zhangyef...@gmail.com

unread,
Sep 3, 2008, 11:18:11 PM9/3/08
to

source codes is a little big, can not be showed here .sorry.
but i think my program can not make tcp protocol crazy ?
this is very strange problem ....
who Encounter the same problem ?

David Schwartz

unread,
Sep 4, 2008, 2:06:18 PM9/4/08
to
On Sep 3, 8:18 pm, "zhangyefei.ye...@gmail.com"
<zhangyefei.ye...@gmail.com> wrote:

> source codes is a little big, can not be showed here .sorry.
> but i think my program can not make tcp protocol crazy ?
> this is very strange problem ....
> who  Encounter the same problem ?

Your problem description is very typical of programs that lose track
of which socket is which.

DS

zhangyef...@gmail.com

unread,
Sep 5, 2008, 12:38:03 AM9/5/08
to

thanks very much for your reply.

i found the connect and disconnect is strange :
11:15:06.219049 IP a.3658 > b.8888: S 1561001322:1561001322(0) win
65535 <mss 1460,nop,nop,sackOK>
11:15:06.219066 IP b.8888 > a.3658: S 415149191:415149191(0) ack
1561001323 win 5840 <mss 1460,nop,nop,sackOK>
11:15:06.235461 IP a.3658 > b.8888: . ack 1 win 65535
11:15:06.235588 IP a.3658 > b.8888: P 1:26(25) ack 1 win 65535
11:15:06.235599 IP b.8888 > a.3658: . ack 26 win 5840
11:15:06.273787 IP b.8888 > a.3658: P 1:30(29) ack 26 win 5840
11:15:06.290251 IP a.3658 > b.8888: F 26:26(0) ack 30 win 65506
11:15:06.290793 IP b.8888 > a.3658: F 30:30(0) ack 27 win 5840
11:15:06.307142 IP a.3658 > b.8888: . ack 31 win 65506

the normal procedure is such:
09:42:18.433265 IP a.4462 > b.8888: S 3208938282:3208938282(0) win
65535 <mss 1460,nop,nop,sackOK>
09:42:18.433283 IP b.8888 > a.4462: S 3128128512:3128128512(0) ack
3208938283 win 5840 <mss 1460,nop,nop,sackOK>
09:42:18.459116 IP a.4462 > b.8888: . ack 1 win 65535
09:42:18.459202 IP a.4462 > b.8888: P 1:26(25) ack 1 win 65535
09:42:18.459212 IP b.8888 > a.4462: . ack 26 win 5840
09:42:18.512317 IP b.8888 > a.4462: P 1:30(29) ack 26 win 5840
09:42:18.512329 IP b.8888 > a.4462: F 30:30(0) ack 26 win 5840
09:42:18.538132 IP a.4462 > b.8888: . ack 31 win 65506
09:42:18.538165 IP a.4462 > b.8888: F 26:26(0) ack 31 win 65506
09:42:18.538176 IP b.8888 > a.4462: . ack 27 win 5840

the disconnect should have four data packet, that is
a->b F
b->a ack
b->a F
a->b ack
can this show some hints of the problem ?
thanks .

GArlington

unread,
Sep 5, 2008, 7:51:38 AM9/5/08
to
On Sep 5, 5:38 am, "zhangyefei.ye...@gmail.com"

<zhangyefei.ye...@gmail.com> wrote:
> On Sep 5, 2:06 am, David Schwartz <dav...@webmaster.com> wrote:
>
> > On Sep 3, 8:18 pm, "zhangyefei.ye...@gmail.com"
>
> > <zhangyefei.ye...@gmail.com> wrote:
> > > source codes is a little big, can not be showed here .sorry.
> > > but i think my program can not make tcp protocol crazy ?
> > > this is very strange problem ....
> > > who  Encounter the same problem ?
>
> > Your problem description is very typical of programs that lose track
> > of which socket is which.
>
> > DS
>
> thanks very much for your reply.
>
> i found the connect and  disconnect is strange :
> 11:15:06.219049 IP a.3658 > b.8888: S 1561001322:1561001322(0) win
> 65535 <mss 1460,nop,nop,sackOK>
> 11:15:06.219066 IP b.8888 > a.3658: S 415149191:415149191(0) ack
> 1561001323 win 5840 <mss 1460,nop,nop,sackOK>
> 11:15:06.235461 IP a.3658 > b.8888: . ack 1 win 65535
> 11:15:06.235588 IP a.3658 > b.8888: P 1:26(25) ack 1 win 65535
> 11:15:06.235599 IP b.8888 > a.3658: . ack 26 win 5840
> 11:15:06.273787 IP b.8888 > a.3658: P 1:30(29) ack 26 win 5840
> 11:15:06.290251 IP a.3658 > b.8888: F 26:26(0) ack 30 win 65506
> 11:15:06.290793 IP b.8888 > a.3658: F 30:30(0) ack 27 win 5840
> 11:15:06.307142 IP a.3658 > b.8888: . ack 31 win 65506
So your server is sending a packet out of order, without the source
(for disconnect function) it is impossible to say anything more than
what was said before:
"There's a bug in your program" by David Schwartz

Rick Jones

unread,
Sep 5, 2008, 8:15:57 PM9/5/08
to
zhangyef...@gmail.com <zhangyef...@gmail.com> wrote:
> On Sep 5, 2:06?am, David Schwartz <dav...@webmaster.com> wrote:
> > On Sep 3, 8:18?pm, "zhangyefei.ye...@gmail.com"

> >
> > <zhangyefei.ye...@gmail.com> wrote:
> > > source codes is a little big, can not be showed here .sorry.
> > > but i think my program can not make tcp protocol crazy ?
> > > this is very strange problem ....
> > > who ?Encounter the same problem ?

> >
> > Your problem description is very typical of programs that lose track
> > of which socket is which.
> >
> > DS

> thanks very much for your reply.

> i found the connect and disconnect is strange :
> 11:15:06.219049 IP a.3658 > b.8888: S 1561001322:1561001322(0) win
> 65535 <mss 1460,nop,nop,sackOK>
> 11:15:06.219066 IP b.8888 > a.3658: S 415149191:415149191(0) ack
> 1561001323 win 5840 <mss 1460,nop,nop,sackOK>
> 11:15:06.235461 IP a.3658 > b.8888: . ack 1 win 65535
> 11:15:06.235588 IP a.3658 > b.8888: P 1:26(25) ack 1 win 65535
> 11:15:06.235599 IP b.8888 > a.3658: . ack 26 win 5840
> 11:15:06.273787 IP b.8888 > a.3658: P 1:30(29) ack 26 win 5840
> 11:15:06.290251 IP a.3658 > b.8888: F 26:26(0) ack 30 win 65506
> 11:15:06.290793 IP b.8888 > a.3658: F 30:30(0) ack 27 win 5840
> 11:15:06.307142 IP a.3658 > b.8888: . ack 31 win 65506

Looks fine to me. A sends 25 bytes, B's stack ACKs it with a
standalone ACK, B sends a 29 byte reply. A closes his end triggering
a FIN with sequence number 26 and piggybacking the ACK of B's
application response, then B sends a FIN with a piggybacked ACK for
A's FIN. Finally A ACKs B's FIN.

> the normal procedure is such:
> 09:42:18.433265 IP a.4462 > b.8888: S 3208938282:3208938282(0) win
> 65535 <mss 1460,nop,nop,sackOK>
> 09:42:18.433283 IP b.8888 > a.4462: S 3128128512:3128128512(0) ack
> 3208938283 win 5840 <mss 1460,nop,nop,sackOK>
> 09:42:18.459116 IP a.4462 > b.8888: . ack 1 win 65535
> 09:42:18.459202 IP a.4462 > b.8888: P 1:26(25) ack 1 win 65535
> 09:42:18.459212 IP b.8888 > a.4462: . ack 26 win 5840
> 09:42:18.512317 IP b.8888 > a.4462: P 1:30(29) ack 26 win 5840
> 09:42:18.512329 IP b.8888 > a.4462: F 30:30(0) ack 26 win 5840
> 09:42:18.538132 IP a.4462 > b.8888: . ack 31 win 65506
> 09:42:18.538165 IP a.4462 > b.8888: F 26:26(0) ack 31 win 65506
> 09:42:18.538176 IP b.8888 > a.4462: . ack 27 win 5840

> the disconnect should have four data packet, that is
> a->b F
> b->a ack
> b->a F
> a->b ack
> can this show some hints of the problem ?

No. Disconnect does not _have_ to be four distinct TCP segments. It
is perfectly acceptable to have:

a->b FIN
b->a FIN, ACK
a->b ACK

But it does look like in the first trace above, A is first to close,
in the second B is first to close.


--
The computing industry isn't as much a game of "Follow The Leader" as
it is one of "Ring Around the Rosy" or perhaps "Duck Duck Goose."
- Rick Jones
these opinions are mine, all mine; HP might not want them anyway... :)
feel free to post, OR email to rick.jones2 in hp.com but NOT BOTH...

zhangyef...@gmail.com

unread,
Sep 6, 2008, 1:27:15 AM9/6/08
to
On Sep 6, 8:15 am, Rick Jones <rick.jon...@hp.com> wrote:

thanks you so much.
your explanation make me understand tcp connection establishment and
termination better.
it help me resolve my confusion.

Also ,i seems that i found what caused my above problem.
i am new to epoll program.in my server program, i create listen
socket ,and sets the edge triggered( that is EPOLLET ) behavior for
it.
it is a completely wrong usage.
when currently a few new connections comes , server can ony accept a
new connection ,leaving others in connection request queue .

we should use level trigger for listen socket.

Also thanks David Schwartz ,GArlington.
thanks all very much.

0 new messages