commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ate Douma (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SCXML-207) Race condition in transition notification for SCXMLListeners
Date Mon, 15 Sep 2014 14:11:35 GMT

    [ https://issues.apache.org/jira/browse/SCXML-207?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14133926#comment-14133926
] 

Ate Douma commented on SCXML-207:
---------------------------------

Thanks for pointing this out. I've update the FAQ to better reflect the new behavior.

> Race condition in transition notification for SCXMLListeners
> ------------------------------------------------------------
>
>                 Key: SCXML-207
>                 URL: https://issues.apache.org/jira/browse/SCXML-207
>             Project: Commons SCXML
>          Issue Type: Bug
>    Affects Versions: 2.0
>            Reporter: Johannes Wienke
>            Assignee: Ate Douma
>             Fix For: 2.0
>
>
> When using a SimpleSCXMLListener we have seen impossible transitions occur in the log
output of that listener. After digging around the source code I can see the issue that results
in theses outputs.
> In order to derive the event name passed as the last argument to SCXMLListener#onTransition,
the following code inside SCXMLSemanticsImpl is used:
> {code:java}
> public void notifyOnTransition(final SCXMLExecutionContext exctx, final Transition t,
>                                       final TransitionTarget target) {
>     EventVariable event = (EventVariable)exctx.getScInstance().getSystemContext().getVars().get(SCXMLSystemContext.EVENT_KEY);
>     String eventName = event != null ? event.getName() : null;
>     exctx.getNotificationRegistry().fireOnTransition(t, t.getParent(), target, t, eventName);
>     exctx.getNotificationRegistry().fireOnTransition(exctx.getStateMachine(), t.getParent(),
target, t, eventName);
>     }
> {code}
> When triggering events on the engine from multiple threads (which is ok according to
the online documentation), a different thread might have already replaced the contents of
the SCXMLSystemContext.EVENT_KEY context item and hence a wrong event name might be used from
this point on.
> Actually, I don't even understand why the event name is looked up from the context here
at all, since is already available inside the transition.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message