Bug 174 - tcp now fails to send in the backward direction. (orginally it hung)
: tcp now fails to send in the backward direction. (orginally it hung)
Status: RESOLVED FIXED
: ns-3
internet-stack
: pre-release
: All Linux
: P1 normal
Assigned To:
:
: bug
:
:
  Show dependency treegraph
 
Reported: 2008-04-19 16:10 EDT by
Modified: 2008-06-05 16:42 EDT (History)


Attachments
version of tcp-tester than shows the tcp hang problem. (10.78 KB, text/plain)
2008-04-19 16:12 EDT, evensky@dancer.ca.sandia.gov
Details
new test case updated to the latest API (10.67 KB, text/plain)
2008-05-19 11:16 EDT, Rajib Bhattacharjea
Details
simple two way tcp test program using what I guess is the current API. (8.67 KB, text/x-c++src)
2008-06-04 03:17 EDT, evensky@dancer.ca.sandia.gov
Details
same program as before only now with more tags and a header. (14.79 KB, text/plain)
2008-06-05 16:03 EDT, evensky@dancer.ca.sandia.gov
Details


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2008-04-19 16:10:50 EDT
I'll attach a test case below. Note that it hangs when run as
   tcp-tester 2 44489
but doesn't hang with '2 44488' There are other ranges that it hangs at  too
(e.g. '2 44489'). If I run in gdb and I do a "break ns3::TcpSocket::Retransmit"
we seem to end of there a lot. :-) This version prints out the number of bytes
in the buffer that we have read  keyed by a fill character (S or R).
Compile---%<-------------------%<----------%<----------%<----------%<---------%<
g++ -DNS3_ASSERT_ENABLE -DNS3_LOG_ENABLE -DDEBUG -g -O0
-I/.../ns-3-dev/build/debug -I/.../ns-3-dev/build/debug -I.
-L/.../ns-3-dev/build/debug -lns3 -Wl,-rpath=/.../ns-3-dev/build/debug
 -o tcp-tester tcp-tester.cc
Output---%<-------------------%<----------%<----------%<----------%<---------%<
$ ./tcp-tester 2 44489
TalkerApp::ConfSend(0x62fac0,0a:01:00:02:20:00,2) Client
TalkerApp::ConfRecv(0x630480,00:00:00:00:20:00,44489) Server
TalkerApp::StartApplication() Client
TalkerApp::StartApplicationSend() Client
writing buffer (SHello) Client
TalkerApp::StartApplication() Server
TalkerApp::StartApplicationRecv() Server
TalkerApp::ConnectionRequested(): Server
TalkerApp::ConnectionSucceeded(): Client
TalkerApp::ConnectionCreated(): Server
Received    2 bytes from 10.1.0.1 [0a:01:00:01:01:c0]    1:S           S(    
2)
writing buffer (RBackAtYou) Server
Received  536 bytes from 10.1.0.2 [0a:01:00:02:20:00]   10:RBackAtYou  R(  
536)
Received  536 bytes from 10.1.0.2 [0a:01:00:02:20:00]  536:R{536}      R( 
1072)
Received  536 bytes from 10.1.0.2 [0a:01:00:02:20:00]  536:R{536}      R( 
1608)
....
Received  536 bytes from 10.1.0.2 [0a:01:00:02:20:00]  536:R{536}      R(
40200)
Received  536 bytes from 10.1.0.2 [0a:01:00:02:20:00]  536:R{536}      R(
40736)
Received  536 bytes from 10.1.0.2 [0a:01:00:02:20:00]  536:R{536}      R(
41272)
Received  536 bytes from 10.1.0.2 [0a:01:00:02:20:00]  536:R{536}      R(
41808)
Received  536 bytes from 10.1.0.2 [0a:01:00:02:20:00]  536:R{536}      R(
42344)
Received  536 bytes from 10.1.0.2 [0a:01:00:02:20:00]  536:R{536}      R(
42880)
Received  536 bytes from 10.1.0.2 [0a:01:00:02:20:00]  536:R{536}      R(
43416)
Received  536 bytes from 10.1.0.2 [0a:01:00:02:20:00]  536:R{536}      R(
43952)
Received  536 bytes from 10.1.0.2 [0a:01:00:02:20:00]  536:R{536}      R(
44488)
Received    1 bytes from 10.1.0.2 [0a:01:00:02:20:00]    1:R           R(
44489)
<< it hangs here>>
------- Comment #1 From 2008-04-19 16:12:07 EDT -------
Created an attachment (id=131) [details]
version of tcp-tester than shows the tcp hang problem.
------- Comment #2 From 2008-05-19 11:16:49 EDT -------
Created an attachment (id=134) [details]
new test case updated to the latest API

