Skip to content

NullReferenceException in Opc.Ua.Server.MasterNodeManager.ValidateRolePermissions() #3046

Description

@GhislainPr

Type of issue

  • Bug
  • Enhancement
  • Compliance
  • Question
  • Help wanted

Current Behavior

NullReferenceException in Opc.Ua.Server.MasterNodeManager.ValidateRolePermissions() method if Opc.Ua.NodeState.ClearChangeMasks() is called while Opc.Ua.Server.CustomNodeManager2.CreateMonitoredItems() is processing.
In this case, the Session property of MonitoredItem is null.

Expected Behavior

No exception attempted while changing nodes during monitoreditem creation.

Steps To Reproduce

It's difficult to reproduce because it's depend on thread synchronization.

Environment

- OS: Windows 11
- Environment: Visual Studio 2022
- Runtime: .NET 4.6.2,
- Nuget Version: 1.05.375.457
- Component: Opc.Ua.Server
- Server: Reference Server
- Client: UA Expert

Anything else?

Suggested solution in Libraries/Opc.Ua.Server/Diagnostics/MonitoredNode.cs :
295 : if (monitoredItem.Session != null && monitoredItem.AttributeId == Attributes.Value && (changes & NodeStateChangeMasks.Value) != 0)

instead of :
295 : if (monitoredItem.AttributeId == Attributes.Value && (changes & NodeStateChangeMasks.Value) != 0)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugA bug was identified and should be fixed.

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions