Elastic Deployment, Machine spins down during deploy, Deploy Fails, Triggers stop

Hey everyone,

Thanks for all the help with our Elastic conundrum till this point. It’s much more rigid and stable today than it was when we started.

Unfortunately, we are running into another issue.

What we’re seeing is that if I deploy a release to an elastic environment and a machine I’m deploying to shuts down (traffic is low enough to warrant the machine shutting down) it runs into an exception:

Server exception: 
System.ObjectDisposedException: Instances cannot be resolved and nested lifetimes cannot be created from this LifetimeScope as it has already been disposed.

If this is a manual deployment it’s not an issue, because the person would just have to redeploy. However, we’re seeing this on spinup. Basically, what happens is, a machine spins up and takes a while. Then it triggers a deploy and takes some time to do so, if the timing happens in a perfect way, that machine could be taken down due to low enough traffic, before it’s fully spun up.

In that scenario it will fail the release, meaning future triggers will not work, and our project can’t make new machines without manual intervention.

Any clue on how to resolve this? Can I possibly check if the machine is deploying currently and stall a shutdown?

Thanks,
Jakub

Hey all,

I’m closing this. I managed to resolve this by querying the Octopus API and ensuring there are no running deployments before taking it off the Octopus server.

Thanks all!