Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handleIfSimEnd causes infinite concurrent access exceptions #10

Open
tpr1 opened this issue Jul 25, 2018 · 0 comments
Open

handleIfSimEnd causes infinite concurrent access exceptions #10

tpr1 opened this issue Jul 25, 2018 · 0 comments

Comments

@tpr1
Copy link
Contributor

tpr1 commented Jul 25, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant