OMNeT++/OMNEST Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000433OMNeT++simulation kernelpublic2011-11-09 18:052011-11-09 18:05
Assigned To 
PlatformOSOS Version
Product Version4.2b2 
Target VersionFixed in Version 
Summary0000433: Delete messages sent while finishing
DescriptionModules sometimes send messages while they are shutting down. For example, as part of finish we stop our applications, which shuts down sockets, which send UNBIND messages. These are reported as undisposed messages which is rather annoying.

One fix is to delete any messages that are sent while the sim is finishing as in the patch below.
Additional Information------------------- vendor/omnetpp/src/sim/ -------------------
index d4193eb..166a5ee 100755
@@ -399,16 +399,24 @@ int cSimpleModule::sendDelayed(cMessage *msg, simtime_t delay, cGate *outgate)
             throw cRuntimeError("send()/sendDelayed(): cannot send message (%s)%s, "
                                 "it is currently contained/owned by (%s)%s",
                                 msg->getClassName(), msg->getName(), msg->getOwner()->getClassName(),
     if (delay < 0)
         throw cRuntimeError("sendDelayed(): negative delay %s", SIMTIME_STR(delay));
+ // Modules sometimes queue messages as part of their cleanup (e.g. a socket might attempt
+ // to send a UNBIND or IGMP leaves when it is closed).
+ if (simulation.getSimulationStage() == CTX_FINISH)
+ {
+ delete msg;
+ return 0;
+ }
     // set message parameters and send it
     simtime_t delayEndTime = simTime()+delay;
     msg->setSentFrom(this, outgate->getId(), delayEndTime);
     if (msg->isPacket())
         ((cPacket *)msg)->setDuration(0);
     bool keepit = outgate->deliver(msg, delayEndTime);
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2011-11-09 18:05 jesjones New Issue

Copyright © 2000 - 2022 MantisBT Team
Powered by Mantis Bugtracker