Hi, Rahul:
Thanks for taking a look. In further testing, I found the probable cause of 
this 
issue is that when the custom action in test2 is executing, sometimes it 
injects 
the actionComplete event right back to the scxml engine (in the same thread). 
When that occurs, the state transition is messed up and stayed in test2-init 
state though in the log it went into active state. If the custom action is not 
doing that, and later another thread sends the actionComplete to the engine, 
then it transitions fine. Is this a bug or something should not be done based 
on 
the spec? Thanks.

Vance

On Mon, May 16, 2011 at 12:26 PM, Vance huang <[email protected]> wrote: > > 
Hi, Rahul: > > Here is the trimmed down snippet: > <snip/>  I reduced it even 
further:   <state id="active">    <transition event="test2" target="test2"/>  
</state>   <state id="test2" initial="test2-init">     <state id="test2-init">  
    
<onentry>        <assign name="keepGoing" expr="true"/>      </onentry>      
<transition cond="keepGoing == true">        <custom:action/>        <!-- above 
presumably adds actionComplete           derived event -->      </transition>   
   
<transition event="actionComplete" target="test2-final"/>    </state>     
<state 
id="test2-final">      <transition target="active"/>    </state>   </state>  Is 
the above still a representative test case where you're seeing the behavior 
(using the same custom action you have below)? If so, the issue is still 
unclear. If you're repeatedly firing test2 events, you may want to throttle 
them 
(with short delays) to ensure the executor is done processing the previous 
event. If after that something still seems amiss, next step would then be to 
provide a simplest JUnit test case that can reproduce the problem (see src/test 
directory in SVN or source distro for numerous examples of test cases).  -Rahul 
  
> <state id="active"> > <onentry> >    <log expr="'active State." /> > 
</onentry><transition event="test2" target="test2"/> > <transition event="*"> > 
   <log expr="'active State handling unexpected event'" /> > <custom action 
here/> > </transition> >    </state> > > <state id="test2" 
initial="test2-init"> 
> <state id="test2-init"> > <onentry> >   <log expr="'test2-init State." /> > 
<assign name="keepGoing" expr="true"/> >    </onentry> > <transition 
cond="keepGoing == true"> >    <log expr="'test2-keepGoing'" /> > <"calling a 
custom action here/> > </transition> > <transition event="actionComplete" 
target="test2-final"> >    <log expr="'test2-actionComplete.'" /> > 
</transition> > <transition event="*"> > <log expr="'test2 State handling 
unexpected event'" /> > <custom action here/> > </transition> >   </state> > > 
<state id="test2-final"> > <onentry> >    <log expr="'test2-final State'" /> >  
 
 </onentry> > <transition target="active"> >    <log expr="'test2-final State 
exiting'" /> > </transition> >    </state> > > <onexit> > <custom action here/> 
> </onexit> >    </state> > > > What happen was that sometimes going from 
> active 
to test2 and back to active > works fine. But other times though it seems to 
coming back from test2 to active > state is fine (based on the onentry logging) 
but when test2 event fired, it was > caught in test2 state not active state. I 
am not sure what else can I do to > provide more information on this. Thanks. > 
> > Vance > > > > > ________________________________ > From: Vance huang 
<[email protected]> > To: [email protected] > Sent: Fri, May 13, 2011 
5:54:44 PM > Subject: [scxml] > > > Hi, > > I am using scxml 0.9 release and 
encountered a weird issue. When I am > transitioning between 2 states, it 
worked 
fine sometimes but in other times, it > failed to transition to the next state. 
I put logging in <onexit> and <onentry> > and here is what happened: > State 1 
transition to State 2. > State 2 processes some events and transition back to 
State 1 > I put logging in <onexit> of State 1 and <onentry> of State 2. I saw 
both logs. > Then after few seconds an event fired but caught in State 2!! > Is 
it a known issue in 0.9 release? Any workaround? > Thanks. > > Vance  
--------------------------------------------------------------------- To 
unsubscribe, e-mail: [email protected] For additional 
commands, e-mail: [email protected] 

Reply via email to