Bug 1468

Summary: Command terminated with SIGSEV signal
Product: ns-3 Reporter: sf_b89
Component: generalAssignee: ns-bugs <ns-bugs>
Status: RESOLVED INVALID    
Severity: major CC: mathieu.lacage
Priority: P5    
Version: ns-3.13   
Hardware: PC   
OS: Linux   
Attachments: A folder containing the main plus the Propotional_Fair algorithm .cc and .h

Description sf_b89 2012-07-09 05:07:43 UTC
Created attachment 1418 [details]
A folder containing the main plus the Propotional_Fair algorithm .cc and .h

I would like to call periodically a function in the main program. I use for this purpose the Simulator::Schedule method, but the function is called no more than once or twice, then I have an error message as follows:
Command['/root/tarballs/ns-3allinone-3.13/ns-3.13/build/scatch/ultimate-topology] terminated with signal SIGSEV. 
I add my code as an attachment for more details.  
Thank you very much in advance for your help.
Comment 1 Mathieu Lacage 2012-07-09 05:52:38 UTC
please, a backtrace.
Comment 2 sf_b89 2012-07-10 06:56:04 UTC
Dear Mister Lacage, here the backtrace:

(gdb) backtrace
No stack.
(gdb) run
Starting program: /root/tarballs/ns-allinone-3.13/ns-3.13/build/scratch/ultimate-topology 
[Thread debugging using libthread_db enabled]
I am creating the topology
I am creating the applications
I'm creating the flow monitor probes!!
I am running the simulation 
No problem in displaying the content of CQI vector
I calculated the IMCS from the CQI
I calculated the data rate of the scheduled user:0
I calculated the data rate of the non scheduled user:1
 I assigned the data rates to the channels
 I am scheduling for the next round
assert failed. cond="tAbsolute.IsPositive ()", file=../src/core/model/default-simulator-impl.cc, line=193

Program received signal SIGSEGV, Segmentation fault.
0xb692c9d2 in std::list<std::ostream*, std::allocator<std::ostream*> >::empty (this=0x0) at /usr/include/c++/4.4/bits/stl_list.h:800
800	      { return this->_M_impl._M_node._M_next == &this->_M_impl._M_node; }
(gdb) backtrace
#0  0xb692c9d2 in std::list<std::ostream*, std::allocator<std::ostream*> >::empty (this=0x0)
    at /usr/include/c++/4.4/bits/stl_list.h:800
#1  0xb692c6dd in ns3::FatalImpl::FlushStreams () at ../src/core/model/fatal-impl.cc:127
#2  0xb68dd728 in ns3::DefaultSimulatorImpl::Schedule (this=0x80ad0b8, time=..., event=0x80b65e8)
    at ../src/core/model/default-simulator-impl.cc:193
#3  0xb68d9724 in ns3::Simulator::DoSchedule (time=..., impl=0x80b65e8) at ../src/core/model/simulator.cc:230
#4  0xb6fd661f in ns3::Simulator::Schedule<void (ns3::MySimpleNetDevice::*)(), ns3::MySimpleNetDevice*> (time=..., 
    mem_ptr=0xb6fd2fae <ns3::MySimpleNetDevice::TransmitComplete()>, obj=0x80b0e48) at ./ns3/simulator.h:808
#5  0xb6fd2e81 in ns3::MySimpleNetDevice::TransmitStart (this=0x80b0e48, p=...)
    at ../src/simple-solution/model/my-simple-net-device.cc:481
#6  0xb6fd2197 in ns3::MySimpleNetDevice::Send (this=0x80b0e48, packet=..., dest=..., protocolNumber=2048)
    at ../src/simple-solution/model/my-simple-net-device.cc:390
#7  0xb71b164a in ns3::Ipv4Interface::Send (this=0x80b4f48, p=..., dest=...) at ../src/internet/model/ipv4-interface.cc:277
#8  0xb71bfa6a in ns3::Ipv4L3Protocol::SendRealOut (this=0x80b2a50, route=..., packet=..., ipHeader=...)
    at ../src/internet/model/ipv4-l3-protocol.cc:768
#9  0xb71c11b3 in ns3::Ipv4L3Protocol::IpForward (this=0x80b2a50, rtentry=..., p=..., header=...)
    at ../src/internet/model/ipv4-l3-protocol.cc:842
