commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "luc willems (JIRA)" <>
Subject [jira] Commented: (SCXML-65) NullPointer exceptions during triggerEvent
Date Thu, 06 Mar 2008 18:09:02 GMT


luc willems commented on SCXML-65:

hello Rahul, sorry for the late reply but the project was put on hold and i could work on
the issue anymore until this week.

the events are basicly triggered y the TriggerEvent(events[]) call.
i have SCXMLuser class that looks like this :
public class SCXMLUser extends SCXMLExecutor implements ErrorReporter,SCXMLListener {
this class basicly wraps a single user which have network connections with a remote server.
the HTTP connection is used to send HTTP request to the application, HTTP responses are converted
Events and send using the TriggerEvent method. We have a "few"  1000 of clients ,each with
a connection running the state machine.

if checked the code of :
            List paths = t.getPaths();
            for (int j = 0; j < paths.size(); j++) {
                Path p = (Path) paths.get(j);
                if (p.isCrossRegion()) {              <--- null pointer

the nullpointer exceptions suggesting that p == null so there is a null value for paths[j]
checking the t.getPaths() method i found that this was not thread save. 

 public final List getPaths() {
        if (paths.size() == 0) {
            if (targets.size() > 0) {
                for (int i = 0; i < targets.size(); i++) {
                    paths.add(i, new Path(getParent(),
                        (TransitionTarget) targets.get(i)));
            } else {
                paths.add(new Path(getParent(), null));
        return paths; 
the test paths.size()==0 + the fill up of paths is not save in case  2 SCXMLExecutors are
running a transition on the same time . I'm running this on a 24 core solaris T1000 system
so the possibility that is can happen is real.

i replaced this code with
        if (paths.size() == 0) {
           synchronized(this) {
             if (paths.size == 0) {
                   if (targets.size() > 0) {

> NullPointer exceptions during triggerEvent
> ------------------------------------------
>                 Key: SCXML-65
>                 URL:
>             Project: Commons SCXML
>          Issue Type: Bug
>    Affects Versions: 0.7
>         Environment: Linux opensuse 10.2 & Sun Solaris 10 
> 1.5.x java
>            Reporter: luc willems
>             Fix For: 0.8
> i'm using SCXML state machines in a load generation tool. this tool simulates a client
connected to a server.
> the SCXML script used custom actions to send a request using a HTTP based protocol.
> the HTTP response is transformed into a event and inserted into the SCXML script using
> each SCML executor has 1 dedicated http connection.  i'm using around 2 to 10000 clients
depending on the 
> test scenario's.
> During execution of the scripts a get sporatic nullpointer exceptions. this DOESN'T happen
all the time , it is hard to reproduce but when it happens ALL clients have the same problem.
resetting the SCXML exector doesn't help
> 2008-01-24 14:33:35,593|scxml-1-88|ERROR|SCXMLUser.triggerEvents(181)|9|Current events:
> 2008-01-24 14:33:35,594|scxml-1-88|ERROR|SCXMLUser.triggerEvents(182)|9|error scxml event
trigger: null
> java.lang.NullPointerException
>         at org.apache.commons.scxml.semantics.SCXMLSemanticsImpl.seedTargetSet(
>         at org.apache.commons.scxml.semantics.SCXMLSemanticsImpl.followTransitions(
>         at org.apache.commons.scxml.SCXMLExecutor.triggerEvents(
>         at com.nsn.loadtool.scxml.SCXMLUser.triggerEvents(
>         at com.nsn.loadtool.scxml.SCXMLAsyncExecutor$
>         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(
>         at java.util.concurrent.ThreadPoolExecutor$
>         at
> all event triggering is done in a way that only 1 thread can trigger a event.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message