Run-Time Segmentation Fault from WiFi module

168 views
Skip to first unread message

Krishna Bharadwaj Pisupati

unread,
Feb 25, 2022, 3:49:41 AM2/25/22
to ns-3-users
Hi,

I'm simulating a residential network but I wanted to update the per-link fadings every one second. So I have modified the constructor of the BuildingsPropagationLossModel and added a function that schedules for every one second to update the link fadings.

BuildingsPropagationLossModel::BuildingsPropagationLossModel ()
{
  m_randVariable = CreateObject<NormalRandomVariable> ();
  Simulator::Schedule (Time(Seconds(1.0)), &BuildingsPropagationLossModel::UpdateLinkFadings, this);
}

void
BuildingsPropagationLossModel::UpdateLinkFadings (void)
{
  for(auto it = m_shadowingLossMap.begin() ; it != m_shadowingLossMap.end() ; it++)
  {
    for (auto ti = (it->second).begin() ; ti != (it->second).end() ; ti++)
    {
      double sigma = EvaluateSigma (it->first->GetObject <MobilityBuildingInfo> (), ti->first->GetObject <MobilityBuildingInfo> ());
      double shadowingValue = m_randVariable->GetValue (0.0, (sigma*sigma));
      ti->second = ShadowingLoss (shadowingValue, ti->first);  
    }
  }
  Simulator::Schedule (Time(Seconds(1.0)), &BuildingsPropagationLossModel::UpdateLinkFadings, this);
}

I'm getting a segmentation fault if I use this. When I run under the debugger, it says the following error.

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff2f11e4e in std::__detail::_List_node_base::_M_unhook() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6

Please help me in this regard. I'm attaching my modified libraries and script file as a drive link here.

Best Regards,
Krishna.

Krishna Bharadwaj Pisupati

unread,
Mar 3, 2022, 1:24:40 AM3/3/22
to ns-3-users
When I run under gdb and look at the backtrace, this is what I'm getting....

(gdb) backtrace
#0  0x00007ffff2f4de4e in std::__detail::_List_node_base::_M_unhook() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#1  0x00007ffff73fcd56 in std::__cxx11::list<ns3::Ptr<ns3::WifiMacQueueItem>, std::allocator<ns3::Ptr<ns3::WifiMacQueueItem> > >::_M_erase (this=0x555555826650, __position=Python Exception <class 'AttributeError'> 'NoneType' object has no attribute 'pointer':
) at /usr/include/c++/9/bits/stl_list.h:1918
#2  0x00007ffff73fb6db in std::__cxx11::list<ns3::Ptr<ns3::WifiMacQueueItem>, std::allocator<ns3::Ptr<ns3::WifiMacQueueItem> > >::erase
    (this=0x555555826650, Python Exception <class 'AttributeError'> 'NoneType' object has no attribute 'pointer':
__position=) at /usr/include/c++/9/bits/list.tcc:158
#3  0x00007ffff756c50d in ns3::BlockAckManager::HandleInFlightMpdu (this=0x555555736fa0, Python Exception <class 'AttributeError'> 'NoneType' object has no attribute 'pointer':
mpduIt=,
    status=ns3::BlockAckManager::ACKNOWLEDGED, Python Exception <class 'AttributeError'> 'NoneType' object has no attribute 'pointer':
it=..., now=...) at ../src/wifi/model/block-ack-manager.cc:390
#4  0x00007ffff756d7f4 in ns3::BlockAckManager::NotifyGotAck (this=0x555555736fa0, mpdu=...)
    at ../src/wifi/model/block-ack-manager.cc:452
#5  0x00007ffff738d5d1 in ns3::HtFrameExchangeManager::NotifyReceivedNormalAck (this=0x555555738bd0, mpdu=...)
    at ../src/wifi/model/ht/ht-frame-exchange-manager.cc:540
#6  0x00007ffff7371462 in ns3::FrameExchangeManager::ReceivedNormalAck (this=0x555555738bd0, mpdu=..., txVector=..., ackTxVector=...,
    rxInfo=..., snr=2131.4668261754341) at ../src/wifi/model/frame-exchange-manager.cc:1128
