diff --git a/src/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer/ProjectedEventDelivery.cs b/src/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer/ProjectedEventDelivery.cs
index 17cacc98a..b20cc7981 100644
--- a/src/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer/ProjectedEventDelivery.cs
+++ b/src/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer/ProjectedEventDelivery.cs
@@ -461,11 +461,30 @@ internal sealed record ProjectedEventMarker(object? Identity, NodeId ConditionId
/// ProjectedNotificationRewriter sees this instance on every Publish and Republish and drops it when the re-check
/// fails.
///
+///
+/// A3 review round 2 (root cause of the OI refresh failures): SDK 2.0.1 POOLS process-wide
+/// (EventFieldListActivator : PooledEncodeableType). SentMessageQueue calls Reuse() on every list of an
+/// acknowledged/evicted message, and the base ReuseCore returns the instance — whatever its runtime type — to the
+/// shared stock pool, from which ANY server's MonitoredItem.GetEventFields rents its next list. A recycled
+/// instance of this subclass therefore became some unrelated session's RefreshStart/RefreshEnd or local condition event,
+/// still carrying THIS marker: the rewriter judged it by another condition's (possibly revoked) gate and dropped it.
+/// Like ProjectedSdkNotification on the data path, this subclass stays out of the stock pool.
+///
internal sealed class ProjectedEventFieldList(ProjectedEventMarker marker) : EventFieldList
{
internal static long s_unservable, s_droppedOnPublish, s_droppedUnmarked, s_keptUnmarked;
- public ProjectedEventMarker Marker { get; } = marker;
+ /// The captured authority; null once the SDK has released the list (it is never published again).
+ public ProjectedEventMarker? Marker { get; private set; } = marker;
+
+ ///
+ protected override void ReuseCore()
+ {
+ // ACK, eviction and message disposal reach this through IPooledEncodeable.Reuse: reset, drop the marker (and with it
+ // the closure over the condition and identity), and let the GC have it — never the shared EventFieldList pool.
+ Marker = null;
+ ResetForReuse();
+ }
/// Imported events an item could not receive through the marked path (fail closed).
internal static long Unservable => Interlocked.Read(ref s_unservable);
diff --git a/src/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer/WarmStandby.cs b/src/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer/WarmStandby.cs
index 68786bb82..c0fc1f500 100644
--- a/src/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer/WarmStandby.cs
+++ b/src/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer/WarmStandby.cs
@@ -938,7 +938,7 @@ internal static class ProjectedNotificationRewriter
{
if (list is ProjectedEventFieldList marked)
{
- if (marked.Marker.Permits()) kept.Add(list);
+ if (marked.Marker?.Permits() == true) kept.Add(list); // a released list (no marker) fails closed
else Interlocked.Increment(ref ProjectedEventFieldList.s_droppedOnPublish);
continue;
}
diff --git a/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests/DataConnections/ImportedConditionClassifierTests.cs b/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests/DataConnections/ImportedConditionClassifierTests.cs
index 5799e02f8..31265cb63 100644
--- a/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests/DataConnections/ImportedConditionClassifierTests.cs
+++ b/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests/DataConnections/ImportedConditionClassifierTests.cs
@@ -116,6 +116,39 @@ public sealed class ImportedConditionClassifierTests : IAsyncDisposable
ReferenceEquals(ProjectedNotificationRewriter.Project(plain, republish: false, null), plain).ShouldBeTrue();
}
+ ///
+ /// A3 review round 2 (root cause of the intermittent OI ConditionRefresh failures): SDK 2.0.1 pools EventFieldList
+ /// process-wide, and SentMessageQueue calls Reuse() on every list of an acknowledged message. A marked
+ /// list that went back to the stock pool was rented by an unrelated server/session's GetEventFields (its
+ /// RefreshStart/RefreshEnd), carrying a revoked marker, and the rewriter dropped it. A released marked list must never
+ /// be rentable, and must not keep its marker (closure over condition + identity) alive.
+ ///
+ [Fact]
+ public void A_released_marked_event_list_never_returns_to_the_SDK_pool_so_no_other_session_rents_its_marker()
+ {
+ var marked = new ProjectedEventFieldList(new ProjectedEventMarker(null, new NodeId("c", 9), 1, () => false)) { ClientHandle = 77 };
+ ((IPooledEncodeable)marked).Reuse(); // exactly what SentMessageQueue.ReuseNotificationPayloads does on ACK / eviction
+ marked.Marker.ShouldBeNull("a released list holds no authority (and keeps no closure alive)");
+
+ // Drain more than the pool can hold: had the marked instance been returned, it would come out here.
+ var rented = new List();
+ try
+ {
+ for (var i = 0; i < PooledEncodeableType.DefaultMaximumRetained + 64; i++)
+ rented.Add((EventFieldList)EventFieldListActivator.Instance.CreateInstance());
+ rented.ShouldNotContain(l => l is ProjectedEventFieldList, "a stock list rented for any event is never a marked one");
+ }
+ finally
+ {
+ foreach (var l in rented) ((IPooledEncodeable)l).Reuse();
+ }
+
+ // A released marked list that somehow reached the rewriter fails closed (never judged by a stale marker).
+ var message = new NotificationMessage { SequenceNumber = 10,
+ NotificationData = [new ExtensionObject(new EventNotificationList { Events = [marked] })] };
+ ProjectedNotificationRewriter.Project(message, republish: false, null).NotificationData.Count.ShouldBe(0);
+ }
+
[Fact]
public void S2_a_cached_positive_verdict_is_re_proved_past_the_credential_expiry_and_past_the_positive_TTL()
{