You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by "Jason Anderson (JIRA)" <ji...@apache.org> on 2006/05/24 23:46:51 UTC

[jira] Created: (SM-439) servicemix-beanflow - Workflow.joinAll failure to register onStop callback if first Activity stops during start handler

servicemix-beanflow - Workflow.joinAll failure to register onStop callback if first Activity stops during start handler
-----------------------------------------------------------------------------------------------------------------------

         Key: SM-439
         URL: https://issues.apache.org/activemq/browse/SM-439
     Project: ServiceMix
        Type: Bug

    Versions: incubation    
 Environment: osx, jdk 1.5
    Reporter: Jason Anderson


if the following code is run the JoinFlow.stop state will never be thrown because the internal JoinAll state is set to stopped after forking the first activity in the JoinSupport(Activity ...) constructor before the onStop callback is registered in WorkFlow.join

public class JoinTest extends TestCase {

    public static class JoinFlow extends Workflow<JoinFlow.Step> {

        public static enum Step {
            first, stop
        }

        public JoinFlow() {
            super(Step.first);
        }

        public void first() {
            final Activity a = new TimeoutActivity() {
                protected void onValidStateChange() {
                    System.out.println("in a");
                    stop();
                }
            };
            final Activity b = new TimeoutActivity() {
                protected void onValidStateChange() {
                    System.out.println("in b");
                    stop();
                }
            };
            System.out.println("in first");
            joinAll(Step.stop, 10000, a, b);
            System.out.println("after join");
        }
    }

    public void testJoin() throws Exception {
        JoinFlow flow = new JoinFlow();
        flow.start();
        flow.join();
    }


}


I believe if the JoinSupport were to add all the activities to the children list before forking them it would prevent the JoinAll.onChildStateChange from being called prematurely with childCount=1, stoppedCount=1 when there should be 2 children but I cannot currently get the maven build to run to test this thoery





-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (SM-439) servicemix-beanflow - Workflow.joinAll failure to register onStop callback if first Activity stops during start handler

Posted by "james strachan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SM-439?page=all ]

james strachan resolved SM-439.
-------------------------------

    Resolution: Fixed

OK I think I've fixed it for good this time :)

This test case managed to bring to light a few timing issues in the code. Basically the Workflow class was a little too complex for its own good so I've simplified that a bit. Also there was a chance that in JoinSupport things could get started twice which is now fixed. Finally the one that really took me a while to figure out was that sometimes activities stop before they have completely finished starting; so the AbstractActivity start() method now only sets the status to Start if it is Starting (to avoid overwriting the Stopped/Failed status)

> servicemix-beanflow - Workflow.joinAll failure to register onStop callback if first Activity stops during start handler
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: SM-439
>                 URL: https://issues.apache.org/activemq/browse/SM-439
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: beanflow
>    Affects Versions: incubation
>         Environment: osx, jdk 1.5
>            Reporter: Jason Anderson
>         Assigned To: james strachan
>             Fix For: 3.0-M3
>
>
> if the following code is run the JoinFlow.stop state will never be thrown because the internal JoinAll state is set to stopped after forking the first activity in the JoinSupport(Activity ...) constructor before the onStop callback is registered in WorkFlow.join
> public class JoinTest extends TestCase {
>     public static class JoinFlow extends Workflow<JoinFlow.Step> {
>         public static enum Step {
>             first, stop
>         }
>         public JoinFlow() {
>             super(Step.first);
>         }
>         public void first() {
>             final Activity a = new TimeoutActivity() {
>                 protected void onValidStateChange() {
>                     System.out.println("in a");
>                     stop();
>                 }
>             };
>             final Activity b = new TimeoutActivity() {
>                 protected void onValidStateChange() {
>                     System.out.println("in b");
>                     stop();
>                 }
>             };
>             System.out.println("in first");
>             joinAll(Step.stop, 10000, a, b);
>             System.out.println("after join");
>         }
>     }
>     public void testJoin() throws Exception {
>         JoinFlow flow = new JoinFlow();
>         flow.start();
>         flow.join();
>     }
> }
> I believe if the JoinSupport were to add all the activities to the children list before forking them it would prevent the JoinAll.onChildStateChange from being called prematurely with childCount=1, stoppedCount=1 when there should be 2 children but I cannot currently get the maven build to run to test this thoery

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Assigned: (SM-439) servicemix-beanflow - Workflow.joinAll failure to register onStop callback if first Activity stops during start handler

Posted by "james strachan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SM-439?page=all ]

james strachan reassigned SM-439:
---------------------------------

    Assignee: james strachan

> servicemix-beanflow - Workflow.joinAll failure to register onStop callback if first Activity stops during start handler
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: SM-439
>                 URL: https://issues.apache.org/activemq/browse/SM-439
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: beanflow
>    Affects Versions: incubation
>         Environment: osx, jdk 1.5
>            Reporter: Jason Anderson
>         Assigned To: james strachan
>
> if the following code is run the JoinFlow.stop state will never be thrown because the internal JoinAll state is set to stopped after forking the first activity in the JoinSupport(Activity ...) constructor before the onStop callback is registered in WorkFlow.join
> public class JoinTest extends TestCase {
>     public static class JoinFlow extends Workflow<JoinFlow.Step> {
>         public static enum Step {
>             first, stop
>         }
>         public JoinFlow() {
>             super(Step.first);
>         }
>         public void first() {
>             final Activity a = new TimeoutActivity() {
>                 protected void onValidStateChange() {
>                     System.out.println("in a");
>                     stop();
>                 }
>             };
>             final Activity b = new TimeoutActivity() {
>                 protected void onValidStateChange() {
>                     System.out.println("in b");
>                     stop();
>                 }
>             };
>             System.out.println("in first");
>             joinAll(Step.stop, 10000, a, b);
>             System.out.println("after join");
>         }
>     }
>     public void testJoin() throws Exception {
>         JoinFlow flow = new JoinFlow();
>         flow.start();
>         flow.join();
>     }
> }
> I believe if the JoinSupport were to add all the activities to the children list before forking them it would prevent the JoinAll.onChildStateChange from being called prematurely with childCount=1, stoppedCount=1 when there should be 2 children but I cannot currently get the maven build to run to test this thoery

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Reopened: (SM-439) servicemix-beanflow - Workflow.joinAll failure to register onStop callback if first Activity stops during start handler

Posted by "james strachan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SM-439?page=all ]

james strachan reopened SM-439:
-------------------------------

             
Seems to be some timing issue in there still on some platforms

> servicemix-beanflow - Workflow.joinAll failure to register onStop callback if first Activity stops during start handler
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: SM-439
>                 URL: https://issues.apache.org/activemq/browse/SM-439
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: beanflow
>    Affects Versions: incubation
>         Environment: osx, jdk 1.5
>            Reporter: Jason Anderson
>         Assigned To: james strachan
>             Fix For: 3.0-M3
>
>
> if the following code is run the JoinFlow.stop state will never be thrown because the internal JoinAll state is set to stopped after forking the first activity in the JoinSupport(Activity ...) constructor before the onStop callback is registered in WorkFlow.join
> public class JoinTest extends TestCase {
>     public static class JoinFlow extends Workflow<JoinFlow.Step> {
>         public static enum Step {
>             first, stop
>         }
>         public JoinFlow() {
>             super(Step.first);
>         }
>         public void first() {
>             final Activity a = new TimeoutActivity() {
>                 protected void onValidStateChange() {
>                     System.out.println("in a");
>                     stop();
>                 }
>             };
>             final Activity b = new TimeoutActivity() {
>                 protected void onValidStateChange() {
>                     System.out.println("in b");
>                     stop();
>                 }
>             };
>             System.out.println("in first");
>             joinAll(Step.stop, 10000, a, b);
>             System.out.println("after join");
>         }
>     }
>     public void testJoin() throws Exception {
>         JoinFlow flow = new JoinFlow();
>         flow.start();
>         flow.join();
>     }
> }
> I believe if the JoinSupport were to add all the activities to the children list before forking them it would prevent the JoinAll.onChildStateChange from being called prematurely with childCount=1, stoppedCount=1 when there should be 2 children but I cannot currently get the maven build to run to test this thoery

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Resolved: (SM-439) servicemix-beanflow - Workflow.joinAll failure to register onStop callback if first Activity stops during start handler

Posted by "james strachan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SM-439?page=all ]

james strachan resolved SM-439.
-------------------------------

    Fix Version/s: 3.0-M3
       Resolution: Fixed

Thanks for the test case and description of the bug Jason!

I've patched trunk to add your test case and its now working properly

> servicemix-beanflow - Workflow.joinAll failure to register onStop callback if first Activity stops during start handler
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: SM-439
>                 URL: https://issues.apache.org/activemq/browse/SM-439
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: beanflow
>    Affects Versions: incubation
>         Environment: osx, jdk 1.5
>            Reporter: Jason Anderson
>         Assigned To: james strachan
>             Fix For: 3.0-M3
>
>
> if the following code is run the JoinFlow.stop state will never be thrown because the internal JoinAll state is set to stopped after forking the first activity in the JoinSupport(Activity ...) constructor before the onStop callback is registered in WorkFlow.join
> public class JoinTest extends TestCase {
>     public static class JoinFlow extends Workflow<JoinFlow.Step> {
>         public static enum Step {
>             first, stop
>         }
>         public JoinFlow() {
>             super(Step.first);
>         }
>         public void first() {
>             final Activity a = new TimeoutActivity() {
>                 protected void onValidStateChange() {
>                     System.out.println("in a");
>                     stop();
>                 }
>             };
>             final Activity b = new TimeoutActivity() {
>                 protected void onValidStateChange() {
>                     System.out.println("in b");
>                     stop();
>                 }
>             };
>             System.out.println("in first");
>             joinAll(Step.stop, 10000, a, b);
>             System.out.println("after join");
>         }
>     }
>     public void testJoin() throws Exception {
>         JoinFlow flow = new JoinFlow();
>         flow.start();
>         flow.join();
>     }
> }
> I believe if the JoinSupport were to add all the activities to the children list before forking them it would prevent the JoinAll.onChildStateChange from being called prematurely with childCount=1, stoppedCount=1 when there should be 2 children but I cannot currently get the maven build to run to test this thoery

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira