Search code examples
sessionopc-uamilo

Eclispe Milo handle missing Sever Nonce in ActivateSessionRequest


I use Eclipse Milo (0.2.3) in my prject for OPC UA communication. The OPC UA participants are a client (written using Eclipse Milo) and a server, which is running on a remote machine, and is not implemented using Milo).

I can connect the client to the server normally and if the remote server is shut down, I am able to reconnect the client automatically, as soon as the server is accessible again.

However, after updating the server software, the client can't reconnect any more and it floods the server with the following messages:

  • Create Session Request
    • The server is able to create a session
  • Activate Session Request
    • The server sends an Activate Session Response, in which the ServerNonce is missing and the service result is "bad"

This causes the client to send a new Create Session Request. This all happens multiple times within a second, which makes it impossible for the server to execute any other tasks then trying to create this session.

Are there any settings in Milo to specify the reconnection delay? Or is there any setting for sepcifying what should happen when receiving an empty ServerNonce?

The server's responses are as follows:

  • If the session can be activated:

    OpcUa Binary Protocol
        Message Type: MSG
        Chunk Type: F
        Message Size: 96
        SecureChannelId: 1599759116
        Security Token Id: 1
        Security Sequence Number: 53
        Security RequestId: 3
        OpcUa Service : Encodeable Object
            TypeId : ExpandedNodeId
                NodeId EncodingMask: Four byte encoded Numeric (0x01)
                NodeId Namespace Index: 0
                NodeId Identifier Numeric: ActivateSessionResponse (470)
            ActivateSessionResponse
                ResponseHeader: ResponseHeader
                    Timestamp: Nov 16, 2018 14:05:47.974000000
                    RequestHandle: 1
                    ServiceResult: 0x00000000 [Good]
                    ServiceDiagnostics: DiagnosticInfo
                        EncodingMask: 0x00
                            .... ...0 = has symbolic id: False
                            .... ..0. = has namespace: False
                            .... .0.. = has localizedtext: False
                            .... 0... = has locale: False
                            ...0 .... = has additional info: False
                            ..0. .... = has inner statuscode: False
                            .0.. .... = has inner diagnostic info: False
                    StringTable: Array of String
                        ArraySize: 0
                    AdditionalHeader: ExtensionObject
                        TypeId: ExpandedNodeId
                        EncodingMask: 0x00
                ServerNonce: ab...
                Results: Array of StatusCode
                    ArraySize: 0
                DiagnosticInfos: Array of DiagnosticInfo
                    ArraySize: 0
    
  • If the session can't be activated (after updating the server's software):

    OpcUa Binary Protocol
        Message Type: MSG
        Chunk Type: F
        Message Size: 64
        SecureChannelId: 1599759041
        Security Token Id: 1
        Security Sequence Number: 61
        Security RequestId: 11
        OpcUa Service : Encodeable Object
            TypeId : ExpandedNodeId
            ActivateSessionResponse
                ResponseHeader: ResponseHeader
                    Timestamp: Nov 16, 2018 12:49:08.235000000 
                    RequestHandle: 222
                    ServiceResult: 0x80000000 [Bad]
                    ServiceDiagnostics: DiagnosticInfo
                        EncodingMask: 0x00
                            .... ...0 = has symbolic id: False
                            .... ..0. = has namespace: False
                            .... .0.. = has localizedtext: False
                            .... 0... = has locale: False
                            ...0 .... = has additional info: False
                            ..0. .... = has inner statuscode: False
                            .0.. .... = has inner diagnostic info: False
                    StringTable: Array of String
                        ArraySize: 0
                    AdditionalHeader: ExtensionObject
                        TypeId: ExpandedNodeId
                        EncodingMask: 0x00
                ServerNonce: <MISSING>[OpcUa Null ByteString]
                Results: Array of StatusCode
                    ArraySize: 0
                DiagnosticInfos: Array of DiagnosticInfo
                    ArraySize: 0
    

Thank you in advance for your help.


Solution

  • This corner case you described where there's no delay between a failed re-activation and the subsequent re-creation is addressed on the dev/0.3 branch in this commit.

    I might be able to back port it to 0.2.x next week if I have some spare time.

    I don't think there are any workarounds you can use.