fix(abcip): #983 review — probe timeout bounds only the probe read, not the cold initialisation

P-22 moved the probe's own short timeout (default 2 s) onto the probe runtime's cold
InitializeAsync too — on the native transport the TCP connect + RegisterSession + Forward
Open, which the pooled connection bounds with the driver's Timeout. A slow-but-healthy open
longer than the probe timeout never completed: the probe re-created and timed out every
tick and the host stayed Stopped. Initialisation now runs under the loop token only; the
probe timeout bounds the read.
This commit is contained in:
Joseph Doherty
2026-12-03 12:03:49 -05:00
parent 84a0226bfa
commit 5dcb766fd1
3 changed files with 59 additions and 10 deletions
@@ -745,17 +745,20 @@ public sealed class AbCipDriver : IDriver, IReadable, IWritable, ITagDiscovery,
try
{
probeRuntime ??= _tagFactory.Create(probeParams);
// The probe's own timeout bounds this tick's wait (cancelling a waiter never faults the shared
// Lazy-init on first attempt; re-init after a transport failure has caused the
// native handle to be destroyed. #983 review: NOT under the probe timeout — a cold initialisation is
// the connect + RegisterSession + Forward Open, bounded by the DRIVER's timeout (the pooled
// connection's); the short probe timeout here meant a slow-but-healthy open never completed and the
// host stayed Stopped, re-dialling every tick.
if (!state.ProbeInitialized)
{
await probeRuntime.InitializeAsync(ct).ConfigureAwait(false);
state.ProbeInitialized = true;
}
// The probe's own timeout bounds only the probe READ (cancelling a waiter never faults the shared
// session — scheduler B2); the pooled connection keeps the driver's timeout.
using var tick = CancellationTokenSource.CreateLinkedTokenSource(ct);
tick.CancelAfter(_options.Probe.Timeout);
// Lazy-init on first attempt; re-init after a transport failure has caused the
// native handle to be destroyed.
if (!state.ProbeInitialized)
{
await probeRuntime.InitializeAsync(tick.Token).ConfigureAwait(false);
state.ProbeInitialized = true;
}
await probeRuntime.ReadAsync(tick.Token).ConfigureAwait(false);
var status = probeRuntime.GetStatus();
if (status == 0)