Instances cannot be resolved and nested lifetimes cannot be created from this LifetimeScope as it has already been disposed

Hi,

I’m seeing more and more of these errors when upgrading Tentacle versions. It seem that it manages to complete despite the error. Is this a real error? Anything we need to worry about?

Running Tentacle version 3.1.1
09:10:48Info
Beginning upgrade
09:10:56Error
Instances cannot be resolved and nested lifetimes cannot be created from this LifetimeScope as it has already been disposed.

Server exception:
System.ObjectDisposedException: Instances cannot be resolved and nested lifetimes cannot be created from this LifetimeScope as it has already been disposed.
at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable1 parameters) at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable1 parameters, Object& instance)
at Autofac.ResolutionExtensions.ResolveNamed[TService](IComponentContext context, String serviceName, IEnumerable1 parameters) at Octopus.Shared.Communications.AutofacServiceFactory.CreateService(String serviceName) at Halibut.ServiceModel.ServiceInvoker.Invoke(RequestMessage requestMessage) at Halibut.Transport.Protocol.MessageExchangeProtocol.InvokeAndWrapAnyExceptions(RequestMessage request, Func2 incomingRequestProcessor)
09:10:56Info
Waiting for Tentacle to shut down and restart with the new version 3.1.2…
09:10:57Info
Tentacle has stopped. Waiting for it to start…
09:11:08Info
Running Tentacle version 3.1.2
09:11:09Info
Finishing upgrade

/Jan

Hi Jan,

Thanks for getting in touch!

I don’t think it’s something that should cause any issues for you when upgrading your Tentacles as the upgrade completes successfully. As a precautionary measure thought, I’ve raised a GH issue #2036 for this to be investigated.

Thank you and warm regards,
Henrik

I’ve been running into this issue as well. It seems to happen most often when there are steps running in parallel. However, when I change something in the Process, or if the target server reboots, it seems to resolve itself for a while. Let me know what additionally information you could use to help debug it.

Thanks,
Erick

Hi Erick,

Thanks for getting in touch!

Are your deployments failing due to these errors or are they still completing successfully?

From what we’ve seen in the past, these errors can be safely ignored, but if you are experiencing deployment issues, then we will have to further investigate the issue.

Thank you and kind regards,
Henrik

After I shuffled the order of step execution, the errors stopped occurring. If I start getting them again, I’ll post the steps and what they are doing.

Thanks,
Erick

I managed to get the error by doing something most would consider nonsensical :
running the following on the target server :

Restart-Service “OctopusDeploy Tentacle”

Why?! - well I am changing the environment variables in the deploy but without bouncing the tenticle, it isn’t picking up the new variable values. But that is my problem…

But it does reproduce that error. Whether in a valid scenario, will let you decide.

Notice:

This issue has been closed due to inactivity. If you encounter the same or a similar issue and require help, please open a new discussion (if we asked for logs or extra details in this thread, consider including them in the new thread). If you are the creator of this thread and believe it should not be closed let us know via our support email.