#10 0xb71d6381 in ns3::MemPtrCallbackImpl<ns3::Ipv4L3Protocol*, void (ns3::Ipv4L3Protocol::*)(ns3::Ptr<ns3::Ipv4Route>, ns3::Ptr<ns3::Packet const>, ns3::Ipv4Header const&), void, ns3::Ptr<ns3::Ipv4Route>, ns3::Ptr<ns3::Packet const>, ns3::Ipv4Header const&, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::operator() (this=0x80baaa0, a1=..., a2=..., a3=...)
    at ./ns3/callback.h:229
#11 0xb7fbe682 in ns3::Callback<void, ns3::Ptr<ns3::Ipv4Route>, ns3::Ptr<ns3::Packet const>, ns3::Ipv4Header const&, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::operator() (this=0xbfffe168, a1=..., a2=..., a3=...) at ./ns3/callback.h:416
#12 0xb731e73b in ns3::Ipv4StaticRouting::RouteInput (this=0x80b2d78, p=..., ipHeader=..., idev=..., ucb=..., mcb=..., lcb=..., 
    ecb=...) at ../src/internet/model/ipv4-static-routing.cc:570
#13 0xb730737b in ns3::Ipv4ListRouting::RouteInput (this=0x80b2d10, p=..., header=..., idev=..., ucb=..., mcb=..., lcb=..., ecb=...)
    at ../src/internet/model/ipv4-list-routing.cc:176
#14 0xb71bb804 in ns3::Ipv4L3Protocol::Receive (this=0x80b2a50, device=..., p=..., protocol=2048, from=..., to=..., packetType=0)
---Type <return> to continue, or q <return> to quit---
    at ../src/internet/model/ipv4-l3-protocol.cc:498
#15 0xb71d6822 in ns3::MemPtrCallbackImpl<ns3::Ipv4L3Protocol*, void (ns3::Ipv4L3Protocol::*)(ns3::Ptr<ns3::NetDevice>, ns3::Ptr<ns3::Packet const>, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType), void, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<ns3::Packet const>, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty>::operator() (this=0x80b4f18, a1=..., a2=..., a3=2048, a4=..., a5=..., a6=0) at ./ns3/callback.h:238
#16 0xb6a17e41 in ns3::Callback<void, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<ns3::Packet const>, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty>::operator() (this=0x80b5248, a1=..., a2=..., 
    a3=2048, a4=..., a5=..., a6=0) at ./ns3/callback.h:425
#17 0xb6a15550 in ns3::Node::ReceiveFromDevice (this=0x80ad390, device=..., packet=..., protocol=2048, from=..., to=..., 
    packetType=0, promiscuous=false) at ../src/network/model/node.cc:290
#18 0xb6a14fe9 in ns3::Node::NonPromiscReceiveFromDevice (this=0x80ad390, device=..., packet=..., protocol=2048, from=...)
    at ../src/network/model/node.cc:264
#19 0xb6a1d132 in ns3::MemPtrCallbackImpl<ns3::Node*, bool (ns3::Node::*)(ns3::Ptr<ns3::NetDevice>, ns3::Ptr<ns3::Packet const>, unsigned short, ns3::Address const&), bool, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<ns3::Packet const>, unsigned short, ns3::Address const&, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::operator() (this=0x80adae0, a1=..., a2=..., a3=2048, a4=...)
    at ./ns3/callback.h:232
#20 0xb7e3efd7 in ns3::Callback<bool, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<ns3::Packet const>, unsigned short, ns3::Address const&, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::operator() (this=0x80ae1e0, a1=..., a2=..., a3=2048, a4=...)
    at ./ns3/callback.h:419
#21 0xb6f7396d in ns3::PointToPointNetDevice::Receive (this=0x80ae138, packet=...)
    at ../src/point-to-point/model/point-to-point-net-device.cc:344
#22 0xb6f8115c in Notify (this=0x80b93d0) at ./ns3/make-event.h:124
#23 0xb68d7dc4 in ns3::EventImpl::Invoke (this=0x80b93d0) at ../src/core/model/event-impl.cc:39
#24 0xb68dd2ae in ns3::DefaultSimulatorImpl::ProcessOneEvent (this=0x80ad0b8) at ../src/core/model/default-simulator-impl.cc:129
#25 0xb68dd48c in ns3::DefaultSimulatorImpl::Run (this=0x80ad0b8) at ../src/core/model/default-simulator-impl.cc:159
#26 0xb68d8973 in ns3::Simulator::Run () at ../src/core/model/simulator.cc:163
#27 0x08059f7a in main (argc=1, argv=0xbffff2f4) at ../scratch/ultimate-topology.cc:406
Comment 3 Mathieu Lacage 2012-07-10 13:00:56 UTC
(In reply to comment #2)
> assert failed. cond="tAbsolute.IsPositive ()",
> file=../src/core/model/default-simulator-impl.cc, line=193
> 

[... random junk ...]

> #4  0xb6fd661f in ns3::Simulator::Schedule<void (ns3::MySimpleNetDevice::*)(),
> ns3::MySimpleNetDevice*> (time=..., 
>     mem_ptr=0xb6fd2fae <ns3::MySimpleNetDevice::TransmitComplete()>,
> obj=0x80b0e48) at ./ns3/simulator.h:808
> #5  0xb6fd2e81 in ns3::MySimpleNetDevice::TransmitStart (this=0x80b0e48, p=...)
>     at ../src/simple-solution/model/my-simple-net-device.cc:481


I have no idea what kind of code can be found in this MySimpleDevice class but the schedule that is triggering the assert is located here so, if I were you, I would check in here first.
Comment 4 sf_b89 2012-07-13 04:11:24 UTC
Thank you very much Sir for the advice. 
To figure out the issue, I replaced the classes that I wrote: "MySimpleNetDevice" and "MySimpleChannel" with the NS3 classes "PointToPointNetDevice" and "PointToPointChannel" and in the backtrace I get the same error concerning the schedule function: 
#1  0xb692c6dd in ns3::FatalImpl::FlushStreams () at
../src/core/model/fatal-impl.cc:127
#2  0xb68dd728 in ns3::DefaultSimulatorImpl::Schedule (this=0x80ad0b8,
time=..., event=0x80b65e8)
    at ../src/core/model/default-simulator-impl.cc:193
#3  0xb68d9724 in ns3::Simulator::DoSchedule (time=..., impl=0x80b65e8) at
../src/core/model/simulator.cc:230
#4  0xb6fd661f in ns3::Simulator::Schedule<void (ns3::PointToPointNetDevice::*)(),
ns3::PointToPointNetDevice*> (time=..., 
    mem_ptr=0xb6fd2fae <ns3::PointToPointNetDevice::TransmitComplete()>,
obj=0x80b0e48) at ./ns3/simulator.h:808

I my project, I would like to emulate the Proportional Fair algorithm behavior in fixed networks. So the data rates' channels vary each TTI (1 ms). I would like please your help to interpret the backtrace resulats: does it mean that the problem arises when I change the net device's data rate while the packet is being transmitted? 
Thank you very much for your help Sir. 
Cordially.
Comment 5 Mathieu Lacage 2012-07-13 05:46:25 UTC
(In reply to comment #4)
> Thank you very much Sir for the advice. 
> To figure out the issue, I replaced the classes that I wrote:
> "MySimpleNetDevice" and "MySimpleChannel" with the NS3 classes
> "PointToPointNetDevice" and "PointToPointChannel" and in the backtrace I get
> the same error concerning the schedule function: 
> #1  0xb692c6dd in ns3::FatalImpl::FlushStreams () at
> ../src/core/model/fatal-impl.cc:127
> #2  0xb68dd728 in ns3::DefaultSimulatorImpl::Schedule (this=0x80ad0b8,
> time=..., event=0x80b65e8)
>     at ../src/core/model/default-simulator-impl.cc:193
> #3  0xb68d9724 in ns3::Simulator::DoSchedule (time=..., impl=0x80b65e8) at
> ../src/core/model/simulator.cc:230
> #4  0xb6fd661f in ns3::Simulator::Schedule<void
> (ns3::PointToPointNetDevice::*)(),
> ns3::PointToPointNetDevice*> (time=..., 
>     mem_ptr=0xb6fd2fae <ns3::PointToPointNetDevice::TransmitComplete()>,
> obj=0x80b0e48) at ./ns3/simulator.h:808
> 
> I my project, I would like to emulate the Proportional Fair algorithm behavior
> in fixed networks. So the data rates' channels vary each TTI (1 ms). I would
> like please your help to interpret the backtrace resulats: does it mean that
> the problem arises when I change the net device's data rate while the packet is
> being transmitted? 

I have no idea about what is going on but yes, changing the data rate while a packet is being transmitted sounds like it might trigger this kind of problem. Anyway, this is clearly not a bug in ns-3 but more likely in some other piece of third-party code. I would suggest you move this discussion to our help mailing-list.