Skip to content

[Server] crash during subscription/session teardown in a multi-session telemetry scenario #3617

@cristipogacean

Description

@cristipogacean

Type of issue

  • Bug
  • Enhancement
  • Compliance
  • Question
  • Help wanted

Current Behavior

We are seeing a server-side crash in the OPC UA .NET Standard stack during subscription/session teardown in a multi-session telemetry scenario.

The first hard failure is:

System.NullReferenceException: Object reference not set to an instance of an object.
at Opc.Ua.Server.SubscriptionManager.PublishSubscriptionsAsync(Int32 sleepCycle, CancellationToken cancellationToken)

After that, the server starts returning repeated service faults and the client side begins reporting BadTooManyPublishRequests. In our end-to-end test this causes telemetry to stop flowing and the test eventually times out.

At the moment this looks like a stack issue in the server publish/subscription path rather than an application-level timeout.

Actual behavior

The publish task exits unexpectedly with NullReferenceException, then the server starts returning service faults and clients observe repeated BadTooManyPublishRequests. and seem to no longer recover until a restart.

Relevant log excerpts

<6>2026-03-12T05:44:34.689Z - Subscription ITEMS DELETED, Id=3193098814, ItemCount=0, ItemsToCheck=0, ItemsToPublish=0
<6>2026-03-12T05:44:34.691Z - Subscription DELETED, SessionId=ns=9;i=213501626, Id=3193098814, SeqNo=6, MessageCount=1
<6>2026-03-12T05:44:34.691Z - Subscription ITEMS DELETED, Id=3193098814, ItemCount=0, ItemsToCheck=0, ItemsToPublish=0
<6>2026-03-12T05:44:34.692Z - Subscription ITEMS DELETED, Id=3193098813, ItemCount=0, ItemsToCheck=0, ItemsToPublish=0
<6>2026-03-12T05:44:34.694Z - Subscription DELETED, SessionId=ns=9;i=213501626, Id=3193098813, SeqNo=6, MessageCount=1
<6>2026-03-12T05:44:34.694Z - Subscription ITEMS DELETED, Id=3193098813, ItemCount=0, ItemsToCheck=0, ItemsToPublish=0
<6>2026-03-12T05:44:34.705Z - Session CLOSED, Id=ns=9;i=213501626, Name=1234567890, ChannelId=f9da07b2-e2e0-4d62-aafb-a1043071c660-264, User=Anonymous
<6>2026-03-12T05:44:34.708Z - TCPSERVERCHANNEL ProcessCloseSecureChannelRequest success, ChannelId=264, TokenId=1, Socket=03F600C3
<6>2026-03-12T05:44:34.709Z - ChannelId 264: closed
<3>2026-03-12T05:44:34.705Z - Subscription - Publish Task (null) Exited Unexpectedly.
System.NullReferenceException: Object reference not set to an instance of an object.
   at Opc.Ua.Server.SubscriptionManager.PublishSubscriptionsAsync(Int32 sleepCycle, CancellationToken cancellationToken)

Expected Behavior

Deleting subscriptions / closing sessions should not crash the publish task.
The server should continue handling publish requests normally for remaining or newly created sessions.

Steps To Reproduce

No response

Environment

- Nuget Version: 1.5.378.106

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA bug was identified and should be fixed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions