Goal
Release a stale script isolation lock on a Tentacle deployment target or worker. Do this when a deployment or runbook run is waiting on a server task that has already finished or doesn't exist. The Tentacle steps apply to any Tentacle you can reach. The Octopus Server restart in step 7 applies only to self-hosted Octopus Server. Octopus Cloud customers must contact Octopus support for that step.
Prerequisites
-
Permission to view and cancel tasks in Octopus.
-
Administrator (Windows) or root/sudo (Linux) access to the machine running the affected Tentacle.
-
The name of the Tentacle instance. Default instances are named
Tentacle. To list instances on the machine, run:
Tentacle.exe list-instances
- For step 7 only: administrator access to the Octopus Server host (self-hosted only).
Steps
- Open the task log for the stuck deployment or runbook run. Look for a
Waitline like this:
Waiting for the script in task ServerTasks-XXXXX to finish as this script requires that no other Octopus scripts are executing on this target at the same time.
This line means the task is waiting for a script isolation lock on one specific target or worker. If the task log has no line like this, the task is waiting on something else, and this article doesn't apply.
-
Note which target is blocking the task. In the task log, expand the step that contains the
Waitline and find the target or worker it is running against. If you switch the log to verbose output, you may also seeAcquiring isolation mutex ...lines that name the endpoint. -
Check the server task named in the
Waitline (ServerTasks-XXXXX) in Tasks. The lock is likely stale if any of these is true: -
The task shows as completed, failed, or cancelled.
-
Opening the task returns:
The resource 'ServerTasks-XXXXX' was not found.
-
The
Waitline shows(error - task not found)instead of a task ID. -
The
Waitline shows a short alphanumeric string instead of aServerTasks-NNNorRunbookRuns-NNNID.
Caution:
(error - task not found)can also appear while another task is still legitimately holding a lock. Before you continue, check Tasks for any task that is still running against the same target. If one is running, wait for it to finish or cancel it instead of restarting the Tentacle.
-
Optional: cancel the stuck deployment or runbook run so it doesn't keep waiting while you restart the Tentacle. You can start it again in step 1 of Verify.
-
Sign in to the target or worker machine itself and restart the Tentacle service for the affected instance. Don't run the restart from an Octopus Run a Script step. A restart started that way can look like it failed even when it worked.
Windows:
"C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe" service --instance <InstanceName> --restart
Linux:
/opt/octopus/tentacle/Tentacle service --instance <InstanceName> --restart
On Windows you can also restart the instance from Tentacle Manager.
-
If the stuck task was running on the built-in worker on the Octopus Server, you need to restart the Octopus Server service instead of a Tentacle.
-
Self-hosted: on the Octopus Server host, run:
Octopus.Server.exe service --instance OctopusServer --restart
Plan for a short outage. Any tasks running on that node will be interrupted.
-
Octopus Cloud: you can't restart the Octopus Server yourself. Contact Octopus support with the stuck task ID and the
ServerTasks-XXXXXID from theWaitline.
Verify
- In Octopus, go to Infrastructure, open the affected deployment target or worker, and run a health check from the Connectivity tab. Confirm it finishes as healthy.
- Start the cancelled deployment or runbook run again, or start a new one, against the same target.
- Open the new task log and confirm it has no
Waiting for the script in task ... to finishline referencing the old task ID, and that the step runs on the target. - If the task gets stuck again right away, collect a process dump of the Tentacle process before you restart it again. Attach the dump to your support request.
Related
- Tentacle service command-line reference: options for starting, stopping, and restarting Tentacle services.
- Linux Tentacle documentation: installing and running Tentacle as a systemd service.
- Capturing process dumps for Octopus support: how to collect a dump of the Tentacle process.
- GitHub issue 7824: Server Tasks Not Found error: a public report of waits that reference a server task that doesn't exist.
- GitHub issue 10134: Wait message referencing an ID with no corresponding task: a public report of wait messages with IDs that can't be traced back to a task.
- GitHub issue 7174: Wait message shows "(error - task not found)": explains why this text can appear while a lock is still legitimately held.
- GitHub issue 885: service --restart from a script step may appear to fail: why you should restart the Tentacle on the machine rather than from a deployment step.