diff --git a/docs/drivers/AbCip.md b/docs/drivers/AbCip.md
index fadd7afe4..bd93b3ab8 100644
--- a/docs/drivers/AbCip.md
+++ b/docs/drivers/AbCip.md
@@ -191,7 +191,7 @@ The driver has two interchangeable wire transports, selected by one `DriverConfi
a held connection idling out, so this shape follows a controller restart / re-download or a network gap.
- `ConnectionSize` / `Timeout` / `AllowPacking` are honoured per pooled connection, and the **first**
driver/device to open a given device key wins — including a Test Connect probe on a fused `admin,driver`
- node (a Test Connect probe carries its own probe timeout). The driver's own probe loop leases with the DRIVER's `Timeout` and bounds only its wait with the probe timeout (#983 P-22: it used to lease with the probe's, so a short probe timeout became every data read's). A later opener with different options is ignored and
+ node (a Test Connect probe carries its own probe timeout). The driver's own probe loop leases with the DRIVER's `Timeout` and bounds only its probe READ with the probe timeout (#983 P-22: it used to lease with the probe's, so a short probe timeout became every data read's; #983 review: the cold probe initialisation — connect + RegisterSession + Forward Open — is bounded by the driver's `Timeout`, not the probe's, or a slow-but-healthy open never completed and the host stayed `Stopped`). A later opener with different options is ignored and
logged once as a Warning (`DeviceSessionPool`). ⚠️ The device key compares the **host string**, so the
same controller addressed by DNS name in one driver and by IP in another gets two connections and two
Forward Open throttles (up to two opens per second); address a controller the same way everywhere. ControlLogix, GuardLogix and (since T21) CompactLogix default to 4002, a Large
diff --git a/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip/AbCipDriver.cs b/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip/AbCipDriver.cs
index 12148c4eb..8d183ea7a 100644
--- a/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip/AbCipDriver.cs
+++ b/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip/AbCipDriver.cs
@@ -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)
diff --git a/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip.Tests/AbCip983ReviewTests.cs b/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip.Tests/AbCip983ReviewTests.cs
index 69fa59bac..fcedeae0b 100644
--- a/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip.Tests/AbCip983ReviewTests.cs
+++ b/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip.Tests/AbCip983ReviewTests.cs
@@ -1,3 +1,4 @@
+using System.Collections.Concurrent;
using Shouldly;
using Xunit;
using ZB.MOM.WW.OtOpcUa.Core.Abstractions;
@@ -7,7 +8,8 @@ using ZB.MOM.WW.OtOpcUa.Driver.AbCip;
namespace ZB.MOM.WW.OtOpcUa.Driver.AbCip.Tests;
///
-/// #983 review round: the P-2 per-call device fault latch fired on ANY timeout and evicted handles it never tried.
+/// #983 review round: the P-2 per-call device fault latch fired on ANY timeout and evicted handles it never tried,
+/// and P-22 put the probe's short timeout on the cold initialisation (connect + Forward Open).
///
[Trait("Category", "Unit")]
public sealed class AbCip983ReviewTests
@@ -117,4 +119,48 @@ public sealed class AbCip983ReviewTests
creates.ShouldBeLessThanOrEqualTo(11);
await drv.DisposeAsync();
}
+
+ ///
+ /// P-22 put the probe's own (short, default 2 s) timeout on the probe runtime's COLD initialisation too — on the
+ /// native transport that is the TCP connect + RegisterSession + Forward Open, bounded by the driver's Timeout. A
+ /// slow-but-healthy open longer than the probe timeout then never completed: the probe re-created and timed out
+ /// every tick, holding the host Stopped. Only the probe READ is bounded by the probe timeout.
+ ///
+ [Fact]
+ public async Task A_cold_probe_initialisation_slower_than_the_probe_timeout_still_completes()
+ {
+ var factory = new FakeAbCipTagFactory { Customise = p => new SlowInitTag(p) };
+ var transitions = new ConcurrentQueue();
+ var drv = new AbCipDriver(new AbCipDriverOptions
+ {
+ Devices = [new AbCipDeviceOptions(Dev)],
+ Probe = new AbCipProbeOptions
+ {
+ Enabled = true,
+ Interval = TimeSpan.FromMilliseconds(100),
+ Timeout = TimeSpan.FromMilliseconds(100),
+ ProbeTagPath = "@raw_cpu_type",
+ },
+ Timeout = TimeSpan.FromSeconds(5),
+ }, "abcip-983-probe", factory);
+ drv.OnHostStatusChanged += (_, e) => transitions.Enqueue(e);
+
+ await drv.InitializeAsync("{}", CancellationToken.None);
+ var deadline = DateTime.UtcNow + TimeSpan.FromSeconds(5);
+ while (drv.GetHostStatuses().Single().State != HostState.Running && DateTime.UtcNow < deadline)
+ await Task.Delay(20, TestContext.Current.CancellationToken);
+
+ drv.GetHostStatuses().Single().State.ShouldBe(HostState.Running);
+ await drv.ShutdownAsync(CancellationToken.None);
+ }
+
+ /// An initialisation that takes 400 ms (a slow Forward Open) and then works.
+ private sealed class SlowInitTag(AbCipTagCreateParams p) : FakeAbCipTag(p)
+ {
+ public override async Task InitializeAsync(CancellationToken cancellationToken)
+ {
+ await Task.Delay(400, cancellationToken);
+ await base.InitializeAsync(cancellationToken);
+ }
+ }
}