-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Version information
Observed behavior
After receiving SimEnd, a C++ federate will get stuck in a loop where it tries to send the Federate Resign Interaction. All attempts to send this interaction will lead to a ConcurrentAccessAttempted / currently ticking exception.
Expected behavior
The federate should exit without error.
Steps to reproduce issue
Run a C++ federate and then terminate the simulation using SimEnd.
The problem is that handleIfSimEnd is called during receiveInteraction:
cpswt-cpp/foundation/SynchronizedFederate/src/main/include/SynchronizedFederate.hpp
Lines 372 to 390 in 9bbac67
| virtual void receiveInteraction( | |
| RTI::InteractionClassHandle theInteraction, | |
| const RTI::ParameterHandleValuePairSet& theParameters, | |
| const RTI::FedTime& theTime, | |
| const char *theTag, | |
| RTI::EventRetractionHandle theHandle | |
| ) | |
| throw ( RTI::InteractionClassNotKnown, RTI::InteractionParameterNotKnown, RTI::InvalidFederationTime, RTI::FederateInternalError) { | |
| if ( getMoreATRs() ) { | |
| InteractionRoot::SP interactionRootSP = InteractionRoot::create_interaction( theInteraction, theParameters, theTime ); | |
| if ( !unmatchingFedFilterProvided(interactionRootSP) ) { | |
| RTIfedTime rtitime(theTime); | |
| double ltime = rtitime.getTime(); | |
| handleIfSimEnd(interactionRootSP, ltime); | |
| addInteraction( interactionRootSP ); | |
| interactionRootSP->createLog( ltime, false ); | |
| } | |
| } | |
| } |
It should be called like the Java equivalent after a time grant to ensure the RTI is not ticking:
https://github.com/SimIntToolkit/cpswt-core/blob/06a66ec3e390c037594b0ad6813641bff85ddf38/cpswt-core/federate-base/src/main/java/org/cpswt/hla/SynchronizedFederate.java#L1036-L1040