Bug 287 - Simple device/channel call stack issue
Simple device/channel call stack issue
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: devices
ns-3.1
All All
: P3 normal
Assigned To: ns-bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-08-14 20:51 EDT by Rajib Bhattacharjea
Modified: 2008-08-15 11:40 EDT (History)
0 users

See Also:


Attachments
ScheduleNow instead of calling up the rx side (575 bytes, patch)
2008-08-14 20:55 EDT, Rajib Bhattacharjea
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rajib Bhattacharjea 2008-08-14 20:51:21 EDT
The SimpleChannel and SimpleNetDevice are forwarding devices such that SimpleNetDevice::Send calls SimpleChannel::Send, which calls SimpleNetDevice::Receive on the other end.  This means that the call stack resulting from invoking a Scheduler event can contain all the calls down the network stack AND all the upcalls up the network stack on the other side.  So potentially, packets can be received at the other node before the state on the sender side has been fully updated to reflect having sent the data.  E.g. in the case of TCP, the ACK comes back before the call to Socket::Send completes, wreaking havoc.

There is a potential stack overflow issue as well if both sides send data back in response.

It seems to make sense to break this call stack issue at the line between the Channel::Send and the NetDevice::Receive on the other end.  The NetDevice::Receive could be scheduled with Simulator::ScheduleNow(...) so that it logically occurs at the "now" time, but allows the call stack to unravel up to the next Scheduler event.
Comment 1 Rajib Bhattacharjea 2008-08-14 20:55:42 EDT
Created attachment 229 [details]
ScheduleNow instead of calling up the rx side

Is it just this easy?  Anyone opposed to pushing this?
Comment 2 Mathieu Lacage 2008-08-15 01:43:47 EDT
(In reply to comment #1)
> Created an attachment (id=229) [details]
> ScheduleNow instead of calling up the rx side
> 
> Is it just this easy?  Anyone opposed to pushing this?


looks good to me.

Comment 3 Rajib Bhattacharjea 2008-08-15 11:40:56 EDT
fixed
3534:e170f2c17e03