[ndnSIM] Segmentation fault
Ygor Amaral
ygor.amaral at gmail.com
Tue Jun 8 16:34:32 PDT 2021
Hi Sai,
This segmentation fault does not seem to be related with ns3/ndnSIM.
I think you made a basic programming error inside your for loop.
You have an index out of bounds error.
Regards,
Ygor Amaral
On Tue, Jun 8, 2021 at 1:52 AM sai gautams via ndnSIM <
ndnsim at lists.cs.ucla.edu> wrote:
> Hi all,
>
> I hope you are well.I'm new to ns-3 and ndnSIM and still familiarizing
> myself with the platform. 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. Can anyone please explain to me the
> fault I'm getting. I can post my code as well if anyone wants to find where
> exactly I'm going wrong.
>
> #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);
> }
>
>
> 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))
>
>
> --
>
> *Sai Gautam Mandapati*
>
> Deakin University
>
> Doctor of Philosophy Student
>
> Higher Degree by Research
>
> Faculty of Science, Engineering and Built-in Environment
>
> E-mail: saigautam96 at gmail.com
>
> http://www.linkedin.com/in/sai-gautam-mandapati
> _______________________________________________
> ndnSIM mailing list
> ndnSIM at lists.cs.ucla.edu
> http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20210608/0b0c6e1a/attachment.html>
More information about the ndnSIM
mailing list