Re: Segementation Fault

286 views
Skip to first unread message

sai gautams

unread,
Jun 8, 2021, 12:43:40 AM6/8/21
to ns-3-users
Hi all,

I hope you are well. In my ndnSIM I tried creating an on-off application by changing the frequencies in the consumerHelper. When I try building I get a segmentation fault related to ns-3 ptr. Can anyone please explain to me the fault I'm getting.If anyone can help recognizing the fault in my code that would be helpful.   

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7f555ba in ns3::Ptr<ns3::NetDevice>::Ptr (this=0xf800005555556b8f, o=...) at ./ns3/ptr.h:741
741      : m_ptr (PeekPointer (o))

Tom Henderson

unread,
Jun 8, 2021, 12:53:18 AM6/8/21
to ns-3-...@googlegroups.com, sai gautams
gdb may shed some light on the invalid pointer that you appear to have.
Please look at:
https://www.nsnam.org/wiki/HOWTO_use_gdb_to_debug_program_errors

- Tom
> --
> Posting to this group should follow these guidelines
> https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
> <https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting>
> ---
> You received this message because you are subscribed to the Google
> Groups "ns-3-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to ns-3-users+...@googlegroups.com
> <mailto:ns-3-users+...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ns-3-users/0a6f7ed1-3a66-4317-86b1-76e2052f6bb6n%40googlegroups.com
> <https://groups.google.com/d/msgid/ns-3-users/0a6f7ed1-3a66-4317-86b1-76e2052f6bb6n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Bharat Agarwal

unread,
Jun 8, 2021, 12:54:03 AM6/8/21
to ns-3-...@googlegroups.com
U are trying to retrieve data from memory which has not assigned.

Possibly due to assigning more number of UEs but not using them or same for BS.

This error is something related to zero pointer.

Share ur code please 

--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ns-3-users/0a6f7ed1-3a66-4317-86b1-76e2052f6bb6n%40googlegroups.com.

Séanadh Ríomhphoist/

Email Disclaimer

Tá an ríomhphost seo agus aon chomhad a sheoltar leis faoi rún agus is lena úsáid ag an seolaí agus sin amháin é. Is féidir tuilleadh a léamh anseo. 

This e-mail and any files transmitted with it are confidential and are intended solely for use by the addressee. Read more here. 

sai gautams

unread,
Jun 8, 2021, 1:16:10 AM6/8/21
to ns-3-...@googlegroups.com
Here's the code please have a look.

#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/ndnSIM-module.h"
#include "assert.h"
namespace ns3 {

int
main(int argc, char* argv[])
{
  Config::SetDefault("ns3::PointToPointNetDevice::DataRate", StringValue("20Mbps"));
  Config::SetDefault("ns3::PointToPointChannel::Delay", StringValue("5ms"));
  Config::SetDefault("ns3::QueueBase::MaxSize", StringValue("50p"));

  CommandLine cmd;
  cmd.Parse(argc, argv);
 
  NodeContainer nodes;
  nodes.Create(5);
  for (int i=0;i<5;i++)
  {
  PointToPointHelper p2p;
  p2p.Install(nodes.Get(i),nodes.Get(i+1));
  }
  ndn::StackHelper ndnHelper;
  ndnHelper.setPolicy("nfd::cs::lru");
  ndnHelper.SetDefaultRoutes(true);
  ndnHelper.setCsSize(50);
  ndnHelper.InstallAll();
 
  ndn::StrategyChoiceHelper::InstallAll("/prefix", "/localhost/nfd/startegy/best-route");
 
  //ndn::GlobalRoutingHelper ndnGlobalRoutingHelper;
  //ndnGlobalRoutingHelper.InstallAll();
 
  // Consumer 1
  ndn::AppHelper consumerHelper("ns3::ndn::ConsumerCbr");
 
  consumerHelper.SetPrefix("/prefix");
  consumerHelper.SetAttribute("Frequency", StringValue("100"));
  auto Consumer1 = consumerHelper.Install(nodes.Get(0));                        
  Consumer1.Start(Seconds(2));
  Consumer1.Stop(Seconds(5));
 
  //Consumer 2
  consumerHelper.SetPrefix("/prefix");
  consumerHelper.SetAttribute("Frequency", StringValue("150"));
  auto Consumer2 = consumerHelper.Install(nodes.Get(1));                      
  Consumer2.Start(Seconds(0));
  Consumer2.Stop(Seconds(5));
 
  //Consumer 3
  consumerHelper.SetPrefix("/prefix");
  consumerHelper.SetAttribute("Frequency", StringValue("150"));
  auto Consumer3 = consumerHelper.Install(nodes.Get(2));                      
  Consumer3.Start(Seconds(3));
  Consumer3.Stop(Seconds(5));
 
  //Producer
  ndn::AppHelper producerHelper("ns3::ndn::Producer");
  producerHelper.SetPrefix("/prefix");
  producerHelper.SetAttribute("PayloadSize", StringValue("1024"));
  producerHelper.Install(nodes.Get(5));
 
//  ndn::GlobalRoutingHelper::CalculateRoutes();
 
  Simulator::Stop(Seconds(10.0));

  Simulator::Run();
  Simulator::Destroy();

  return 0;
}

} // namespace ns3

int
main(int argc, char* argv[])
{
  return ns3::main(argc, argv);
}
 



--

Sai Gautam Mandapati

Deakin University

Doctor of Philosophy Student


Bharat Agarwal

unread,
Jun 8, 2021, 1:47:45 AM6/8/21
to ns-3-...@googlegroups.com
U have initialized 5 nodes and only used 4.



sai gautams

unread,
Jun 8, 2021, 1:59:37 AM6/8/21
to ns-3-...@googlegroups.com
Thank you. Well, I tried creating another Consumer node. The problem still persists.So, there would be a total of 4 Consumers and 1 producer according to what I have declared as my number of nodes.But that is not solving the problem yet.



--

Sai Gautam Mandapati

Deakin University

Doctor of Philosophy Student

Higher Degree by Research

Faculty of Science, Engineering and Built-in Environment

E-mail: saiga...@gmail.com

http://www.linkedin.com/in/sai-gautam-mandapati

Bharat Agarwal

unread,
Jun 8, 2021, 2:03:23 AM6/8/21
to ns-3-...@googlegroups.com

 for (int i=0;i<5;i++)
  {
  PointToPointHelper p2p;
  p2p.Install(nodes.Get(i),nodes.Get(i+1));
  }


This loop is Wrong when i value will be 4 nodes.get(i+1) will take value 5 but u can go up to 0 1 2 3 4 only.

Please check this 

sai gautams

unread,
Jun 8, 2021, 2:41:18 AM6/8/21
to ns-3-...@googlegroups.com
Thank you so much for pointing this out. I solved the problem. When I'm trying to visualise the code, the following error shows up. I tried to debug but it exits the debugger normally.

/waf --run=ndn-onoff --vis
Waf: Entering directory `/home/smandapati/ndnSIM/ns-3/build'
Waf: Leaving directory `/home/smandapati/ndnSIM/ns-3/build'
Build commands will be stored in build/compile_commands.json
'build' finished successfully (1.077s)
Could not load plugin 'show_last_packets.py': No module named 'kiwi.ui'
Could not load icon applets-screenshooter due to missing gnomedesktop Python module
assert failed. cond="!m_metadataSkipped", msg="Error: attempting to enable the packet metadata subsystem too late in the simulation, which is not allowed.
A common cause for this problem is to enable ASCII tracing after sending any packets.  One way to fix this problem is to call ns3::PacketMetadata::Enable () near the beginning of the program, before any packets are sent.", file=../src/network/model/packet-metadata.cc, line=55
terminate called without an active exception

Command ['/home/smandapati/ndnSIM/ns-3/build/src/ndnSIM/examples/ns3-dev-ndn-onoff-debug', '--SimulatorImplementationType=ns3::VisualSimulatorImpl'] terminated with signal SIGIOT. Run it under a debugger to get more information (./waf --run <program> --command-template="gdb --args %s <args>").

Bharat Agarwal

unread,
Jun 8, 2021, 5:45:45 AM6/8/21
to ns-3-...@googlegroups.com
Try to run on gdb shell. SIGOT error usually comes when u havent intitlized anything and use it.
Best Regards ,

Bharat Agarwal 
Doctoral Researcher 
Dublin City University | School of Electronic Engineering
Glasnevin, Dublin 9 
Republic of Ireland 



sai gautams

unread,
Jun 8, 2021, 7:33:49 AM6/8/21
to ns-3-...@googlegroups.com
Thank you for your help Bharat. Can you please provide me with any useful links that provide information on how to run gdb shell. I'm only familiar with traditional gdb.

Bharat Agarwal

unread,
Jun 8, 2021, 7:41:46 AM6/8/21
to ns-3-...@googlegroups.com
just check doxygen.
U will find info their.



Reply all
Reply to author
Forward
0 new messages