I evaluated your test case, and I seem not to get any hang at all:
raj@raj-desktop:~/Desktop/ns-3 Files/bug174$ ./tcp-tester 2 44489
TalkerApp::ConfSend(0x8069338,02-06-0a:01:00:02:20:00,2) Client
TalkerApp::ConfRecv(0x80696e0,02-06-00:00:00:00:20:00,44489) Server
TalkerApp::StartApplication() Client
TalkerApp::StartApplicationSend() Client
writing buffer (SHello) Client
TalkerApp::StartApplication() Server
TalkerApp::StartApplicationRecv() Server
TalkerApp::ConnectionRequested(): Server
TalkerApp::ConnectionSucceeded(): Client
TalkerApp::ConnectionCreated(): Server
Received    2 bytes from 10.1.0.1 [02-06-0a:01:00:01:01:c0]    1:S           S(
    2)
writing buffer (RBackAtYou) Server
Received  536 bytes from 10.1.0.2 [02-06-0a:01:00:02:20:00]   10:RBackAtYou  R(
  536)
Received  536 bytes from 10.1.0.2 [02-06-0a:01:00:02:20:00]  536:R{536}      R(
 1072)
Received  536 bytes from 10.1.0.2 [02-06-0a:01:00:02:20:00]  536:R{536}      R(
 1608)
...
Received  536 bytes from 10.1.0.2 [02-06-0a:01:00:02:20:00]  536:R{536}      R(
40200)
Received  536 bytes from 10.1.0.2 [02-06-0a:01:00:02:20:00]  536:R{536}      R(
40736)
Received  536 bytes from 10.1.0.2 [02-06-0a:01:00:02:20:00]  536:R{536}      R(
41272)
Received  536 bytes from 10.1.0.2 [02-06-0a:01:00:02:20:00]  536:R{536}      R(
41808)
Received  536 bytes from 10.1.0.2 [02-06-0a:01:00:02:20:00]  536:R{536}      R(
42344)
Received  536 bytes from 10.1.0.2 [02-06-0a:01:00:02:20:00]  536:R{536}      R(
42880)
Received  536 bytes from 10.1.0.2 [02-06-0a:01:00:02:20:00]  536:R{536}      R(
43416)
Received  536 bytes from 10.1.0.2 [02-06-0a:01:00:02:20:00]  536:R{536}      R(
43952)
Received  536 bytes from 10.1.0.2 [02-06-0a:01:00:02:20:00]  536:R{536}      R(
44488)
Received    1 bytes from 10.1.0.2 [02-06-0a:01:00:02:20:00]    1:R           R(
44489)

And it exits normally at that point.  I had to SLIGHTLY modify the code you
posted to make it compile under a few helper API changes, and I removed the
GetUid API of your tag class, as it appears this is incompatible with the
newest ns-3-dev and didn't appear to be used in this test case.  I've attached
my updated version.

Can you confirm that you are still having the same hanging issue?
------- Comment #3 From 2008-05-19 13:55:24 EDT -------
Issue appears to be resolved.  David Evensky reports off tracker that:
> It appears to be fixed. [snip]
> [I] beat on it pretty hard (moved 10K bytes in forward direction and
10M bytes in the backward direction) and it worked great.

Marking the bug as fixed.
------- Comment #4 From 2008-06-04 03:17:42 EDT -------
Created an attachment (id=145) [details]
simple two way tcp test program using what I guess is the current API.

I can't tell where the bug is in my code or ns-3-dev, the docs for Socket seems
to have disappeared from doxygen generated web pages. I think I'm using the API
correctly using the force (aka looking at the source), but I'm not sure. I
would like to see some sort of bi-direction test added to ns-3 distro so that
this sort of functionality gets tested.

This program should send bytes both ways, but it doesn't it only send bytes the
forward direction.

Output:

evensky@waltz$ ./tcp-tester 600 700
TalkerApp::ConfSend(0x62d780,02-06-0a:01:00:02:20:00,600) Client
TalkerApp::ConfRecv(0x62de10,02-06-00:00:00:00:20:00,700) Server
TalkerApp::StartApplication() Client
TalkerApp::StartApplicationSend() Client
TalkerApp::SendPacket(Hello,S,600) Client
TalkerApp::StartApplication() Server
TalkerApp::StartApplicationRecv() Server
TalkerApp::ConnectionRequested(0x632cd0,02-06-0a:01:00:01:01:c0): Server
TalkerApp::ConnectionSucceeded(0x6312c0): Client
TalkerApp::ConnectionCreated(0x6333e0,02-06-0a:01:00:01:01:c0): Server
TalkerApp::HandleRead(0x6333e0): Server
TalkerApp::SendPacket(BackAtYou,R,700) Server
 536 bytes from 10.1.0.1 [02-06-0a:01:00:01:01:c0]  Payload
(size=536)|ns3::SocketRxAddressTag [0-536] address=00-00-00
TalkerApp::HandleRead(0x6333e0): Server
  64 bytes from 10.1.0.1 [02-06-0a:01:00:01:01:c0]  Payload
(size=64)|ns3::SocketRxAddressTag [0-64] address=00-00-00

What does the 02-06 part of the mac addr mean? What is the address tag in the
packet used for?