#7  0x00007ffff73702a6 in ns3::FrameExchangeManager::ReceiveMpdu (this=0x555555738bd0, mpdu=..., rxSignalInfo=..., txVector=...,
    inAmpdu=false) at ../src/wifi/model/frame-exchange-manager.cc:1080
#8  0x00007ffff73843aa in ns3::QosFrameExchangeManager::ReceiveMpdu (this=0x555555738bd0, mpdu=..., rxSignalInfo=..., txVector=...,
    inAmpdu=false) at ../src/wifi/model/qos-frame-exchange-manager.cc:717
#9  0x00007ffff739b0a4 in ns3::HtFrameExchangeManager::ReceiveMpdu (this=0x555555738bd0, mpdu=..., rxSignalInfo=..., txVector=...,
    inAmpdu=false) at ../src/wifi/model/ht/ht-frame-exchange-manager.cc:1385
#10 0x00007ffff736d485 in ns3::FrameExchangeManager::Receive (this=0x555555738bd0, psdu=..., rxSignalInfo=..., txVector=...,
    perMpduStatus=std::vector<bool> of length 1, capacity 64 = {...}) at ../src/wifi/model/frame-exchange-manager.cc:941
#11 0x00007ffff7377b87 in ns3::MemPtrCallbackImpl<ns3::FrameExchangeManager*, void (ns3::FrameExchangeManager::*)(ns3::Ptr<ns3::WifiPsdu>, ns3::RxSignalInfo, ns3::WifiTxVector, std::vector<bool, std::allocator<bool> >), void, ns3::Ptr<ns3::WifiPsdu>, ns3::RxSignalInfo, ns3::WifiTxVector, std::vector<bool, std::allocator<bool> >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::operator() (
    this=0x5555557391c0, a1=..., a2=..., a3=..., a4=std::vector<bool> of length 1, capacity 64 = {...}) at ./ns3/callback.h:657
#12 0x00007ffff72dc318 in ns3::Callback<void, ns3::Ptr<ns3::WifiPsdu>, ns3::RxSignalInfo, ns3::WifiTxVector, std::vector<bool, std::allocator<bool> >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::operator() (this=0x555555734190, a1=..., a2=..., a3=...,
    a4=std::vector<bool> of length 1, capacity 64 = {...}) at ./ns3/callback.h:1441
#13 0x00007ffff72d77ca in ns3::WifiPhyStateHelper::SwitchFromRxEndOk (this=0x5555557340a0, psdu=..., rxSignalInfo=..., txVector=...,
    staId=65535, statusPerMpdu=std::vector<bool> of length 1, capacity 64 = {...}) at ../src/wifi/model/wifi-phy-state-helper.cc:499
#14 0x00007ffff7614f7e in ns3::PhyEntity::EndReceivePayload (this=0x5555557349b0, event=...) at ../src/wifi/model/phy-entity.cc:657
#15 0x00007ffff76201ad in ns3::MakeEvent<void (ns3::PhyEntity::*)(ns3::Ptr<ns3::Event>), ns3::PhyEntity*, ns3::Ptr<ns3::Event> >(void (ns3::PhyEntity::*)(ns3::Ptr<ns3::Event>), ns3::PhyEntity*, ns3::Ptr<ns3::Event>)::EventMemberImpl1::Notify() (this=0x5555558105c0)
    at ./ns3/make-event.h:405

I understood that the HandleInFlightMpdu function is getting a NULL pointer and that's throwing segmentation fault but I don't understand why is this occurring somewhere in the middle of the simulation. Also, I don't understand why are the Python Exceptions are arising in the C++ functional arguments.

Xueqing Zhou

unread,
Aug 22, 2022, 12:45:23 PM8/22/22
to ns-3-users

I also meet the same problem, it happens after a long time simulation. Do you have any idea to sove it? Thanks!

assert failed. cond="hdr.GetAddr1 () == it->first.first", +266.510633856s 21 file=../src/wifi/model/block-ack-manager.cc, line=396
terminate called without an active exception

Reply all
Reply to author
Forward
0 new messages