Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null Reference Exception in UaSCUaBinaryChannel.WriteSymmetricMessage after Client disconnect #3028

Open
1 of 5 tasks
romanett opened this issue Mar 5, 2025 · 3 comments
Open
1 of 5 tasks
Labels
bug A bug was identified and should be fixed.

Comments

@romanett
Copy link
Contributor

romanett commented Mar 5, 2025

Type of issue

  • Bug
  • Enhancement
  • Compliance
  • Question
  • Help wanted

Current Behavior

The UaSCUaBinaryChannel.WriteSymmetricMessage throws an exception here:

encoder.WriteUInt32(null, token.TokenId);

as the token is null.

This occurs when the Client is shut down.

Expected Behavior

No Exception is thrown.

Maybe 0? should be written if no token is present?

Steps To Reproduce

  1. Start Reference Server
  2. Start Reference Client
  3. Stop Reference Client while communication is in progress
  4. Exception is thrown
    encoder.WriteUInt32(null, token.TokenId);

Also occurs on the sheduled client disconnect

Environment

- OS: Windows 11
- Environment: Visual Studio 2022
- Runtime: Net 9
- Nuget Version: Current Master
- Component: Server
- Server: Current Master Reference Server
- Client: Current Master Reference Client

Anything else?

MesageBody: {Opc.Ua.ServiceFault}
MessageType: 4674381
isRequest: false

@romanett
Copy link
Contributor Author

romanett commented Mar 5, 2025

Could be related to Token Dispose PR

@romanett romanett added the bug A bug was identified and should be fixed. label Mar 6, 2025
@romanett
Copy link
Contributor Author

romanett commented Mar 12, 2025

This TCP message type is none of the known OPC UA Message Types.

The Server wants to send a {BadSessionClosed} Response. However the token of the channel seems to be already disposed

@romanett
Copy link
Contributor Author

romanett commented Mar 12, 2025

This seems to be a general issue in handling this kind of disconnect.

Image

If the line above is fixed the symmetric sign fails:

Image

IMHO the server shall just stop processing the message, as it is not needed any more

@romanett romanett changed the title Null Reference Exception in UaSCUaBinaryChannel.WriteSymmetricMessage after Client stop Null Reference Exception in UaSCUaBinaryChannel.WriteSymmetricMessage after Client disconnect Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug was identified and should be fixed.
Projects
None yet
Development

No branches or pull requests

1 participant