Observations:
In qep_hsm.c, QHSM_MAX_NEST_DEPTH_ is 6.
If there is an unhandled event received, as the framework looks for super-states that can handle the event, it saves it to path[] in QHsm_dispatch_.
If you have 5 levels of nesting, then the 6th one becomes QHsm_top, where this is stored in path[0].
However, path[0] is also used to save the current state on line 265 but in the scenario described above, it gets overwritten. Then at the end of the function, the new state for the function is QHsm_top and then it no longer responds to any events.
I'm not entirely sure if this explanation is accurate, so I tried to replicate the problem on one of the examples, qhsmtst, and found the problem there too, so I think perhaps there is a bug here.
To repeat:
Modify the qhsmtest example as per image so that there are 5 nesting states, and remove a transition so there is an unhandled state in that state.
If you repeat the above and NOT do step 3, then on step 4 the state machine DOES respond.
Anonymous
Thanks a lot for reporting!
Could you please check it in the latest QP 8.1.0? That version has specifically been redesigned for complete code coverage, which includes verifying all assertions.
--MMS
Hi Dr Samek, I did try with the latest version this morning, with a modified version of qhsmtst again, and able to repeat it there too.
Please note that this isn't hitting any assertions. If I make another level of nesting THEN the assertion is hit.
My test and picture of state machine attached. Note how after sending the signal "H", the AO becomes unresponsive to events it used to be responsive to.
Thanks a lot for checking this in QP 8.1.0. Could you please attach your QM model?
--MMS
Sure, here it is. I was experimenting with packages not so long ago, so attaching the package too - no changes to the models done, so you should be able to repeat it.
Last edit: Can Caglar 2025-10-08
Thank you for the QM model.
The problem is reproducible both in versions 8.0.4 and 8.1.0 (and perhaps older). With precisely 6 levels of state nesting (including the top state) an unhandled event causes the state machine to erroneously switch to the "top" state. Once in the "top" state the state machine ignores all events and so it becomes unresponsive.
The fix is already made and tested and will be released in QP 8.1.1.
--MMS
Fixed in QP/C/C++ 8.1.1.
--MMS