Skip to content

handleIfSimEnd causes infinite concurrent access exceptions #10

Description

@tpr1

Version information

ed6255e

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:

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions