fix(deploy): #955 compose under SNAPSHOT + compose app lock, not SERIALIZABLE; time the deploy from receipt
The deploy compose's SERIALIZABLE transaction range-locked every config table for the whole validate+compose+gzip: a concurrent edit held the deploy (as long as its lock), was held by it, or deadlocked with it (reproduced on SQL Server: ~5 s per deadlock-monitor cycle, the deploy the victim 9 of 10 times). SNAPSHOT reads take no shared locks; composes stay serialised by a transaction-owned sp_getapplock taken before any data access (row-lock-first would fail a queued compose with 3960). The #949 phase timer now starts at receipt (dispatch, in-flight-check). The #923 gate's specific 10.5 s stall is not proven to be this mechanism (see evidence).
This commit is contained in:
+1
-1
@@ -1789,7 +1789,7 @@ curl -X POST https://<admin-host>/api/deployments \
|
||||
|
||||
Responses: `202 Accepted` (`{ outcome, deploymentId, revisionHash }`) when a deployment was sealed, `200` for `NoChanges`, `409` when another deployment is in flight (the body's `deploymentId` names it when it is a compose still running), `422` when rejected, `401` for a missing/wrong key, `503` when unconfigured.
|
||||
|
||||
**Outcome unknown (lmxopcua#949).** The trigger waits 10 s for the admin singleton. A slow compose (one gate run took 10.5 s) can outlast that and still create and apply the deployment, so a timeout is **not** reported as a failure: the id is pre-allocated before the ask and the response is `202 Accepted` with `{ "outcome": "OutcomeUnknown", "deploymentId": "<id>", "message": "…" }` and `Location: /api/deployments/<id>`. Poll that resource: `200` means the deployment exists (and carries exactly that id); `404` for a couple of minutes means it was not created and the trigger can be repeated (a repeat while the original compose is still running answers `409` naming the same id). Scripts must therefore check `outcome`, not just the 2xx status. The AdminUI Deployments page shows the same case as "could not be confirmed … may still be created", with the id. The admin singleton logs a Warning with the per-phase timings (`serializable-begin+scope-lock`, `snapshot-read`, `validate`, `compose`, `save+commit`) for any compose slower than 3 s. Set the secret via `Security:DeployApiKey` (env `Security__DeployApiKey`) on admin nodes only; treat it like any deploy credential (rotate, keep out of source).
|
||||
**Outcome unknown (lmxopcua#949).** The trigger waits 10 s for the admin singleton. A slow compose (one gate run took 10.5 s) can outlast that and still create and apply the deployment, so a timeout is **not** reported as a failure: the id is pre-allocated before the ask and the response is `202 Accepted` with `{ "outcome": "OutcomeUnknown", "deploymentId": "<id>", "message": "…" }` and `Location: /api/deployments/<id>`. Poll that resource: `200` means the deployment exists (and carries exactly that id); `404` for a couple of minutes means it was not created and the trigger can be repeated (a repeat while the original compose is still running answers `409` naming the same id). Scripts must therefore check `outcome`, not just the 2xx status. The AdminUI Deployments page shows the same case as "could not be confirmed … may still be created", with the id. The admin singleton logs a Warning with the per-phase timings (`dispatch`, `in-flight-check`, `snapshot-begin+compose-lock`, `snapshot-read`, `validate`, `compose`, `save+commit`), timed from the singleton's receipt of the request, for any deploy slower than 3 s. Since lmxopcua#955 the compose reads under SNAPSHOT isolation (serialised against other composes by an app lock), not SERIALIZABLE: a concurrent AdminUI edit neither waits for a running deploy nor holds it, and the two can no longer deadlock (under SERIALIZABLE a cross-table edit made the deploy wait ~5 s per deadlock-monitor cycle or fail with "StartDeployment failed on the server"). An edit that commits after the deploy's snapshot is simply in the next deployment. Set the secret via `Security:DeployApiKey` (env `Security__DeployApiKey`) on admin nodes only; treat it like any deploy credential (rotate, keep out of source).
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user