fix(runtime): arm the apply-wedge watchdog after the Applying-row write; capture telemetry counter before MeterListener (Runtime.Tests master failures)
ACompletedApply_NeverReportsAWedge failed whenever it ran first in its process: the wedge timer was armed BEFORE the synchronous UpsertNodeDeploymentState(Applying), and the cold EF Core model build on that first write (~350 ms) outlasted the 200 ms delay, so the tick was enqueued ahead of the fetch's pipe-back and reported an immediately answered fetch as WEDGED. The watchdog now arms immediately before the read/fetch starts on both begin-paths, so it times what its Warning claims. New deterministic red/green test ASlowApplyingRowWrite_IsNotReportedAsAWedgedFetch (row writes slowed to 4x delay). OpcUaPublishActorWarmTests cluster-mode-mismatch test compared against OtOpcUaTelemetry.RedundancyModeMismatch inside InstrumentPublished; when the static initializer ran under the live listener the field still read null, so the counter was never enabled. Capture the counter into a local before creating the listener. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3095,7 +3095,8 @@ public sealed partial class DriverHostActor : ReceiveActor, IWithTimers, IWithUn
|
||||
/// <see cref="HandleArtifactForApply"/>, the continuation both modes share.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Both begin-paths arm the <see cref="ApplyWedgeTimerKey"/> watchdog, because both leave the
|
||||
/// Both begin-paths arm the <see cref="ApplyWedgeTimerKey"/> watchdog — after the synchronous
|
||||
/// Applying-row write, immediately before the read/fetch starts — because both leave the
|
||||
/// host alive and dequeuing while it waits for bytes it does not have yet — which is exactly
|
||||
/// what makes a silent wedge possible. (Before the Direct read moved off the mailbox this was
|
||||
/// the only such path: an inline read could not be "stuck in Applying" in any sense a watchdog
|
||||
@@ -3105,7 +3106,6 @@ public sealed partial class DriverHostActor : ReceiveActor, IWithTimers, IWithUn
|
||||
{
|
||||
_applyingDeploymentId = deploymentId;
|
||||
Become(Applying);
|
||||
Timers.StartSingleTimer(ApplyWedgeTimerKey, new ApplyWedged(deploymentId), _applyWedgeTimeout);
|
||||
|
||||
// Persist Applying row (idempotent on PK) — same crash-boundary marker as the Direct apply.
|
||||
UpsertNodeDeploymentState(deploymentId, NodeDeploymentStatus.Applying, failureReason: null);
|
||||
@@ -3126,6 +3126,12 @@ public sealed partial class DriverHostActor : ReceiveActor, IWithTimers, IWithUn
|
||||
_log.Debug("DriverHost {Node}: fetching artifact for {Id} (rev {Rev}) from central over gRPC",
|
||||
_localNode, deploymentId, revision);
|
||||
|
||||
// Armed only now, AFTER the synchronous Applying-row write above and immediately before the
|
||||
// read/fetch starts: the watchdog times the read/fetch (its Warning says so), and a slow row write
|
||||
// armed-before enqueued the tick ahead of the fetch's pipe-back, reporting a fetch that answered at
|
||||
// once as WEDGED (Runtime.Tests master failures: ACompletedApply_NeverReportsAWedge on a cold EF model).
|
||||
Timers.StartSingleTimer(ApplyWedgeTimerKey, new ApplyWedged(deploymentId), _applyWedgeTimeout);
|
||||
|
||||
// A faulted fetch task maps to null bytes — the apply-failure path, exactly like an
|
||||
// all-endpoints-down fetch — so a fault can never escape as an unhandled actor message.
|
||||
_artifactFetcher.FetchAsync(deploymentId.ToString(), revision.Value, CancellationToken.None)
|
||||
@@ -3164,7 +3170,6 @@ public sealed partial class DriverHostActor : ReceiveActor, IWithTimers, IWithUn
|
||||
{
|
||||
_applyingDeploymentId = deploymentId;
|
||||
Become(Applying);
|
||||
Timers.StartSingleTimer(ApplyWedgeTimerKey, new ApplyWedged(deploymentId), _applyWedgeTimeout);
|
||||
|
||||
// Persist Applying row (idempotent on PK) — the crash-boundary marker, and deliberately still
|
||||
// on the actor thread: one bounded row write, and the apply must be recorded as in flight
|
||||
@@ -3174,6 +3179,9 @@ public sealed partial class DriverHostActor : ReceiveActor, IWithTimers, IWithUn
|
||||
_log.Debug("DriverHost {Node}: reading artifact for {Id} (rev {Rev}) from the ConfigDb, off the mailbox",
|
||||
_localNode, deploymentId, revision);
|
||||
|
||||
// Armed after the Applying-row write, immediately before the read starts — see BeginFetchAndCacheApply.
|
||||
Timers.StartSingleTimer(ApplyWedgeTimerKey, new ApplyWedged(deploymentId), _applyWedgeTimeout);
|
||||
|
||||
Task.Run(() => LoadArtifactBlob(deploymentId))
|
||||
.PipeTo(
|
||||
Self,
|
||||
|
||||
Reference in New Issue
Block a user