Thanks,
\dae
------- Comment #5 From 2008-06-04 09:08:29 EDT -------
(In reply to comment #4)
> Created an attachment (id=145) [edit] [details]
> simple two way tcp test program using what I guess is the current API.
> 
> I can't tell where the bug is in my code or ns-3-dev, the docs for Socket seems
> to have disappeared from doxygen generated web pages. I think I'm using the API

yes, a lot of docs seem to have disapeared from the output. We need another bug
to track that issue.

> correctly using the force (aka looking at the source), but I'm not sure. I
> would like to see some sort of bi-direction test added to ns-3 distro so that
> this sort of functionality gets tested.

would you mind provide one ?

> 
> This program should send bytes both ways, but it doesn't it only send bytes the
> forward direction.
> 
> Output:
> 
> evensky@waltz$ ./tcp-tester 600 700
> TalkerApp::ConfSend(0x62d780,02-06-0a:01:00:02:20:00,600) Client
> TalkerApp::ConfRecv(0x62de10,02-06-00:00:00:00:20:00,700) Server
> TalkerApp::StartApplication() Client
> TalkerApp::StartApplicationSend() Client
> TalkerApp::SendPacket(Hello,S,600) Client
> TalkerApp::StartApplication() Server
> TalkerApp::StartApplicationRecv() Server
> TalkerApp::ConnectionRequested(0x632cd0,02-06-0a:01:00:01:01:c0): Server
> TalkerApp::ConnectionSucceeded(0x6312c0): Client
> TalkerApp::ConnectionCreated(0x6333e0,02-06-0a:01:00:01:01:c0): Server
> TalkerApp::HandleRead(0x6333e0): Server
> TalkerApp::SendPacket(BackAtYou,R,700) Server
>  536 bytes from 10.1.0.1 [02-06-0a:01:00:01:01:c0]  Payload
> (size=536)|ns3::SocketRxAddressTag [0-536] address=00-00-00
> TalkerApp::HandleRead(0x6333e0): Server
>   64 bytes from 10.1.0.1 [02-06-0a:01:00:01:01:c0]  Payload
> (size=64)|ns3::SocketRxAddressTag [0-64] address=00-00-00
> 
> What does the 02-06 part of the mac addr mean? What is the address tag in the
> packet used for?

the 02-06 part identifies the type (02: Mac48 on your system) and the length
(06 bytes). The address tag is used to provide the to address to the Send
(Ptr<Packet> p) function.
------- Comment #6 From 2008-06-04 11:45:19 EDT -------
[my email reply didn't seem to make it to bugzilla, so.... ]

Should I create a seperate bug report for the missing docs?

I'll be happy to modify this program, once its working, to be used as a test
case.

Thanks,
\dae
------- Comment #7 From 2008-06-04 12:02:00 EDT -------
(In reply to comment #6)

> Should I create a seperate bug report for the missing docs?

see bug 202.
------- Comment #8 From 2008-06-04 16:21:39 EDT -------
Fixed in ns-3-dev 3229:ec45f705b9ca

Looks like the cutover to finite buffers caused some casualties...
------- Comment #9 From 2008-06-04 17:47:34 EDT -------
It seems to work now. Thanks. I'm thinking about adding some tag stuff in so
that when tags are preserved there will be a good test case.

Also, any suggestions on what I should change/fix to turn this into an official
ns-3 regression test? (e.g. coding standards, output requirements, etc.)

Thanks again,
\dae
------- Comment #10 From 2008-06-04 18:10:55 EDT -------
(In reply to comment #9)
> It seems to work now. Thanks. I'm thinking about adding some tag stuff in so
> that when tags are preserved there will be a good test case.
> 
> Also, any suggestions on what I should change/fix to turn this into an official
> ns-3 regression test? (e.g. coding standards, output requirements, etc.)

we don't have any formal requirements but here are a few thinks I consider to
be nice:
  - does not generate large output traces
  - runs as fast as possible (can ideally be run not too slowly under valgrind)

Then, the way you integrate your script is by adding a second python script to
the regression/tests/ directory and the reference traces to
regression/ns-3-dev-traces/
------- Comment #11 From 2008-06-05 16:03:33 EDT -------
Created an attachment (id=150) [details]
same program as before only now with more tags and a header.

For some reason the Header that I add in MarkPacket doesn't seem to make it
across the TCP socket. Also, in MarkPacket (on the Tx side), the Packet::Print
doesn't print the tag.
------- Comment #12 From 2008-06-05 16:42:30 EDT -------
(In reply to comment #11)
> Created an attachment (id=150) [edit] [details]
> same program as before only now with more tags and a header.
> 
> For some reason the Header that I add in MarkPacket doesn't seem to make it
> across the TCP socket. Also, in MarkPacket (on the Tx side), the Packet::Print

It does make it and, if you remove it with RemoveHeader, you will find it. What
does not make it is the metadata so Packet::Print cannot print the content of
the packet but the content should be right if you call Packet::RemoveHeader.

> doesn't print the tag.

Packet::Print does not print tags. Packet::PrintTags prints the tags.

Although I agreed that you add this report to this old bug, I think that it
would be better in the future to file new bugs :)