You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "luc willems (JIRA)" <ji...@apache.org> on 2008/01/26 21:44:34 UTC

[jira] Created: (SCXML-65) NullPointer exceptions during triggerEvent

NullPointer exceptions during triggerEvent
------------------------------------------

                 Key: SCXML-65
                 URL: https://issues.apache.org/jira/browse/SCXML-65
             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


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 triggerEvent().
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: events(TriggerEvent{name=wv.status,type=3},TriggerEvent{name=wv.ok,type=3})
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(SCXMLSemanticsImpl.java:493)
        at org.apache.commons.scxml.semantics.SCXMLSemanticsImpl.followTransitions(SCXMLSemanticsImpl.java:652)
        at org.apache.commons.scxml.SCXMLExecutor.triggerEvents(SCXMLExecutor.java:127)
        at com.nsn.loadtool.scxml.SCXMLUser.triggerEvents(SCXMLUser.java:164)
        at com.nsn.loadtool.scxml.SCXMLAsyncExecutor$SCXMLWorker.run(SCXMLAsyncExecutor.java:101)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
        at java.lang.Thread.run(Thread.java:595)


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.


[jira] Commented: (SCXML-65) NullPointer exceptions during triggerEvent

Posted by "Rahul Akolkar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SCXML-65?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12577452#action_12577452 ] 

Rahul Akolkar commented on SCXML-65:
------------------------------------

Thanks for trying the SVN trunk. Please let us know how the extended testing goes.


> NullPointer exceptions during triggerEvent
> ------------------------------------------
>
>                 Key: SCXML-65
>                 URL: https://issues.apache.org/jira/browse/SCXML-65
>             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 triggerEvent().
> 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: events(TriggerEvent{name=wv.status,type=3},TriggerEvent{name=wv.ok,type=3})
> 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(SCXMLSemanticsImpl.java:493)
>         at org.apache.commons.scxml.semantics.SCXMLSemanticsImpl.followTransitions(SCXMLSemanticsImpl.java:652)
>         at org.apache.commons.scxml.SCXMLExecutor.triggerEvents(SCXMLExecutor.java:127)
>         at com.nsn.loadtool.scxml.SCXMLUser.triggerEvents(SCXMLUser.java:164)
>         at com.nsn.loadtool.scxml.SCXMLAsyncExecutor$SCXMLWorker.run(SCXMLAsyncExecutor.java:101)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>         at java.lang.Thread.run(Thread.java:595)
> 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.


[jira] Updated: (SCXML-65) NullPointer exceptions during triggerEvent

Posted by "Rahul Akolkar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SCXML-65?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rahul Akolkar updated SCXML-65:
-------------------------------

    Fix Version/s: 0.8

Please try one or more of the following things:

 * From the stack trace, it looks like you are triggering events asynchronously through a custom action. Generally, custom actions work better with derived events instead (add the event based on the HTTP response to the 'derivedEvents' collection).

 * Alternatively (as compared to above bullet which I'd try first), you could try registering a 'x-http' targettype invoker and using <invoke targettype="x-http" ...>

 * Looking at the trace above (and v0.7 as you indicate to match line numbers), I've made one minor "first-hit" performance improvement to the code in SVN trunk. It'd be useful to know if that helps the cause here (if you are in a position to be able to try a jar built out of SVN).

 * If none of the above works, try parsing a separate state machine instance (SCXML class instance) for each SCXMLExecutor instance. This shouldn't be necessary, but if it is here, then this may have uncovered a bug.

In the absence of a test case, it'd be great if you could give us some feedback on the above suggestions. Thanks.


> NullPointer exceptions during triggerEvent
> ------------------------------------------
>
>                 Key: SCXML-65
>                 URL: https://issues.apache.org/jira/browse/SCXML-65
>             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 triggerEvent().
> 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: events(TriggerEvent{name=wv.status,type=3},TriggerEvent{name=wv.ok,type=3})
> 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(SCXMLSemanticsImpl.java:493)
>         at org.apache.commons.scxml.semantics.SCXMLSemanticsImpl.followTransitions(SCXMLSemanticsImpl.java:652)
>         at org.apache.commons.scxml.SCXMLExecutor.triggerEvents(SCXMLExecutor.java:127)
>         at com.nsn.loadtool.scxml.SCXMLUser.triggerEvents(SCXMLUser.java:164)
>         at com.nsn.loadtool.scxml.SCXMLAsyncExecutor$SCXMLWorker.run(SCXMLAsyncExecutor.java:101)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>         at java.lang.Thread.run(Thread.java:595)
> 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.


[jira] Commented: (SCXML-65) NullPointer exceptions during triggerEvent

Posted by "Rahul Akolkar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SCXML-65?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12576441#action_12576441 ] 

Rahul Akolkar commented on SCXML-65:
------------------------------------

Thanks for digging into this, no worries about the delay :-)

I agree with most of your analysis. In the meantime, I had made one change that should eliminate any issue here (the paths are now calculated at document parsing time, before any executor instances are created). That simple change is here (though its impact is perhaps subtle):

  http://svn.apache.org/viewvc?view=rev&revision=615543

Could you please try out the latest build from trunk (without your change, ofcourse) and see if that fixes the problem as well? Thanks in advance.


> NullPointer exceptions during triggerEvent
> ------------------------------------------
>
>                 Key: SCXML-65
>                 URL: https://issues.apache.org/jira/browse/SCXML-65
>             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 triggerEvent().
> 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: events(TriggerEvent{name=wv.status,type=3},TriggerEvent{name=wv.ok,type=3})
> 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(SCXMLSemanticsImpl.java:493)
>         at org.apache.commons.scxml.semantics.SCXMLSemanticsImpl.followTransitions(SCXMLSemanticsImpl.java:652)
>         at org.apache.commons.scxml.SCXMLExecutor.triggerEvents(SCXMLExecutor.java:127)
>         at com.nsn.loadtool.scxml.SCXMLUser.triggerEvents(SCXMLUser.java:164)
>         at com.nsn.loadtool.scxml.SCXMLAsyncExecutor$SCXMLWorker.run(SCXMLAsyncExecutor.java:101)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>         at java.lang.Thread.run(Thread.java:595)
> 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.


[jira] Commented: (SCXML-65) NullPointer exceptions during triggerEvent

Posted by "luc willems (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SCXML-65?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12575816#action_12575816 ] 

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 into
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 SCXMLSemanticsImpl.java :
            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: https://issues.apache.org/jira/browse/SCXML-65
>             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 triggerEvent().
> 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: events(TriggerEvent{name=wv.status,type=3},TriggerEvent{name=wv.ok,type=3})
> 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(SCXMLSemanticsImpl.java:493)
>         at org.apache.commons.scxml.semantics.SCXMLSemanticsImpl.followTransitions(SCXMLSemanticsImpl.java:652)
>         at org.apache.commons.scxml.SCXMLExecutor.triggerEvents(SCXMLExecutor.java:127)
>         at com.nsn.loadtool.scxml.SCXMLUser.triggerEvents(SCXMLUser.java:164)
>         at com.nsn.loadtool.scxml.SCXMLAsyncExecutor$SCXMLWorker.run(SCXMLAsyncExecutor.java:101)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>         at java.lang.Thread.run(Thread.java:595)
> 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.


[jira] Commented: (SCXML-65) NullPointer exceptions during triggerEvent

Posted by "Rahul Akolkar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SCXML-65?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12592544#action_12592544 ] 

Rahul Akolkar commented on SCXML-65:
------------------------------------

I intend to close this issue as fixed in a week's time.


> NullPointer exceptions during triggerEvent
> ------------------------------------------
>
>                 Key: SCXML-65
>                 URL: https://issues.apache.org/jira/browse/SCXML-65
>             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 triggerEvent().
> 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: events(TriggerEvent{name=wv.status,type=3},TriggerEvent{name=wv.ok,type=3})
> 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(SCXMLSemanticsImpl.java:493)
>         at org.apache.commons.scxml.semantics.SCXMLSemanticsImpl.followTransitions(SCXMLSemanticsImpl.java:652)
>         at org.apache.commons.scxml.SCXMLExecutor.triggerEvents(SCXMLExecutor.java:127)
>         at com.nsn.loadtool.scxml.SCXMLUser.triggerEvents(SCXMLUser.java:164)
>         at com.nsn.loadtool.scxml.SCXMLAsyncExecutor$SCXMLWorker.run(SCXMLAsyncExecutor.java:101)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>         at java.lang.Thread.run(Thread.java:595)
> 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.


[jira] Commented: (SCXML-65) NullPointer exceptions during triggerEvent

Posted by "luc willems (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SCXML-65?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12577091#action_12577091 ] 

luc willems commented on SCXML-65:
----------------------------------

hello Rahul,

i upgraded to current SVN source today , and all seems to be well now :-)
i'll be doing some more test on a sun T1000/solaris system this week.

luc

> NullPointer exceptions during triggerEvent
> ------------------------------------------
>
>                 Key: SCXML-65
>                 URL: https://issues.apache.org/jira/browse/SCXML-65
>             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 triggerEvent().
> 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: events(TriggerEvent{name=wv.status,type=3},TriggerEvent{name=wv.ok,type=3})
> 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(SCXMLSemanticsImpl.java:493)
>         at org.apache.commons.scxml.semantics.SCXMLSemanticsImpl.followTransitions(SCXMLSemanticsImpl.java:652)
>         at org.apache.commons.scxml.SCXMLExecutor.triggerEvents(SCXMLExecutor.java:127)
>         at com.nsn.loadtool.scxml.SCXMLUser.triggerEvents(SCXMLUser.java:164)
>         at com.nsn.loadtool.scxml.SCXMLAsyncExecutor$SCXMLWorker.run(SCXMLAsyncExecutor.java:101)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>         at java.lang.Thread.run(Thread.java:595)
> 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.


[jira] Closed: (SCXML-65) NullPointer exceptions during triggerEvent

Posted by "luc willems (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SCXML-65?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

luc willems closed SCXML-65.
----------------------------

    Resolution: Fixed

tested with my linux (opensuse 10.3) and Solaris 10.
fixed in upcoming 0.8 release

thanks

> NullPointer exceptions during triggerEvent
> ------------------------------------------
>
>                 Key: SCXML-65
>                 URL: https://issues.apache.org/jira/browse/SCXML-65
>             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 triggerEvent().
> 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: events(TriggerEvent{name=wv.status,type=3},TriggerEvent{name=wv.ok,type=3})
> 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(SCXMLSemanticsImpl.java:493)
>         at org.apache.commons.scxml.semantics.SCXMLSemanticsImpl.followTransitions(SCXMLSemanticsImpl.java:652)
>         at org.apache.commons.scxml.SCXMLExecutor.triggerEvents(SCXMLExecutor.java:127)
>         at com.nsn.loadtool.scxml.SCXMLUser.triggerEvents(SCXMLUser.java:164)
>         at com.nsn.loadtool.scxml.SCXMLAsyncExecutor$SCXMLWorker.run(SCXMLAsyncExecutor.java:101)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>         at java.lang.Thread.run(Thread.java:595)
> 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.


[jira] Issue Comment Edited: (SCXML-65) NullPointer exceptions during triggerEvent

Posted by "luc willems (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SCXML-65?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12575816#action_12575816 ] 

willems.luc@pandora.be edited comment on SCXML-65 at 3/6/08 10:09 AM:
-----------------------------------------------------------

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 into
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 SCXMLSemanticsImpl.java :
            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 a synchronized block so it will block the first time to correctly fillup the paths array
        if (paths.size() == 0) {
           synchronized(this) {
             if (paths.size == 0) {
                   if (targets.size() > 0) {
                    .........
             }
          }

after this change , no nullpointers have occured anymore :-)

so i suspect this is a thread savety issue with Transistion class.



      was (Author: willems.luc@pandora.be):
    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 into
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 SCXMLSemanticsImpl.java :
            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: https://issues.apache.org/jira/browse/SCXML-65
>             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 triggerEvent().
> 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: events(TriggerEvent{name=wv.status,type=3},TriggerEvent{name=wv.ok,type=3})
> 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(SCXMLSemanticsImpl.java:493)
>         at org.apache.commons.scxml.semantics.SCXMLSemanticsImpl.followTransitions(SCXMLSemanticsImpl.java:652)
>         at org.apache.commons.scxml.SCXMLExecutor.triggerEvents(SCXMLExecutor.java:127)
>         at com.nsn.loadtool.scxml.SCXMLUser.triggerEvents(SCXMLUser.java:164)
>         at com.nsn.loadtool.scxml.SCXMLAsyncExecutor$SCXMLWorker.run(SCXMLAsyncExecutor.java:101)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>         at java.lang.Thread.run(Thread.java:595)
> 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.