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

Patch to ensure that deadlines with zero delay are never met #86

Merged
merged 9 commits into from
Jun 11, 2022

Conversation

billy-bao
Copy link
Collaborator

@billy-bao billy-bao commented Jun 9, 2022

With this change, if a reactor has a deadline field of zero, the runtime treats it as a deadline with duration zero (so it is always violated). For a description of the issue, see: lf-lang/lingua-franca#1203.

@billy-bao billy-bao requested a review from lhstrh June 10, 2022 00:50
@lhstrh
Copy link
Member

lhstrh commented Jun 10, 2022

Looks like the test you added in lf-lang/lingua-franca#1217 is still failing.

@billy-bao
Copy link
Collaborator Author

Yeah, I'm not sure why, unfortunately - it passes locally for me.
Can the system be fast enough so that the physical time value doesn't change between triggering a reaction and checking its deadline? This may explain the inconsistency. If so, maybe I should hard-code a deadline of zero to always fail to ensure deterministic behavior?

@edwardalee
Copy link
Contributor

You could force the generator to take at least one jiffy interval before calling lf_set(). The jiffy interval can be as big as 30 msec on some machines, I think.

@edwardalee
Copy link
Contributor

Actually, on reflection, I think your suggestion is better. We should change the logic of deadlines to always trigger the deadline handler if the deadline is zero. The current design will always be nondeterministic, I think, but I think it's better if the meaning of a zero deadline were deterministic so that it can be used for testing.

Copy link
Member

@lhstrh lhstrh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks right to me!

@lhstrh lhstrh requested a review from Soroosh129 June 10, 2022 22:53
Copy link
Contributor

@Soroosh129 Soroosh129 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@lhstrh lhstrh merged commit f65b7a0 into main Jun 11, 2022
@lhstrh lhstrh deleted the zero-deadline branch June 11, 2022 07:58
@lhstrh lhstrh added the bugfix label Jul 20, 2022
@lhstrh lhstrh changed the title Treat deadline of zero as always violated Patch to ensure that deadlines with zero delay are never met Jul 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants