cur->tid != tag.GetInstanceTypeId (), "Error: cannot add the same kind of tag twice."

89 views
Skip to first unread message

Giacomo Segala

unread,
Jun 12, 2019, 2:42:03 PM6/12/19
to ns-3-users
Hello everyone,
I've a problem I'm not able to fix, I hope someone can help me.
I have an eNB connected to a couple of groups of drones: each group of drones form an ad hoc network. Each drone, inside the ad hoc network, has two netdevices: one is Wifi AP, the other one is AdHoc to connect to other drones. In each group one of these drones has also the LteUeDevice to connect to eNB. There are also some users who have StaWifi Device to connect to drones. The routing protocol installed is OLSR. Sometimes the error cur->tid != tag.GetInstanceTypeId (), "Error: cannot add the same kind of tag twice." happens. I really don't know why it happens, I didn't put my hands in anything similar in my code. Maybe someone, with more experience than me with Ns-3, could have an idea what is the problem. In my code I call two scheduled events which repeat theirselves every 60 seconds.
Please, has someone an idea about my problem?
Thanks in advance.

Giacomo Segala

unread,
Jun 12, 2019, 3:00:52 PM6/12/19
to ns-3-users
In my code I use FlowMonitor. I don't know if it could be involved in the problem.

Adil Alsuhaim

unread,
Jun 12, 2019, 3:46:57 PM6/12/19
to ns-3-users
I can tell you the reason for this error message, as I have seen it before. You can not add a packet tag of the same type twice. Packet tags are subclasses of the ns3::Tag class.

For example,
Ptr<Packet> p = Create<Packet> (1000);

SomeTag x;
p
->AddPacketTag (x); //okay

SomeTag y;
p
->AddPacketTag (y); //Not okay


Packet tags are a way to label certain packets in simulation (they don't change actual packet content). So it really depends on how you're code is, but I would do something like this:

SomeTag x;

if (!p->PeekPacketTag (x)) // does the packet have a tag of that type?
{
   p
->AddPacketTag (x);
}

I am not sure if you're calling code that adds packet tags to a packet, so check your calls. 

Giacomo Segala

unread,
Jun 12, 2019, 3:51:30 PM6/12/19
to ns-3-users
First of all, thanks a lot for the reply.
In my code there is no line of code with something about tag. That's why I really don't know where this error comes out. I use an OnOffApplication to send packets but I specify rate and OnTime/OffTime, nothing else. The only doubt I have is about FlowMonitor, because the error comes out around the end of simulation, I think the packets are sent correctly. Have you got an idea? 

Adil Alsuhaim

unread,
Jun 12, 2019, 6:39:29 PM6/12/19
to ns-3-users
Try to run your program with a debugger like gdb, you may need to install gdb, and you can run ns3 program with debugger like that:

/waf --run ProgramName --command-template="gdb --args %s"

If your program takes arguments, say time=10 size=1000 then do

/waf --run ProgramName --command-template="gdb --args %s time=10 size=1000"

When gdb starts, type "run", the program would run and crash, then type "bt" to show the trace of the function calls leading to the error. You will probably see "AddPacketTag" that is called by another component  


Reply all
Reply to author
Forward
0 new messages