You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Ate Douma (JIRA)" <ji...@apache.org> on 2014/09/07 22:22:28 UTC

[jira] [Resolved] (SCXML-207) Race condition in transition notification for SCXMLListeners

     [ https://issues.apache.org/jira/browse/SCXML-207?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ate Douma resolved SCXML-207.
-----------------------------
       Resolution: Fixed
    Fix Version/s: 2.0

Fixed through SCXML-206

> 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)