Merge #980: unexpected cluster exit exits non-zero for SCM, audit buffer survives DB outage, HTTPS listener misconfig fails boot
This commit is contained in:
@@ -307,6 +307,8 @@ h2c mesh settings do not opt this listener into cleartext.
|
||||
|
||||
**The listener is dedicated h2c and coexists with the LocalDb-sync listener.** A fused admin+driver node with **both** `ConfigServe:GrpcListenPort` and `LocalDb:SyncListenPort` set re-binds its existing HTTP surface exactly once and adds both dedicated HTTP/2-only ports on top — see the same Kestrel-takeover caveat under [`LocalDb`](#localdb-pair-local-config-cache--driver-role-only).
|
||||
|
||||
**An HTTPS binding refuses host start (#980 / review 05 H-5).** The takeover cannot replay an HTTPS endpoint's certificate configuration (TLS is terminated upstream), so a node with any HTTPS URL/`HTTPS_PORTS` binding **and** any non-zero `LocalDb:SyncListenPort` / `ConfigServe:GrpcListenPort` / `Telemetry:GrpcListenPort` / `DataConnections:ListenPort` now fails to start with a message naming every requested port (`DedicatedListenerGuard`). It previously logged one Error, zeroed the ports and booted ready with no deploy/config/telemetry endpoints. Serve the UI/health surface over HTTP, or set the port(s) to 0.
|
||||
|
||||
**`RevisionHash == SHA-256(artifact bytes)` is load-bearing.** `ConfigComposer` computes the deployment's revision hash as the lowercase-hex SHA-256 of the exact artifact bytes, so the node verifies a fetch against the `RevisionHash` the dispatch already carries — no hash rides in the proto. If a future change makes the revision hash anything else, every fetch fails verification.
|
||||
|
||||
**`DeploymentArtifactService` is `AllowAnonymous` by design** — same reasoning as `NodeCommandService`/`CentralCommandService` above: the AdminUI cookie `FallbackPolicy` on an admin-role node would otherwise block a correctly-keyed fetch before `ConfigServeAuthInterceptor`'s verdict matters. See [`security.md` § Mesh gRPC ingress is `AllowAnonymous` by design](security.md#mesh-grpc-ingress-is-allowanonymous-by-design).
|
||||
@@ -431,6 +433,8 @@ per cluster at `/clusters/{id}/audit`. It has no `appsettings` section — it is
|
||||
has a `ConfigDb` — but one schema property is worth recording here because it constrains how callers may
|
||||
write to it:
|
||||
|
||||
*Flush behaviour (#980 / review 05 H-2):* `AuditWriterActor` batches events and flushes every 5 s (or at 500). A flush that fails because the database did not answer **keeps** the batch and retries on the next tick; the buffer is bounded at 10 000 events (drop-oldest, with `OverflowDroppedCount` and a Warning). Rows the database rejects outright (e.g. a duplicate `EventId`) are still dropped individually. Events are lost only if the actor stops while the database is still down (logged at Error with the count).
|
||||
|
||||
- **`EventId` gives cross-restart deduplication, and the DB enforces it.** Each row carries the
|
||||
stable per-event `AuditEvent.EventId`, under a *filtered* unique index
|
||||
(`UX_ConfigAuditLog_EventId`, `WHERE [EventId] IS NOT NULL` — so the nullable pre-v2 backfill rows
|
||||
|
||||
+10
-4
@@ -472,9 +472,15 @@ two-node pair that choice means *any* crash of the oldest node is a full outage.
|
||||
`sc.exe failure OtOpcUaHost … actions= restart/5000/restart/30000/restart/60000`; the docker-dev rig sets
|
||||
`restart: unless-stopped`.
|
||||
2. **The recovery watchdog** `ActorSystemTerminationWatchdog` (registered in `Program.cs` after `AddAkka`) —
|
||||
it watches `ActorSystem.WhenTerminated` and, on an unexpected self-down, calls
|
||||
`IHostApplicationLifetime.StopApplication()` so the process exits and the supervisor restarts it instead
|
||||
of idling forever with a dead actor system. Under `auto-down` the *survivor* no longer needs this
|
||||
it watches `ActorSystem.WhenTerminated` and, on a termination outside host shutdown (auto-down, manual
|
||||
failover `Leave`, endpoint step-down), flushes Serilog and **exits the process with code 1**
|
||||
(`Environment.Exit`, on a dedicated thread) so the supervisor restarts it instead of idling forever with
|
||||
a dead actor system. It deliberately does **not** call `StopApplication()` (#980 / review 05 H-1): under
|
||||
`UseWindowsService` that is a *clean* service stop (`SERVICE_STOPPED`, exit 0), which `sc.exe failure`
|
||||
recovery does not act on, so a node that left the cluster stayed stopped on Windows (docker's
|
||||
`restart: unless-stopped` masked it). A graceful host stop (SCM stop, Ctrl-C) is still silent. The
|
||||
real-SCM check (leave a node on a Windows pair, assert the service returns to `Running` within the first
|
||||
recovery delay) is a live gate on `windev`. Under `auto-down` the *survivor* no longer needs this
|
||||
(it is never the one downed); the **downed** node still does.
|
||||
3. **Both peers listed in `SeedNodes`** on every node, **each node listing itself first**, so a restarted
|
||||
node can re-join via either peer and a node cold-starting while its peer is dead still forms the
|
||||
@@ -508,7 +514,7 @@ The mechanism is a graceful cluster **`Leave`** of the current Primary, never a
|
||||
query to `RedundancyStateActor.SelectDriverPrimary`, pinned together by
|
||||
`ManualFailoverServiceTests.Parity_with_SelectDriverPrimary` so the node acted on is exactly the node the
|
||||
election names. The leaving node hands its singletons over through the cluster-leave phases,
|
||||
`CoordinatedShutdown` runs, `ActorSystemTerminationWatchdog` exits the process, the supervisor restarts it,
|
||||
`CoordinatedShutdown` runs, `ActorSystemTerminationWatchdog` exits the process (non-zero), the supervisor restarts it,
|
||||
and it rejoins as the **youngest** member — so the survivor is now the oldest, becomes Primary, and
|
||||
advertises `ServiceLevel` 250. OPC UA clients re-select.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user