Old "active" deployment stuck at "Cancellation of the task timed out"

Hello,
I was going through active and cancelling tasks after a failure, and noticed that we have a very old job that was stuck as “Active” but marked with "Cancellation of the task timeout. Clicking the cancel button does not do anything. I’ve tried restarting octopus deploy services on the server and tentacle to no avail. I was hoping there was a SQL Script that could be run to manually set that job to a canceled state or to remove it from the list of active tasks?

Thanks,
Larry

Hi Larry,

Thanks for getting in touch!

You can run the following SQL query to reset this task to a Canceled state.

UPDATE [dbo].[ServerTask] Set State='Canceled' WHERE Id='{Your Task ID}'

Hope that helps!

Thank you and best regards,
Henrik

Hi Henrik,

That doesn’t seem to work - I think that servertask is missing/corrupted in the db, because when I query the database directly it can’t find it.
Additionally when going through the UI it seems to indicate that the associated server task is missing?

[cid:image003.png@01D15A87.765FF520]

[cid:image004.png@01D15A87.765FF520]

Any suggestions on how to remove this or fix?

Thanks,

Larry

Hi Larry,

OK, could you query the DeploymentHistory table for the Id of your ‘stuck’ deployment. This should show you the current state the DB thinks it’s in, and you could then update the record to be Canceled.

I hope that helps!

Thank you and best regards,
Henrik

Hi Henrik,

That didn’t work so I had our DBA take a look since that record was missing. It looks like we just had to do a query by description, and update the servertasks table for the record that was stuck in a cancelling state.

Thanks!

Larry

Hi Larry,

Great to hear you were able to resolve the issue.

Thank you and best regards,
Henrik