Severity
Not blocking customers directly, but it means every delete-instance run leaves a permanently orphaned OctopusServerNode row behind. Over time (or after repeated instance recreation using the same node name) this can lead to confusing downstream cluster/locking symptoms, since the database still thinks a long-gone node exists.
Version
Confirmed present since at least 2019
Latest Version
I could reproduce the problem in the latest build
What happened?
Running Octopus.Server delete-instance logs "De-registered <NodeName> from the database.", but the node's row in the OctopusServerNode table is never actually deleted.
The cleanup code builds its DELETE using the raw node name:
var commandText = $"DELETE FROM [OctopusServerNode] WHERE [Id] = @serverName";
connection.ExecuteNonQuery(commandText, new Dictionary<string, object> { { "serverName", serverName } });
but OctopusServerNode.Id is always "OctopusServerNodes-" + name, not the raw name. The WHERE clause never matches anything, so the DELETE silently affects 0 rows. Because the row count isn't checked, the "De-registered..." log message is written regardless of whether anything was actually removed.
Interestingly, the equivalent cleanup for OctopusServerNodeStatus a couple of lines below gets this right — it does wrap the value in the proper ID-building helper. Only the OctopusServerNode delete has the mismatch.
Reproduction
- Set up an Octopus Server instance and note its server node name (defaults to the machine name).
- Run
Octopus.Server.exe delete-instance --instance <InstanceName> against it.
- Observe the log line
De-registered <NodeName> from the database.
- Query the database directly:
SELECT * FROM [OctopusServerNode] WHERE [Id] = 'OctopusServerNodes-<NodeName>' — the row is still present.
Error and Stacktrace
N/A — this fails silently. No exception is thrown; the DELETE simply matches and affects 0 rows.
More Information
No response
Workaround
After confirming the Octopus Server process has fully stopped (otherwise its heartbeat will just re-insert the row), manually remove the stale row:
DELETE FROM [OctopusServerNode] WHERE [Id] = 'OctopusServerNodes-<NodeName>'
Severity
Not blocking customers directly, but it means every
delete-instancerun leaves a permanently orphanedOctopusServerNoderow behind. Over time (or after repeated instance recreation using the same node name) this can lead to confusing downstream cluster/locking symptoms, since the database still thinks a long-gone node exists.Version
Confirmed present since at least 2019
Latest Version
I could reproduce the problem in the latest build
What happened?
Running
Octopus.Server delete-instancelogs"De-registered <NodeName> from the database.", but the node's row in theOctopusServerNodetable is never actually deleted.The cleanup code builds its
DELETEusing the raw node name:but
OctopusServerNode.Idis always"OctopusServerNodes-" + name, not the raw name. TheWHEREclause never matches anything, so theDELETEsilently affects 0 rows. Because the row count isn't checked, the "De-registered..." log message is written regardless of whether anything was actually removed.Interestingly, the equivalent cleanup for
OctopusServerNodeStatusa couple of lines below gets this right — it does wrap the value in the proper ID-building helper. Only theOctopusServerNodedelete has the mismatch.Reproduction
Octopus.Server.exe delete-instance --instance <InstanceName>against it.De-registered <NodeName> from the database.SELECT * FROM [OctopusServerNode] WHERE [Id] = 'OctopusServerNodes-<NodeName>'— the row is still present.Error and Stacktrace
N/A — this fails silently. No exception is thrown; the DELETE simply matches and affects 0 rows.More Information
No response
Workaround
After confirming the Octopus Server process has fully stopped (otherwise its heartbeat will just re-insert the row), manually remove the stale row: