getting error: "'build/scratch/ns3.40-project-default' died with <Signals.SIGABRT: 6>."

312 views
Skip to first unread message

Neha Gautam

unread,
May 7, 2024, 4:13:16 AM5/7/24
to ns-3-users
Hello Team,
When I am running the program which I have made in ns3 version 3.40
I get this error:

┌─[neha@parrot]─[~/Desktop/ns-allinone-3.40/ns-3.40]
└──╼ $./ns3 run scratch/project
[  0%] Building CXX object scratch/CMakeFiles/scratch_project.dir/project.cc.o
[  0%] Linking CXX executable /home/neha/Desktop/ns-allinone-3.40/ns-3.40/build/scratch/ns3.40-project-default
NS_ASSERT failed, cond="uid <= m_information.size() && uid != 0", +0.000000000s -1 file=/home/neha/Desktop/ns-allinone-3.40/ns-3.40/src/core/model/type-id.cc, line=459
NS_FATAL, terminating
terminate called without an active exception
Command 'build/scratch/ns3.40-project-default' died with <Signals.SIGABRT: 6>.

Program is:

#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/mobility-model.h"
#include "ns3/mobility-helper.h"
#include "ns3/olsr-helper.h"
#include "ns3/internet-module.h"
#include "ns3/yans-wifi-channel.h"
#include "ns3/yans-wifi-helper.h"
#include "ns3/netanim-module.h"
#include "ns3/flow-monitor-module.h"
#include "ns3/applications-module.h"

using namespace ns3;

NS_LOG_COMPONENT_DEFINE ("FANETExample");

int main (int argc, char *argv[])
{
  CommandLine cmd;
  cmd.Parse (argc, argv);

  NodeContainer nodes;
  nodes.Create (10);

  // Set up Wi-Fi devices and channels
  WifiHelper wifi;
  wifi.SetStandard (WIFI_STANDARD_80211a);
  YansWifiPhyHelper wifiPhy;
  YansWifiChannelHelper wifiChannel;
  wifiPhy.SetChannel (wifiChannel.Create ());
  WifiMacHelper wifiMac;
  wifiMac.SetType ("ns3::AdhocWifiMac");
  NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, nodes);
 
  // Set mobility model for 3D movement
  MobilityHelper mobility;
  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
  for (uint32_t i = 0; i < 10; ++i)
  {
    positionAlloc->Add (Vector (i * 100, i * 100, i * 10)); // Adjust as needed for 3D positioning
  }
  mobility.SetPositionAllocator (positionAlloc);
  mobility.SetMobilityModel ("ns3::RandomWaypointMobilityModel",
                             "Speed", StringValue ("ns3::UniformRandomVariable[Min=0|Max=100]"),
                             "Pause", StringValue ("ns3::ConstantRandomVariable[Constant=2]"),
                             "PositionAllocator", PointerValue (positionAlloc));
  mobility.Install (nodes);

  // Install Internet stack with OLSR routing protocol
  OlsrHelper olsr;
  InternetStackHelper stack;
  stack.SetRoutingHelper (olsr);
  stack.Install (nodes);

  Ipv4AddressHelper address;
  address.SetBase ("10.1.1.0", "255.255.255.0");
  Ipv4InterfaceContainer interfaces = address.Assign (devices);

  // Set up applications
  uint16_t port = 9;
  UdpEchoServerHelper server (port);
  ApplicationContainer serverApp = server.Install (nodes.Get (9));
  serverApp.Start (Seconds (1.0));
  serverApp.Stop (Seconds (10.0));

  UdpEchoClientHelper client (interfaces.GetAddress (9), port);
  client.SetAttribute ("MaxPackets", UintegerValue (1));
  client.SetAttribute ("Interval", TimeValue (Seconds (1.0)));
  client.SetAttribute ("PacketSize", UintegerValue (1024));

  ApplicationContainer clientApp = client.Install (nodes.Get (0));
  clientApp.Start (Seconds (2.0));
  clientApp.Stop (Seconds (10.0));

  // Enable NetAnim
  AnimationInterface anim ("fanet-animation.xml");
  anim.EnablePacketMetadata (true);

  // Enable FlowMonitor
  FlowMonitorHelper flowmon;
  Ptr<FlowMonitor> monitor = flowmon.InstallAll ();

  Simulator::Stop (Seconds (10.0));
  Simulator::Run ();

  // Print per flow statistics
  monitor->SerializeToXmlFile("fanet-flowmon.xml", true, true);

  Simulator::Destroy ();
  return 0;
}

Please help me to resolve this problem

Tommaso Pecorella

unread,
May 7, 2024, 6:19:44 PM5/7/24
to ns-3-users
It's "    YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default();"

Please do not copy-paste examples from older ns-3 versions.

The script issues another error tho, which requires further investigation.

Neha Gautam

unread,
May 8, 2024, 1:00:43 AM5/8/24
to ns-3-users
Hii  Tommaso Pecorella,

After changing the wifi line which you provided in quote I am still receiving the error.

┌─[neha@parrot]─[~/Desktop/ns-allinone-3.40/ns-3.40]
└──╼ $./ns3 run scratch/project
[  0%] Building CXX object scratch/CMakeFiles/scratch_project.dir/project.cc.o
[  0%] Linking CXX executable /home/neha/Desktop/ns-allinone-3.40/ns-3.40/build/scratch/ns3.40-project-default
NS_ASSERT failed, cond="maxEvent", +2.539712451s 0 file=/home/neha/Desktop/ns-allinone-3.40/ns-3.40/src/wifi/model/phy-entity.cc, line=977

NS_FATAL, terminating
terminate called without an active exception
Command 'build/scratch/ns3.40-project-default' died with <Signals.SIGABRT: 6>.

Can you tell me  how do i resolve this .

Tommaso Pecorella

unread,
May 8, 2024, 3:44:42 AM5/8/24
to ns-3-users
That's exactly the error we're investigating (not just me).

Neha Gautam

unread,
May 8, 2024, 4:05:13 AM5/8/24
to ns-3-users
Hello Tommaso Pecorella
Please reply back if you able to find how to resolve this.
Thank you

Tommaso Pecorella

unread,
May 10, 2024, 4:01:23 AM5/10/24
to ns-3-users
Long story short - we'll fix it, but in your script your nodes will stand still.

Using the same ListPositionAllocateor in nodes initial position and in the mobility model leads to this.
Check examples/routing/manet-routing-compare.cc for an example of how to avoid it.
Reply all
Reply to author
Forward
0 new messages