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

Gco/non trivial event missed processing #372

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

GuiCodron
Copy link
Contributor

Problem:

  • Non trivial on_exit/on_entry can hide on_entry<>/on_exit<> in parents state machine.
    This is due to a dual pass done to process non trivial event:
  • First we process non trivial event, then we process generic event if it failed.
    PR Gco/fix double exit processing #370 amplify this bug:
    on_exit are now processed like on_entry and return true if any child state handle the non trivial event, this imply that generic event will not be processed for parent states.

Solution:

  • Fix the problem by doing a single pass of processing that will trigger the correct event (either mapped or generic).
    This is done by updating mapping generation to take into account that on_entry/on_exit/unexpected_event have a specific generic event case.

Reviewers:
@krzysztof-jusiak

Detected new erroneous behavior with non trivial on_entry/on_exit:
When using non trivial on_entry/on_exit (on_entry<e1> instead of
on_entry<_>), all the on_entry<_> in the parents sm will not be called.
@GuiCodron GuiCodron force-pushed the gco/non-trivial-event-missed-processing branch 2 times, most recently from 4cfc667 to 4fdc199 Compare August 3, 2020 09:47
Generate mappings with mapped and generic events for on_entry, on_exit
and unexpected events.
Remove the dual pass processing done in state_machine.hpp since the
improved get_event_mapping_impl_helper directly generate the good mapping.
@GuiCodron GuiCodron force-pushed the gco/non-trivial-event-missed-processing branch from 4fdc199 to a8af61e Compare August 3, 2020 11:33
@guiserle
Copy link
Contributor

guiserle commented May 17, 2023

Apologies in advance to bring this old issue to life, but I am seeing the very same behavior and I wonder whether it is planned to apply a fix or not.

I can provide some examples that highlight the issue:

This example works as expected: https://gcc.godbolt.org/z/vxxceGzW3

However, if I replace state<Child> + sml::on_entry<_> by state<Child> + sml::on_entry<e2> on parent state machine, child on_entry<_> event is not processed. example

Similarly, replacing "s2"_s + sml::on_exit<_> by "s2"_s + sml::on_exit<e3> on child state machine, parent on_exit<_> is not processed. example

For completeness, if both child and parent state machines use the specific on_entry/on_exit version, everything works as expected

As a side note, if I am not wrong, child on_exit hides on_exit on parent state machine, while parent on_entry hides on_entry on child state machine, so the hiding may happen on both "directions"

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

Successfully merging this pull request may close these issues.

None yet

2 participants