diff --git a/seaweed-block/deploy/systemd/sw-blockvolume-ublk.service b/seaweed-block/deploy/systemd/sw-blockvolume-ublk.service index ee1904fa86..6819f4d9d6 100644 --- a/seaweed-block/deploy/systemd/sw-blockvolume-ublk.service +++ b/seaweed-block/deploy/systemd/sw-blockvolume-ublk.service @@ -9,6 +9,8 @@ # # Load the module at boot: echo ublk_drv | sudo tee /etc/modules-load.d/ublk.conf [Unit] +StartLimitIntervalSec=600 +StartLimitBurst=10 Description=Seaweed Block volume over ublk (one replica, root) Documentation=https://github.com/seaweedfs/seaweed-block After=network-online.target sw-blockmaster.service diff --git a/seaweed-block/deploy/systemd/sw-blockvolume.service b/seaweed-block/deploy/systemd/sw-blockvolume.service index 7ad8a3ed5e..30a69d729c 100644 --- a/seaweed-block/deploy/systemd/sw-blockvolume.service +++ b/seaweed-block/deploy/systemd/sw-blockvolume.service @@ -7,6 +7,8 @@ # For ublk (needs root) do not edit this unit: use # sw-blockvolume-ublk.service, which has its own state directory. [Unit] +StartLimitIntervalSec=600 +StartLimitBurst=10 Description=Seaweed Block volume (one replica) Documentation=https://github.com/seaweedfs/seaweed-block After=network-online.target sw-blockmaster.service diff --git a/seaweed-block/docs/design/invariants.md b/seaweed-block/docs/design/invariants.md index a40b33ba70..8ee4057e95 100644 --- a/seaweed-block/docs/design/invariants.md +++ b/seaweed-block/docs/design/invariants.md @@ -1011,6 +1011,7 @@ Format v3 row 4 runs in production recovery (`WALStore.recoverV3`). Its typed sc |---|---|---|---|---| | Workspace revocation ACK closeout | M2 Revoking → Revoked; `INV-WS-STARTUP-RETRY-001` | Existing `workspaceLeaseCloseoutTimeout` (3 s), after the resource owner replies to the guard | `finishWorkspaceLease` owns the wait. ACK success selects normal exit; error/expiry selects 75 with `revoke_ack_unconfirmed`. The 5 s supervisor cleanup clock starts only after a nonzero outcome is selected. | No provider/storage lock held. | | Workspace primary retry cleanup | M2 restart; `INV-WS-STARTUP-RETRY-001` | Existing `WorkspaceDrainTimeout` (5 s) after retry/no-retry outcome selection | Process supervisor owns the deadline and returns 75 or 78 even if resource-owner cleanup blocks; first outcome stays latched. Signal and ACKed revocation retain normal exit. | Provider latches by recovery generation under p.mu; wake is nonblocking; the supervisor holds no provider/storage lock. | +| Workspace primary supervisor retries | M2 restart; `INV-WS-STARTUP-RETRY-001` | Shipped systemd units: `StartLimitIntervalSec=600`, `StartLimitBurst=10`, `RestartSec=5s` | systemd owns the restart window: after 10 starts in 600 s, another start within the window is refused and the unit fails; operator reset/start follows remediation. Exit 78 and ACKed exit 0 do not restart. | No application lock; `TestBlockvolumeUnitsBoundStartupRetries` (`internal/testops/blockvolume_systemd_test.go`) checks both shipped units. | | Offline seal | M5 PlainStop -> Quiesce; `INV-CUT-PLAIN-DETACH-001` | Caller context; positive HTTP timeoutMs. Completed uploads resume only within one blockvolume process and matching owner/HEAD/chunk versions; after restart the seal must fit seal_timeout_ms. | Provider owns drain, detached cut and settlement. Cancellation preserves unknown/fenced outcome safety; a closed frontend stays closed. | No admission lock held during store or remote I/O. | | Plain seal remote proof | M5 RemoteProof; `INV-WS-SEAL-REPLAY-001` | Earlier caller context or existing 2 s HEAD-operation bound for the filer read; attachment serialization retains its owner's cooperative caller bound | Provider registers with Close; closeBoundRemote cancels the read, and Close joins it. Failure keeps frontend admission closed. | Attachment mutex serializes against recover/detach; no backend/store/map lock spans the filer read. | | Frontend pre-copy admission | M5 tentative admission -> resume; `INV-CUT-PRECOPY-001` (not reachable in this release) | Earlier of caller deadline and this command arrival + 5 s; one bound across retries, no inherited pause clock | Owner `finishPrecopyLocked`: resume or terminal Close clears the pause and grants all waiters in FIFO arrival order under one `b.mu` hold; each rechecks the ordinary gate. Expiry removes only its waiter and refuses with typed `ErrBackendBusy` + deadline cause (guest-visible: yes). Only a typed pause refusal requeues a granted waiter under the original command deadline; already-observed stale-primary and other gate errors are returned unchanged. Grant versus queue expiry is decided under the same lock; timely grants survive later queue-timer expiry but never caller expiry or a terminal gate. No dependency on another command's completion. | No `ioMu`, store lock, or remote call while queued. Admitted I/O retains normal per-LBA serialization and lifecycle accounting. | diff --git a/seaweed-block/docs/standalone-deployment.md b/seaweed-block/docs/standalone-deployment.md index 041aada217..10dd3ef822 100644 --- a/seaweed-block/docs/standalone-deployment.md +++ b/seaweed-block/docs/standalone-deployment.md @@ -79,6 +79,16 @@ The binaries take command-line flags. The `SWB_*` variables are read only by the example units, which turn them into flags. blockvolume itself reads only `SW_BLOCK_ISCSI_CHAP_USERNAME` and `SW_BLOCK_ISCSI_CHAP_SECRET`. +Both blockvolume units restart failed processes after 5 seconds, except exit 78 +(superseded). Exit 75 retries through the ordinary lease and HEAD-claim gates. +`StartLimitIntervalSec=600` and `StartLimitBurst=10` in `[Unit]` allow at most +10 starts in a 10-minute window; another start in that window is refused and +the unit enters `failed` (`start-limit-hit`). This bounds retries on a host +that no longer holds the volume. After correcting the assignment or disabling +the obsolete unit, an operator can use `systemctl reset-failed ` and +`systemctl start ` to resume attempts. An ACKed planned stop exits 0 +and is not automatically restarted. + ## Required setup: make the volume known to blockmaster blockmaster gives a blockvolume an assignment only for a volume and replica