diff --git a/tests/Server/ZB.MOM.WW.OtOpcUa.ScriptWorker.Tests/SupervisionTests.cs b/tests/Server/ZB.MOM.WW.OtOpcUa.ScriptWorker.Tests/SupervisionTests.cs
index 1fdceb1d3..9ef339c0e 100644
--- a/tests/Server/ZB.MOM.WW.OtOpcUa.ScriptWorker.Tests/SupervisionTests.cs
+++ b/tests/Server/ZB.MOM.WW.OtOpcUa.ScriptWorker.Tests/SupervisionTests.cs
@@ -546,11 +546,23 @@ public sealed class SupervisionTests
///
/// lmxopcua#789: callers resume on the connection's result dispatcher, never on the pipe reader — so a consumer
/// that blocks after its await (the Calculation pump publishes to OPC UA subscribers there) cannot stop the reader
- /// from taking heartbeats and get a healthy worker killed for silence. Here a 100 ms heartbeat (kill after 300 ms
- /// of silence) and a continuation that blocks for 1.5 s. Mutation check: resume callers inline on the reader (a
+ /// from taking heartbeats and get a healthy worker killed for silence. Here a 100 ms heartbeat (kill after 1.5 s
+ /// of silence) and a continuation that blocks for 3.5 s. Mutation check: resume callers inline on the reader (a
/// synchronous-continuation TaskCompletionSource completed by the reader, no dispatcher) and the worker is killed
/// (KilledHeartbeat).
///
+ ///
+ /// lmxopcua#1092: the limit used to be three 100 ms intervals (300 ms), and this pair of tests failed
+ /// intermittently on a loaded macOS dev box (about 1 full-suite run in 3–5), the worker killed for "sent nothing
+ /// for 344 ms" while the reader and the dispatcher worked correctly. Measured with send-stamped heartbeats: the
+ /// WORKER sent a beat 290–380 ms late (1–150 ms in transit), mid-run, not at startup — a cold worker beat every
+ /// 100 ± 8 ms from its first beat in 50 isolated runs at load 60–200, with and without 28 CPU burners, and no
+ /// run outside that real-load full suite (24 of 25.6 GB into swap at the time) stalled at all, whether the
+ /// heartbeat ran on the thread pool or on a dedicated thread. Those are whole-process stalls of the box, not
+ /// starvation a worker change can remove. So the limit is 1.5 s (production's is 3 s) and the block 3.5 s: a
+ /// reader held by the caller still goes silent 2 s past the limit, so the mutation is still killed, and the
+ /// resumedOn assertion pins the thread outright.
+ ///
[Fact]
public async Task A_caller_that_blocks_after_its_result_does_not_starve_the_reader()
{
@@ -558,6 +570,7 @@ public sealed class SupervisionTests
var heartbeat = TimeSpan.FromMilliseconds(100);
await using var runner = TightHeartbeatRunner(heartbeat, TimeSpan.FromSeconds(60), sink);
var worker = WarmTight(runner, await runner.RunAsync(Scripts.Vt("warm", Healthy), Ct), heartbeat, sink);
+ worker.SilenceLimit = TimeSpan.FromMilliseconds(1_500); // see remarks (#1092)
string? resumedOn = null;
await runner.RunAsync(Scripts.Vt("warm", Healthy), Ct).ContinueWith(t =>
@@ -565,7 +578,7 @@ public sealed class SupervisionTests
// Runs wherever RunAsync's own continuation completed it: the thread that resumed the caller.
resumedOn = Thread.CurrentThread.Name;
t.Result.Value.ShouldBe(7);
- Thread.Sleep(1_500);
+ Thread.Sleep(3_500);
}, CancellationToken.None, TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default);
// Behaviour first: the worker was not killed for silence while the caller blocked.
diff --git a/tests/Server/ZB.MOM.WW.OtOpcUa.ScriptWorker.Tests/WorkerSoftClockTests.cs b/tests/Server/ZB.MOM.WW.OtOpcUa.ScriptWorker.Tests/WorkerSoftClockTests.cs
index 926ecbe33..2a7fa4dd8 100644
--- a/tests/Server/ZB.MOM.WW.OtOpcUa.ScriptWorker.Tests/WorkerSoftClockTests.cs
+++ b/tests/Server/ZB.MOM.WW.OtOpcUa.ScriptWorker.Tests/WorkerSoftClockTests.cs
@@ -271,9 +271,22 @@ public sealed class WorkerSoftClockTests
///
/// Review F1: the soft notice is handled on the pipe READER, and the caller's resumption is the caller's code. It
/// must go through the result dispatcher like a result does: a continuation that blocks for 1.5 s must not hold up
- /// the reader, or the next heartbeats sit unread and a healthy worker is killed for silence (300 ms here). Before
- /// the fix the continuation ran inline on the reader and the worker was killed (KilledHeartbeat).
+ /// the reader, or the next heartbeats sit unread and a healthy worker is killed for silence (1.5 s here, with a
+ /// 3.5 s block). Before the fix the continuation ran inline on the reader and the worker was killed (KilledHeartbeat).
///
+ ///
+ /// Same limit as SupervisionTests.A_caller_that_blocks_after_its_result_does_not_starve_the_reader:
+ /// lmxopcua#1092: the limit used to be three 100 ms intervals (300 ms), and this pair of tests failed
+ /// intermittently on a loaded macOS dev box (about 1 full-suite run in 3–5), the worker killed for "sent nothing
+ /// for 344 ms" while the reader and the dispatcher worked correctly. Measured with send-stamped heartbeats: the
+ /// WORKER sent a beat 290–380 ms late (1–150 ms in transit), mid-run, not at startup — a cold worker beat every
+ /// 100 ± 8 ms from its first beat in 50 isolated runs at load 60–200, with and without 28 CPU burners, and no
+ /// run outside that real-load full suite (24 of 25.6 GB into swap at the time) stalled at all, whether the
+ /// heartbeat ran on the thread pool or on a dedicated thread. Those are whole-process stalls of the box, not
+ /// starvation a worker change can remove. So the limit is 1.5 s (production's is 3 s) and the block 3.5 s: a
+ /// reader held by the caller still goes silent 2 s past the limit, so the mutation is still killed, and the
+ /// resumedOn assertion pins the thread outright.
+ ///
[Fact]
public async Task A_slow_continuation_of_a_soft_timeout_does_not_stall_the_reader()
{
@@ -286,7 +299,7 @@ public sealed class WorkerSoftClockTests
var entry = await connection.EnsureLoadedAsync("k", ContextKind.VirtualTag, Runaway,
SHA256.HashData(Encoding.UTF8.GetBytes(Runaway)), []).WaitAsync(TimeSpan.FromSeconds(60), Ct);
entry.Outcome.ShouldNotBeNull().Ok.ShouldBeTrue();
- connection.SilenceLimit = heartbeat * 3; // armed only once the cold start is over (see SupervisionTests)
+ connection.SilenceLimit = TimeSpan.FromMilliseconds(1_500); // armed once the cold start is over; see remarks (#1092)
var softT = TimeSpan.FromMilliseconds(200);
var pending = connection.Submit("k",
@@ -297,7 +310,7 @@ public sealed class WorkerSoftClockTests
{
resumedOn = Thread.CurrentThread.Name;
t.Result.ShouldBeSameAs(PendingEval.SoftTimedOut);
- Thread.Sleep(1_500);
+ Thread.Sleep(3_500);
}, CancellationToken.None, TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default);
await slowConsumer.WaitAsync(TimeSpan.FromSeconds(10), Ct);