barnstee / UA-CloudPublisher

A cross-platform OPC UA cloud publisher reference implementation leveraging OPC UA PubSub over MQTT or Kafka. It runs in a Docker container on standard Docker hosts or on Kubernetes and comes with an easy-to-use web user interface.
Other
37 stars 10 forks source link

One session per published node #3

Closed GoetzGoerisch closed 2 years ago

GoetzGoerisch commented 2 years ago

Using the UA-CloudPublisher with more than a couple hand selected node results in many one session per node on the server.

Steps to reproduce:

  1. Run Docker image with digest sha256:3df45610ae505eb22126b88d87c50aad160c5222a000a0a5b34b1bdf6a14782b
  2. Configure publishing to MQTT broker
  3. Upload publishednodes.json to connect and publish 4.Wait until everything is loaded and starts publishing

Expected result: Publisher creates one session with one subscription and 5 monitored items.

Actual result: Publisher creates 5 sessions with 5 subscriptions and 5 monitored items.

image

Comments: I have seen the correct behaviour before and with other servers, but here it seems to misbehave.

CC: @AndreasHeine

Additional information:

publishednodes.json:

[
  {
    "EndpointUrl": "opc.tcp://opcua.umati.app:4843/UA",
    "OpcNodes": [
      {
        "Id": "nsu=http://example.com/ShowcaseMachineTool/;i=55229",
        "OpcSamplingInterval": 500,
        "OpcPublishingInterval": 1000,
        "HeartbeatInterval": 0,
        "SkipFirst": false
      },
      {
        "Id": "nsu=http://example.com/ShowcaseMachineTool/;i=55233",
        "OpcSamplingInterval": 500,
        "OpcPublishingInterval": 1000,
        "HeartbeatInterval": 0,
        "SkipFirst": false
      },
      {
        "Id": "nsu=http://example.com/ShowcaseMachineTool/;i=55188",
        "OpcSamplingInterval": 500,
        "OpcPublishingInterval": 1000,
        "HeartbeatInterval": 0,
        "SkipFirst": false
      },
      {
        "Id": "nsu=http://example.com/ShowcaseMachineTool/;i=55186",
        "OpcSamplingInterval": 500,
        "OpcPublishingInterval": 1000,
        "HeartbeatInterval": 0,
        "SkipFirst": false
      },
      {
        "Id": "nsu=http://example.com/ShowcaseMachineTool/;i=55246",
        "OpcSamplingInterval": 500,
        "OpcPublishingInterval": 1000,
        "HeartbeatInterval": 0,
        "SkipFirst": false
      }
    ],
    "OpcEvents": [],
    "OpcAuthenticationMode": "Anonymous"
  }
]
barnstee commented 2 years ago

I've debugged the issue: UA Cloud Publisher uses a discovery client to pick the endpoint on the OPC UA server with the highest security. During this discovery, the UMATI OPC UA server forces a close on the connection, making the discovery fail: UAApplication: Information: OPC UA Stack: ChannelId 58: Force reconnect reason=BadConnectionClosed 'Remote side closed connection' This leads to an invalid entry in our endpoint description cache which means the session lookup (for an existing session) also fails.

Can you find out why the UMATI OPC UA server doesn't allow discovery of its endpoints?

GoetzGoerisch commented 2 years ago

Yes, I will investigate, but I already have a idea. Thank you for the moment.

GoetzGoerisch commented 2 years ago

It is not the server, it was my container deployment of the server with remaps the port and the DiscoverEndPoints service is therefore not working correctly.

I tried it with a clean deployment and than it is working as expected.

Thank you for your debugging and help! ❤️

barnstee commented 2 years ago

My pleasure!