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

Dependency cycle detection does not seem to work #1024

Closed
soerendomroes opened this issue Mar 10, 2022 · 5 comments · Fixed by #1026
Closed

Dependency cycle detection does not seem to work #1024

soerendomroes opened this issue Mar 10, 2022 · 5 comments · Fixed by #1026
Assignees
Labels
bug Something isn't working
Milestone

Comments

@soerendomroes
Copy link
Collaborator

Hi, tried to do the esweek tutorial and I noticed that the dependency cycle analysis does not work.

target C

reactor Printer {
    input in: int
    output out: int
    reaction(in) -> out {=
        // Using a thread-safe print function provided by the runtime.
        info_print("Hello World! %d", in->value);
    =}
}

main reactor {
    p = new Printer()
    p.out -> p.in
}

tutorial

No validator error is created. So it does not seem to be a problem of the diagram.

@a-sr a-sr added the bug Something isn't working label Mar 10, 2022
@lhstrh lhstrh added this to the 0.1.0 milestone Mar 10, 2022
@lhstrh
Copy link
Member

lhstrh commented Mar 10, 2022

Oh, that's a significant bug. Thanks for reporting this!

@a-sr
Copy link
Collaborator

a-sr commented Mar 10, 2022

I had a look at the problem because I was worried that it relates to changes done for modal models but it seems not the case.
It looks like an unhandled corner case. I was able to track down the issue to this point in ReactionInstanceGraph. In this instance dstRuntime and srcRuntime are actually the same and hence no edge is introduced.
My guess is that the code cannot handle this corner case, because as soon as there are two reactions involved, it works again:
Screenshot from 2022-03-10 17-36-10
I don't fully understand the handling of runtime instances in this algorithm yet but the if was explicitly introduced here to fix a problem with federated. Maybe someone else can take it up from here.

@edwardalee
Copy link
Collaborator

Thanks for this pointer. I'm trying to figure out why I put in the check that lets this corner case through... There must have been a reason... :-)

@edwardalee
Copy link
Collaborator

I think this will be fixed by PR #1026, but let's see whether the CI tests reveal further problems. I removed the check that @a-sr identified, and this resulted in only one test breaking, src/modal_models/ModalCycleBreaker.lf.
This test seems to have had a genuine cycle in mode Two.
That cycle was being masked by the bug.
I removed the cycle and the test passes, but @a-sr should check that the test is still testing what was intended.

@lhstrh
Copy link
Member

lhstrh commented Mar 10, 2022

I think this bug report shows we're not doing enough unit testing. Especially for critical parts like our dependency analysis, we need more unit tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants