Hi, Stratos fails to terminate a spawned instance if an application is deployed and undeployed immediately. The reason is when executing the terminate method, CC will fail if the member's instance id is null. There is a possibility that instance id could be null since it takes some time to return the jclouds call to spawn an instance and member context to be updated with instance id.
As a fix for this we can do a validation at SM side. It should check the topology and make sure all members in the app to be undeployed are already initialized (i.e. should not be in CREATED status). I've created a JIRA to track this task at [1]. I've implemented the proposed fix with PR at [2]. I've also created a unit test [3] to validate this. Please have a look. [1] https://issues.apache.org/jira/browse/STRATOS-1641 [2] https://github.com/apache/stratos/pull/501 [3] https://github.com/ravihansa3000/stratos/blob/99e4dcfe834af129dc7f9b2c8334f71f13d55636/components/org.apache.stratos.rest.endpoint/src/test/java/org/apache/stratos/rest/endpoint/test/UndeployApplicationTest.java Thanks. -- Akila Ravihansa Perera WSO2 Inc.; http://wso2.com/ Blog: http://ravihansa3000.blogspot.com