Forgetting to set factory TypeId within Helper class results in very opaque error message

151 views
Skip to first unread message

Samuel Bailey

unread,
Feb 25, 2021, 2:57:11 PM2/25/21
to ns-3-users

I have recently been building my own module within ns-3, and came across an issue and couldn't find any documentation to help me out.

I had created my own class which was a child of the Application ABC, and had copied the code across from first.cc into my own examples folder in order to verify that my module (the application class I had written) was working.

I setup two Nodes in the same way as in first.cc, but passed it into my own application helper instead of UdpEchoServerHelper. When I called
applicationHelper.Install (node)
(My implementation of Install was also copied from the UdpEchoServerHelper class) I received the following error:

assert failed. cond="uid <= m_information.size () && uid != 0", +0.000000000s -1 file=../src/core/model/type-id.cc, line=462
terminate called without an active exception
Command ['/home/samuel/Dev/ns-3-dev/build/src/real-application/examples/ns3-dev-real-application-example-debug'] terminated with signal SIGIOT. Run it under a debugger to get more information (./waf --run <program> --gdb").


I eventually solved this by comparing my own Application class method by method and line by line to the UdpEchoServer class, and my ApplicationHelper class to the UdpEchoServerHelper.

Solution: Within MyApplicationHelper class, I needed to explicitly declare a constructor and set the TypeId of the m_factory to the type of MyApplication

I thought it would be worth mentioning in here, because the error message was very opaque, and no amount of typical debugging, such as logging, tracing my code with a debugger, and thoroughly checking the API documentation and elsewhere online allowed me to find anything.

Reply all
Reply to author
Forward
0 new messages