You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug: Events triggered via sml::back::process<TEvent>() are not processed in parent state #562
Events not handled in a child state should be handled by the parent state. Duplicate of #400.
Actual Behavior
While this works for events injected via process_event() from the top-level machine, it fails for events triggered by an action via sml::back::process<TEvent>(): https://godbolt.org/z/dnMv1dfa4
changed the title [-]bug: Events triggered via sml::back:process<TEvent>() are not processed in parent state [/-][+]bug: Events triggered via `sml::back::process<TEvent>()` are not processed in parent state [/+]on Mar 6, 2023
I analyzed this issue a little bit and found that the event triggered via sml::back::processs is injected into the sub state's process queue instead of using the root state's one:
A similar issue was resolved in #302 for process, which actually works correctly now.
I added a (failing) unit test in my fork to illustrate the problem.
To resolve that issue here in a similar fashion, one would need to access the root sm in get_arg, which is not available yet. However, instead of applying this kind of fix again, I want to fundamentally question the design:
Why do we need the process_ queue in all sub state machines at all? Doesn't it suffice to have a single one in the root state machine - as we need to process all events from there? All subs could simply have a pointer to that single queue instance, such that we don't need to change API of get_arg.
For deferred events the story is different I think: they should be kept in state-local queues and be processed as soon as the state is left.
Activity
[-]bug: Events triggered via sml::back:process<TEvent>() are not processed in parent state [/-][+]bug: Events triggered via `sml::back::process<TEvent>()` are not processed in parent state [/+]Add (failing) unit test for boost-ext#562
rhaschke commentedon Mar 18, 2023
I analyzed this issue a little bit and found that the event triggered via
sml::back::processsis injected into the sub state's process queue instead of using the root state's one:back::processprocesssml/include/boost/sml.hpp
Line 1873 in 4be9dd6
sml/include/boost/sml.hpp
Line 2128 in 4be9dd6
A similar issue was resolved in #302 for
process, which actually works correctly now.I added a (failing) unit test in my fork to illustrate the problem.
To resolve that issue here in a similar fashion, one would need to access the root sm in
get_arg, which is not available yet. However, instead of applying this kind of fix again, I want to fundamentally question the design:Why do we need the
process_queue in all sub state machines at all? Doesn't it suffice to have a single one in the root state machine - as we need to process all events from there? All subs could simply have a pointer to that single queue instance, such that we don't need to change API ofget_arg.For deferred events the story is different I think: they should be kept in state-local queues and be processed as soon as the state is left.
Add (failing) unit test for boost-ext#562
Attempt at progress towards boost-ext#562
PavelGuzenfeld commentedon Oct 13, 2026
Fixed by #687, the repro prints the failure as expected on master 4970fef. Can be closed.
PavelGuzenfeld commentedon Oct 17, 2026
@kris-jusiak can you close this? Fixed or answered, see the comment above.