Hi, I was able to figure this out. Logic was not quite right as, if the number instances to be created is 0.5(scale up), it will try to scale down, according to the following logic. I have fixed this now and testing further.
float additionalInstances = requiredInstances - currentInstances; if(additionalInstances >= 1) { createGroupInstanceOnScaling(networkPartitionContext, parentInstanceId); } else { //have to scale down I have also fixed the NPE occurred by putting null check. Thanks. On Tue, Mar 10, 2015 at 11:19 AM, Lahiru Sandaruwan <lahi...@wso2.com> wrote: > And it should not terminate cluster, when it should create another group > instance. > > Thanks. > > On Tue, Mar 10, 2015 at 10:54 AM, Rajkumar Rajaratnam <rajkum...@wso2.com> > wrote: > >> There is no null check there in the code, results in NPE. >> >> On Tue, Mar 10, 2015 at 10:37 AM, Lahiru Sandaruwan <lahi...@wso2.com> >> wrote: >> >>> Hi, >>> >>> I could find $subject. I am testing with sample >>> "$stratos_source/samples/applications/dependent-scaling/sample-groups" >>> >>> Looking into it. >>> >>> Thanks. >>> [1] >>> >>> >>> [2015-03-10 10:34:04,945] INFO >>> {org.apache.stratos.autoscaler.monitor.component.GroupMonitor} - Parent >>> scaling event received to [group]: my-esb-php-group, [network partition]: >>> network-partition-1, [event] my-esb-php-group, [group instance] >>> dependency-scaling-groups-app-1, [factor] 2.5 >>> >>> [2015-03-10 10:34:04,946] INFO >>> {org.apache.stratos.autoscaler.monitor.component.GroupMonitor} - [Group] >>> my-esb-php-group is notifying the [parent] dependency-scaling-groups-app >>> [instance] dependency-scaling-groups-app-1 >>> >>> [2015-03-10 10:34:04,946] INFO >>> {org.apache.stratos.autoscaler.monitor.cluster.ClusterMonitor} - >>> Publishing Cluster terminating event for [application] >>> dependency-scaling-groups-app [cluster] >>> dependency-scaling-groups-app.my-esb.esb.domain [instance] >>> my-esb-php-group-2 >>> >>> [2015-03-10 10:34:04,951] INFO >>> {org.apache.stratos.autoscaler.monitor.cluster.ClusterMonitor} - >>> Publishing Cluster terminating event for [application] >>> dependency-scaling-groups-app [cluster] >>> dependency-scaling-groups-app.my-php.php.domain [instance] >>> my-esb-php-group-2 >>> >>> Exception in thread "pool-38-thread-8" java.lang.NullPointerException >>> >>> at >>> org.apache.stratos.autoscaler.event.publisher.ClusterStatusEventPublisher.sendClusterTerminatingEvent(ClusterStatusEventPublisher.java:187) >>> >>> at >>> org.apache.stratos.autoscaler.monitor.cluster.ClusterMonitor.onParentStatusEvent(ClusterMonitor.java:669) >>> >>> at >>> org.apache.stratos.autoscaler.monitor.events.builder.MonitorStatusEventBuilder.notifyChildren(MonitorStatusEventBuilder.java:91) >>> >>> at >>> org.apache.stratos.autoscaler.monitor.component.GroupMonitor.setStatus(GroupMonitor.java:356) >>> >>> at >>> org.apache.stratos.autoscaler.applications.topic.ApplicationBuilder.updateGroupMonitor(ApplicationBuilder.java:705) >>> >>> [2015-03-10 10:34:04,953] INFO >>> {org.apache.stratos.cloud.controller.messaging.topology.TopologyBuilder} - >>> Cluster Terminating adding status started >>> fordependency-scaling-groups-app.my-esb.esb.domain >>> >>> at >>> org.apache.stratos.autoscaler.applications.topic.ApplicationBuilder.handleGroupTerminatingEvent(ApplicationBuilder.java:642) >>> >>> at >>> org.apache.stratos.autoscaler.monitor.component.GroupMonitor.onParentScalingEvent(GroupMonitor.java:489) >>> >>> at >>> org.apache.stratos.autoscaler.monitor.component.ParentComponentMonitor.handleDependentScaling(ParentComponentMonitor.java:607) >>> >>> at >>> org.apache.stratos.autoscaler.monitor.component.ApplicationMonitor$1.run(ApplicationMonitor.java:124) >>> >>> at >>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) >>> >>> at >>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) >>> >>> at java.lang.Thread.run(Thread.java:745) >>> >>> [2015-03-10 10:34:04,958] INFO >>> {org.apache.stratos.cloud.controller.messaging.publisher.TopologyEventPublisher} >>> - Publishing Cluster terminating event: [application-id] >>> dependency-scaling-groups-app [cluster id] >>> dependency-scaling-groups-app.my-esb.esb.domain [instance-id] >>> my-esb-php-group-2 >>> >>> [2015-03-10 10:34:04,963] INFO >>> {org.apache.stratos.autoscaler.event.receiver.topology.AutoscalerTopologyEventReceiver} >>> - [ClusterTerminatingEvent] Received: class >>> org.apache.stratos.messaging.event.topology.ClusterInstanceTerminatingEvent >>> >>> [2015-03-10 10:34:04,964] WARN >>> {org.apache.stratos.autoscaler.status.processor.cluster.ClusterStatusActiveProcessor} >>> - No possible state change found for [type] [cluster] >>> dependency-scaling-groups-app.my-esb.esb.domain [instance] >>> >>> [2015-03-10 10:34:04,964] INFO >>> {org.apache.stratos.autoscaler.monitor.cluster.ClusterMonitor} - Starting >>> to terminate all members in cluster >>> [dependency-scaling-groups-app.my-esb.esb.domain] Network Partition >>> [network-partition-1], Partition [partition-1] >>> >>> [2015-03-10 10:34:04,965] DEBUG >>> {org.apache.stratos.autoscaler.rule.RuleLog} - Running obsolete instances >>> rule: [partition] partition-1 [network-partition] network-partition-1 >>> [cluster] dependency-scaling-groups-app.my-esb.esb.domain >>> >>> [2015-03-10 10:34:04,965] DEBUG >>> {org.apache.stratos.autoscaler.rule.RuleLog} - [obsolete-check] >>> [network-partition] network-partition-1 [partition] partition-1 [cluster] >>> dependency-scaling-groups-app.my-esb.esb.domain Obsolete member count: 0 >>> >>> [2015-03-10 10:34:04,965] DEBUG >>> {org.apache.stratos.autoscaler.rule.RuleLog} - Running minimum rule: >>> [network-partition] network-partition-1 [cluster-instance] >>> my-esb-php-group-1 >>> >>> [2015-03-10 10:34:04,965] DEBUG >>> {org.apache.stratos.autoscaler.rule.RuleLog} - Running instances cleanup >>> event sender rule: [partition] partition-1 [network-partition] >>> network-partition-1 >>> >>> [2015-03-10 10:34:04,965] DEBUG >>> {org.apache.stratos.autoscaler.rule.RuleLog} - [min-check] >>> [network-partition] network-partition-1 [cluster-instance] >>> my-esb-php-group-1 [cluster] >>> dependency-scaling-groups-app.my-esb.esb.domain Non terminated member >>> count: 1 >>> >>> [2015-03-10 10:34:04,965] DEBUG >>> {org.apache.stratos.autoscaler.rule.RuleLog} - [instance-cleanup-check] >>> [network-partition] network-partition-1 [partition] partition-1 [cluster] >>> dependency-scaling-groups-app.my-esb.esb.domain Pending termination member >>> count: 0 >>> >>> [2015-03-10 10:34:04,965] DEBUG >>> {org.apache.stratos.autoscaler.rule.RuleLog} - [min-check] >>> [network-partition] network-partition-1 [cluster-instance] >>> my-esb-php-group-1 [cluster] >>> dependency-scaling-groups-app.my-esb.esb.domain Minimum member count: 1 >>> >>> [2015-03-10 10:34:04,966] DEBUG >>> {org.apache.stratos.autoscaler.rule.RuleLog} - Running obsolete instances >>> rule: [partition] partition-1 [network-partition] network-partition-1 >>> [cluster] dependency-scaling-groups-app.my-esb.esb.domain >>> >>> [2015-03-10 10:34:04,966] INFO >>> {org.apache.stratos.autoscaler.monitor.cluster.ClusterMonitor} - Executing >>> scaling rule as statistics have been reset >>> >>> [2015-03-10 10:34:04,966] DEBUG >>> {org.apache.stratos.autoscaler.rule.RuleLog} - Running scale up rule: >>> [network-partition] network-partition-1 [cluster] >>> dependency-scaling-groups-app.my-esb.esb.domain >>> >>> [2015-03-10 10:34:04,966] DEBUG >>> {org.apache.stratos.autoscaler.rule.RuleLog} - [obsolete-check] >>> [network-partition] network-partition-1 [partition] partition-1 [cluster] >>> dependency-scaling-groups-app.my-esb.esb.domain Obsolete member count: 0 >>> >>> [2015-03-10 10:34:04,966] DEBUG >>> {org.apache.stratos.autoscaler.rule.RuleLog} - [scaling] >>> [network-partition] network-partition-1 [cluster] >>> dependency-scaling-groups-app.my-esb.esb.domain Algorithm name: >>> one-after-another >>> >>> [2015-03-10 10:34:04,966] DEBUG >>> {org.apache.stratos.autoscaler.rule.RuleLog} - Running instances cleanup >>> event sender rule: [partition] partition-1 [network-partition] >>> network-partition-1 >>> >>> [2015-03-10 10:34:04,967] DEBUG >>> {org.apache.stratos.autoscaler.rule.RuleLog} - [instance-cleanup-check] >>> [network-partition] network-partition-1 [partition] partition-1 [cluster] >>> dependency-scaling-groups-app.my-esb.esb.domain Pending termination member >>> count: 0 >>> >>> -- >>> -- >>> Lahiru Sandaruwan >>> Committer and PMC member, Apache Stratos, >>> Senior Software Engineer, >>> WSO2 Inc., http://wso2.com >>> lean.enterprise.middleware >>> >>> email: lahi...@wso2.com blog: http://lahiruwrites.blogspot.com/ >>> linked-in: http://lk.linkedin.com/pub/lahiru-sandaruwan/16/153/146 >>> >>> >> >> >> -- >> Rajkumar Rajaratnam >> Committer & PMC Member, Apache Stratos >> Software Engineer, WSO2 >> >> Mobile : +94777568639 >> Blog : rajkumarr.com >> > > > > -- > -- > Lahiru Sandaruwan > Committer and PMC member, Apache Stratos, > Senior Software Engineer, > WSO2 Inc., http://wso2.com > lean.enterprise.middleware > > email: lahi...@wso2.com blog: http://lahiruwrites.blogspot.com/ > linked-in: http://lk.linkedin.com/pub/lahiru-sandaruwan/16/153/146 > > -- -- Lahiru Sandaruwan Committer and PMC member, Apache Stratos, Senior Software Engineer, WSO2 Inc., http://wso2.com lean.enterprise.middleware email: lahi...@wso2.com blog: http://lahiruwrites.blogspot.com/ linked-in: http://lk.linkedin.com/pub/lahiru-sandaruwan/16/153/146