Unable to delete worker

I’m trying to delete a worker, but Octopus won’t let me. I’ve tried disabling it, and there’s (guaranteed) no active deploy running on that worker.


How can I delete it? (We are on Octopus 2018.10.5 LTS)

How can I see what’s blocking me from deploying it? Is there a way to force deleting it?

Hi Trond,

Thanks for getting in touch. I’ve had a look in the code and this error would be generated if a lease on the worker hasn’t been released. The lease entries are stored in the WorkerTaskLease table in the database, would you be able to see if there are any entries in there that correspond to the worker you are trying to delete?
The verbose details in the task logs should also be showing the details of then the leases are taken out and released. Would you be able to check the deployment task logs and see if there was any info logged about not being able to release a lease? That scenario wouldn’t actually fail a deployment, it would just lead to the lease hanging around. I believe the leases should also get cleaned up after a period of time, I’m just trying to track the specifics on that.


Hi, thanks for the info. There was indeed a single lease in that table. It was pointing to a deploy task with status “Cancelled”. Am I ok to just delete the lease, or will that cause ripple effects?

In the raw log for that task I can see that the lease was committed, but never release. The last lines of the log simply reads:

22:50:30   Verbose  |       Disposing SFTP connection...
22:50:30   Verbose  |       Disposing SSH connection...
22:50:30   Verbose  |       The task was canceled
22:50:30   Fatal    |       The action RiksTV.Deploy.ContainerDeploymentV2 on a Worker failed

You should be fine to delete it, it’s there to stop deletes while it’s in use and prevent other tasks from trying to use that worker if it’s too busy. I checked and there should actually be a system task cleaning up leases that are being held by tasks that are no longer running.

I’ll dig into whether there’s a gap somewhere if a task gets cancelled, maybe the lease isn’t explicitly released correctly in this case. Maybe the cleanup ignores it in this case too. Thanks for the extra info and let me know how you go.

good, thanks for the info. Deleting it then :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.