fix(deploy): #1111 review — cover the held-ack retry guard; clamp deadline_remaining_ms off the wire
- The _pendingAcks.Count == 0 guard (a stale re-send of an older FAILED deployment must not re-apply it while a NEWER apply's Applied ack is held on its address-space outcome) had no test: mutating it to true left every Runtime test green. New test fails under that mutation (the older revision is re-fetched and applied over the newer one, whose held Applied ack then goes out for a rolled-back node). - MeshTransportDtoMapper.FromProto clamps deadline_remaining_ms to [0, 1 day]: a long.MaxValue wire value threw from TimeSpan.FromMilliseconds; a hugely negative one could overflow the node's TimeSpan subtraction in HandleDispatchFromSteady (actor restart = remembered acks lost). - Doc fix: _lastAnsweredDeploymentId is moved by RememberAck only, not by a replay.
This commit is contained in:
@@ -80,10 +80,17 @@ public static class MeshTransportDtoMapper
|
||||
CorrelationId.Parse(proto.CorrelationId),
|
||||
// #1107: an empty repeated field is the original dispatch (null), never "addressed to nobody".
|
||||
proto.TargetNodes.Count > 0 ? proto.TargetNodes.ToList() : null,
|
||||
// #1111: absent (an original dispatch, or a pre-#1111 central) = null = the node's full default wait.
|
||||
proto.HasDeadlineRemainingMs ? TimeSpan.FromMilliseconds(proto.DeadlineRemainingMs) : null);
|
||||
// #1111: absent (an original dispatch, or a pre-#1111 central) = null = the node's full default wait. Clamped:
|
||||
// the bound only ever SHORTENS the node's wait, and an out-of-range wire value must not throw here (a
|
||||
// TimeSpan overflow) or overflow the node's tick arithmetic — negative is "spent", a day is "unbounded".
|
||||
proto.HasDeadlineRemainingMs
|
||||
? TimeSpan.FromMilliseconds(Math.Clamp(proto.DeadlineRemainingMs, 0L, MaxDeadlineRemainingMs))
|
||||
: null);
|
||||
}
|
||||
|
||||
/// <summary>#1111: the largest <c>deadline_remaining_ms</c> taken off the wire (one day — far past any apply deadline).</summary>
|
||||
private const long MaxDeadlineRemainingMs = 24L * 60 * 60 * 1000;
|
||||
|
||||
// ---------------------------------------------------------------- RestartDriver
|
||||
|
||||
/// <summary>Projects <paramref name="message"/> onto its wire form.</summary>
|
||||
|
||||
@@ -372,8 +372,8 @@ public sealed partial class DriverHostActor : ReceiveActor, IWithTimers, IWithUn
|
||||
private readonly Queue<DeploymentId> _recentAckOrder = new();
|
||||
|
||||
/// <summary>
|
||||
/// #1111: the deployment this node sent its most recent ack for (any outcome, including a re-delivery's
|
||||
/// re-ack of the same deployment). A re-send of a deployment whose remembered ack is <c>Failed</c> is
|
||||
/// #1111: the deployment this node most recently PRODUCED an ack for (any outcome; set by
|
||||
/// <see cref="RememberAck"/> — a replay of a remembered ack does not move it). A re-send of a deployment whose remembered ack is <c>Failed</c> is
|
||||
/// re-attempted only while that deployment is still this node's latest answer — retrying an OLDER failed
|
||||
/// deployment after a newer one was applied would roll the node back.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user