uscxml icon indicating copy to clipboard operation
uscxml copied to clipboard

Parallel State Execution

Open IKMODI opened this issue 6 years ago • 1 comments

Hello,

I found USCXML a very perfect means to execute my test procedure, I am using it as a Scheduler with my test specific instructions in the state chart, Also I am looking on how to implement an Xml-RPC based invoke. However, When I execute a parallel state, it does not work correctly. I am facing two issues:
1.USXML library crashes 2. If tag is enclosed in in a tag, the transitions are not captured.

Details:

  1. Crash Issue:

during the execution of scxml,

library crashes at the below code (LargeMicroStep.cpp : Step function) if (_conflicting[transition->postFixOrder]) { // this transition is explicitly conflicting continue; } I observed in the debugger, the size of the _confliciting list is 0, and thus this statement leads to crash.

To further test my scxml, I add few lines like this before this code: if (_conflicting.empty()) continue;

but I do not know if this action is correct.

  1. the transition in the parallel or or invoke states is not captured, if the parallel tag is inside the state tag. I observed that the code:

     if ((transition->event.size() == 0 && _event) ||
     			(transition->event.size() != 0 && !_event))
     			continue;
    

skips the transitions.

If you notice, in the working SCXML sample, the Transition 'leaving state parallel_state - Tx' is generated in the log, but in the not working this transition log is not captured. and the above code with transition.event.size() skips.

Could you please suggest me where i am going wrong?

ParallelSCXML_Examples.zip

IKMODI avatar Apr 18 '18 13:04 IKMODI

Clarifications on the issue

The example SCXML_Parallel_NotWorking.scxml successfully runs in Release mode but has assertion in Debug mode

image

Quick and dirty patch

Here is a quick patch to make it work LargeMicroStep.cpp.txt All tests are passed but it is required to review by someone from uscxml maintainers!

image image

Working output

test

[Info] HTTP server listening on tcp/5080
[Info] WebSocket server listening on tcp/5081
Available Datamodels:
	ecmascript
	lua
	null
Available Invokers:
	dirmon	(DirectoryMonitor, http://uscxml.tk.informatik.tu-darmstadt.de/#dirmon)
	scxml	(uscxml, http://www.w3.org/TR/scxml, http://www.w3.org/TR/scxml/)
Available I/O Processors:
	basichttp	(http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor)
	http	(http://www.w3.org/TR/scxml/#HTTPEventProcessor)
	scxml	(http://www.w3.org/TR/scxml/#SCXMLEventProcessor)
Available Elements:
	http://www.w3.org/2005/07/scxml / respond
[Info] Processing C:\Users\user\Downloads\ParallelSCXML_Examples\SCXML_Parallel_NotWorking.scxml~
[Info] Using cache from 'C:\Users\user\AppData\Local\Temp\\uscxml\4DC5AD2480DB208519070F3836BCBF54.uscxml.cache'
Microstep in config: {}
Entering: /scxml[1]
Entering: s0
Entering: p0
Entering: p1out
Entering: p1
Entering: p2out
Entering: p2
Microstep in config: {/scxml[1], s0, p0, p1out, p1, p2out, p2}
Exiting: p2
Exiting: p1
Transition: //state[@id="p1"]/transition[1]
Transition: //state[@id="p2"]/transition[1]
Entering: p11
Entering: p21
Microstep in config: {/scxml[1], s0, p0, p1out, p11, p2out, p21}
Exiting: p21
Exiting: p2out
Executable Content: //state[@id="p2out"]/onexit[1]/log[1]
[Log] "leaving state p20ut"
Exiting: p11
Exiting: p1out
Executable Content: //state[@id="p1out"]/onexit[1]/log[1]
[Log] "leaving state p1out"
Exiting: p0
Executable Content: //parallel[@id="p0"]/onexit[1]/log[1]
[Log] "leaving state parallel_state"
Exiting: s0
Transition: //state[@id="s0"]/transition[1]
Executable Content: //state[@id="s0"]/transition[1]/log[1]
[Log] "leaving s0"
Entering: pass

alexzhornyak avatar Apr 23 '21 14:04 alexzhornyak