Giter Site home page Giter Site logo

Comments (8)

sudilav avatar sudilav commented on August 22, 2024

There also seems to be some kind of race condition happening, I can't get my second state to move to the third state however if I break at line

currentStateStatus = Exiting;
and wait a while and then break at
if (errSend.ErrorsCleared()) {
after some time, I can see that the state change occurs.

This setup has Mode = ExpectsReply.

from marte2.

sudilav avatar sudilav commented on August 22, 2024

That was a red herring, the state was actually moving to the error state instead. So possibly not a race condition - the scheduler we're using is the GAMBareScheduler

Looking through how this works:

  • MessageGAM sends message to StateMachine to GOTOSTATE1 (or 2) and waits for Reply - must be an indirect Reply.
  • StateMachine receives message and calls up application to move states in three messages. and waits for indirect replies from application.
  • Application triggers the scheduler to run through the changes:
    ret = scheduler->StartNextStateExecution();

The odd behaviour is also that when it goes to error state as the file input for my test is end of file, it moves to state 3 then - not the error state instead.

from marte2.

sudilav avatar sudilav commented on August 22, 2024

It looks like this only executes once:

ReferenceT<ReferenceContainer> state = Get(i);

When I in fact have 4 states

from marte2.

sudilav avatar sudilav commented on August 22, 2024

Okay I'm going to spend today having a good look at this. I suggest for the first state issue, the application name used in the config be a parameter for the StateMachine object. Then when it starts up, it sends a message to the application and the application will have a messagefilter setup at startup to listen for this message, when it hears this message, it then sends back the name of the state that it is starting in. Then the statemachine will execute the section which adds the message filters for this. This does create a bit of a race condition so maybe once the statemachine has completed setup, it then sends back to the application to continue as it is ready to do so. @aneto0

from marte2.

sudilav avatar sudilav commented on August 22, 2024

It seems I've narrowed the issue down to the fact that the third message here:

err = MessageI::SendMessage(eventMsg, this);

Never actually returns. So something about having the RT App/Scheduler call to start the next state causes this to stall. Possibly it kills the thread?

from marte2.

sudilav avatar sudilav commented on August 22, 2024

Diving further, this is because This function call never returns:

ret = destinationObject->CallRegisteredMethod(methodName, *(messageToTest.operator->()));

This is because it calls this function when it is the third message:

ErrorManagement::ErrorType RealTimeApplication::StartNextStateExecution() {

My Scheduler is the GAMBareScheduler. This basically seems to then execute within this thread/stack in an infinite loop:

ErrorManagement::ErrorType GAMBareScheduler::StartNextStateExecution() {

So the question is: How does the RealTimeApplication start the first state thread in the first place using prepare etc... and not have to wait, when it is happy to continue moving forward.

from marte2.

sudilav avatar sudilav commented on August 22, 2024

It seems this possibly happens again, when we look at our logs, this call:

err = rtApp->StartNextStateExecution();

Never then progress to print out:

REPORT_ERROR_STATIC(ErrorManagement::Information, "Started application in state %s ", destination.Buffer());

I just reran my testing with GAMScheduler and didn't find this issue.... dratt. The whole reason we're using GAMBareScheduler is because of the MaxCycles has been exploited so we can use this for simulations and then running testing in a pipeline on Gitlab.

from marte2.

sudilav avatar sudilav commented on August 22, 2024

Focusing on the issue of the StateMachine assuming you start in the first state. I can see it gets initialised here:
https://github.com/sudilav/MARTe2/blob/162882ac4416431163bc8ce084ca9db9acf91223/Source/Core/BareMetal/L6App/Loader.cpp#L142

PrepareNextState never gets called for it as it isn't part of the application but a seperate entity.

The data field in the Loader function does know and contain the first state but this doesn't get passed onto the Initialise function so is an inaccessible variables to the StateMachine to possibly know what the first state is.

from marte2.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.