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

Done event is generated before all parallel states are final #176

Open
josvos opened this issue Mar 30, 2018 · 2 comments
Open

Done event is generated before all parallel states are final #176

josvos opened this issue Mar 30, 2018 · 2 comments

Comments

@josvos
Copy link

josvos commented Mar 30, 2018

The basic parallel example of section 3.1.3 of the SCXML spec (S1, S2, S11, etc.) does not seem to work as expected, When stepping through this example (slightly modified, to get the syntax errors fixed ;-) and adding log entries), I see that the event "e4" correctly activates S12, but then "e1" causes the "done.state.p" event to be generated, while only S1 is in final state, not S2.

In general, when an event causes transitions in both parallel states and only one of these transitions targets a final state, the "done.state.p" event is generated while it should not. If an event is only doing a transition (to a final target) in one of the parallel states, it is not generating the done event.

@alexzhornyak
Copy link
Contributor

alexzhornyak commented Mar 12, 2021

I could reproduce with the next steps:

issue_with_done_state_2

<scxml name="ScxmlJoinParallel" version="1.0" xmlns="http://www.w3.org/2005/07/scxml">
	<parallel id="p">
		<transition event="done.state.p" target="someOtherState"/>
		<state id="S1" initial="S11">
			<state id="S11">
				<transition event="e4" target="S12"/>
			</state>
			<state id="S12">
				<transition event="e1" target="S1Final"/>
			</state>
			<final id="S1Final"/>
		</state>
		<state id="S2" initial="S21">
			<state id="S21">
				<transition event="e1" target="S22"/>
			</state>
			<state id="S22">
				<transition event="e2" target="S2Final"/>
			</state>
			<final id="S2Final"/>
		</state>
	</parallel>
	<state id="someOtherState"/>
</scxml>
Microstep in config: {}
Entering: /scxml[1]
Entering: p
Entering: S1
Entering: S11
Entering: S2
Entering: S21
Stable Config: { /scxml[1], p, S1, S11, S2, S21 }
Received :{"name":"e4"}
Expect input:
Internal Event: e4
Microstep in config: {/scxml[1], p, S1, S11, S2, S21}
Exiting: S11
Transition: //state[@id="S11"]/transition[1]
Entering: S12
Stable Config: { /scxml[1], p, S1, S12, S2, S21 }
Received :{"name":"e1"}
Expect input:
Internal Event: e1
Microstep in config: {/scxml[1], p, S1, S12, S2, S21}
Exiting: S21
Exiting: S12
Transition: //state[@id="S12"]/transition[1]
Transition: //state[@id="S21"]/transition[1]
Entering: S1Final
Entering: S22
Internal Event: done.state.S1
Internal Event: done.state.p
Microstep in config: {/scxml[1], p, S1, S1Final, S2, S22}
Exiting: S22
Exiting: S2
Exiting: S1Final
Exiting: S1
Exiting: p
Transition: //parallel[@id="p"]/transition[1]
Entering: someOtherState
Stable Config: { /scxml[1], someOtherState }

P.S. But if we start from event 'e1' everything is working correctly
state_chart

Microstep in config: {}
Entering: /scxml[1]
Entering: p
Entering: S1
Entering: S11
Entering: S2
Entering: S21
Stable Config: { /scxml[1], p, S1, S11, S2, S21 }
Received :{"name":"e1"}
Expect input:
Internal Event: e1
Microstep in config: {/scxml[1], p, S1, S11, S2, S21}
Exiting: S21
Transition: //state[@id="S21"]/transition[1]
Entering: S22
Stable Config: { /scxml[1], p, S1, S11, S2, S22 }
Received :{"name":"e4"}
Expect input:
Internal Event: e4
Microstep in config: {/scxml[1], p, S1, S11, S2, S22}
Exiting: S11
Transition: //state[@id="S11"]/transition[1]
Entering: S12
Stable Config: { /scxml[1], p, S1, S12, S2, S22 }
Received :{"name":"e2"}
Expect input:
Internal Event: e2
Microstep in config: {/scxml[1], p, S1, S12, S2, S22}
Exiting: S22
Transition: //state[@id="S22"]/transition[1]
Entering: S2Final
Internal Event: done.state.S2
Stable Config: { /scxml[1], p, S1, S12, S2, S2Final }
Received :{"name":"e1"}
Expect input:
Internal Event: e1
Microstep in config: {/scxml[1], p, S1, S12, S2, S2Final}
Exiting: S12
Transition: //state[@id="S12"]/transition[1]
Entering: S1Final
Internal Event: done.state.S1
Internal Event: done.state.p
Microstep in config: {/scxml[1], p, S1, S1Final, S2, S2Final}
Exiting: S2Final
Exiting: S2
Exiting: S1Final
Exiting: S1
Exiting: p
Transition: //parallel[@id="p"]/transition[1]
Entering: someOtherState
Stable Config: { /scxml[1], someOtherState }

@alexzhornyak
Copy link
Contributor

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

No branches or pull requests

2 participants