OPC UA PubSub Traps And Pitfalls: Difference between revisions
From OPC Labs Knowledge Base
No edit summary |
No edit summary |
||
(23 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[[Category:Troubleshooting]] [[Category:OPC UA PubSub]] | [[Category:Linux]] [[Category:Troubleshooting]] [[Category:OPC UA PubSub]] | ||
= Common Issues = | |||
; Error "Unable to activate the adapter (...). Return code: -5" | |||
: We have observed this error with Npcap 0.996. Upgrading to Npcap 0.9987 has resolved the problem. | |||
; Error "Unable to activate the adapter (...). Return code: -8" | ; Error "Unable to activate the adapter (...). Return code: -8" | ||
: On Linux, elevated privileges are needed in order to send raw Ethernet packets. Run your program with '''sudo''' to resolve this issue. On Windows, depending on how the driver was installed, elevated privileges might be needed as well. | : On Linux, elevated privileges are needed in order to send raw Ethernet packets. Run your program with '''sudo''' to resolve this issue. On Windows, depending on how the driver was installed, elevated privileges might be needed as well. | ||
; Error "Unable to load shared library 'libpcap' or one of its dependencies. ..." | ; Error "Unable to load shared library 'libpcap' or one of its dependencies. ..." | ||
: If you are on Ubuntu 18: Libpcap is "preinstalled", but SharpPcap won't find it. There are various ways how to resolve it. One of them is to create a copy of symlink '''/ | : If you are on Ubuntu 18: Libpcap is "preinstalled", but SharpPcap won't find it. There are various ways how to resolve it. One of them is to create a copy of symlink '''/usr/lib/x86_64-linux-gnu/libpcap.so.0.8''' to symlink '''libpcap.so''' in the same directory. On various other systems (tested with Ubuntu 20): "sudo apt-get install libpcap-dev". | ||
; My subscription filter matches the publisher configuration, but messages are still being filtered out. | ; My subscription filter matches the publisher configuration, but messages are still being filtered out. | ||
: Make sure that you only put information to the filter that is actually contained in the messages. For example, you may have specified a concrete dataset writer ID, based on the publisher configuration, in your filter. But, in UADP fixed profile, the dataset writer ID is not actually transmitted in the network messages, and therefore you must use zero for the dataset writer ID in your filter. | : Make sure that you only put information to the filter that is actually contained in the messages. For example, you may have specified a concrete dataset writer ID, based on the publisher configuration, in your filter. But, in UADP fixed profile, the dataset writer ID is not actually transmitted in the network messages, and therefore you must use zero for the dataset writer ID in your filter. | ||
; Subscriber does not receive anything, even when no filter is specified - but I am sure the publisher works. | ; Subscriber does not receive anything, even when no filter is specified - but I am sure the publisher works. | ||
: | : With UDP or Ethernet protocols, check that you are publishing and subscribing on the intended network interfaces. On computers with multiple interfaces, which are common nowadays, a default interface is chosen by the software when no interface is specified, and it may commonly be a wrong choice. In tools like '''OpcCmd''' or '''UADemoSubscriber''', use the '''--ConnectionNetworkInterface''' ('''-cni''') option. In subscriber code, set the '''InterfaceName''' property of '''UAPubSubConnectionDescriptor'''.'''ResourceAddress'''. With MQTT protocol, check that the broker queue name (which is interpreted as topic name filter) is correct. When the topic name filter is incorrect, MQTT gives no error, but you will most likely receive no messages. In tools like '''OpcCmd''' or '''UADemoSubscriber''', the broker queue name is specified using the '''--BrokerQueueName''' ('''-bqn''') option. | ||
; Subscriber does not receive anything, when on the same host as the publisher. | ; Subscriber does not receive anything, when on the same host as the publisher. | ||
: This happens with some network adapters. You can install and use a loopback adapter to make it work. On Windows 10, run Add Hardware Wizard ('''hdwwiz.exe'''), tell it that you want to select the hardware manually from a list, and from Network Adapters, select Microsoft -> Microsoft KM-TEST Loopback Adapter. Be careful - adding a new adapter without further configuration may have other, sometimes unforeseen, consequences - such as that traffic might get routed into the adapter when you do not want it. It is recommended that you disable the adapter when not in use for your tests. | : This happens with some network adapters. You can install and use a loopback adapter to make it work. On Windows 10, run Add Hardware Wizard ('''hdwwiz.exe'''), tell it that you want to select the hardware manually from a list, and from Network Adapters, select Microsoft -> Microsoft KM-TEST Loopback Adapter. Be careful - adding a new adapter without further configuration may have other, sometimes unforeseen, consequences - such as that traffic might get routed into the adapter when you do not want it. It is recommended that you disable the adapter when not in use for your tests. | ||
; There is a delay after the connection is established, before the dataset messages start coming. | ; There is a delay after the connection is established, before the dataset messages start coming. | ||
: This may be due to use of delta frames by the publisher. QuickOPC does not deliver incomplete datasets (from the delta frames) to you. It therefore needs to wait for the first key frame. | : This may be due to use of delta frames by the publisher. QuickOPC does not deliver incomplete datasets (from the delta frames that are received before the first key frame) to you. It therefore needs to wait for the first key frame (or until all dataset fields can be assembled from the delta frames). | ||
== How to obtain network interface names == | ; When publishing with UDP unicast, no messages appear in network analyzer. | ||
: Make sure the destination host is actually reachable on the network. For destination hosts on the local network, the destination IP address needs to be resolvable using ARP before a unicast packet can be even sent out. For destination hosts on other networks, it must be possible to resolve its IP address via the routing table. | |||
= Other issues = | |||
; I can see the UDP packets in network analyzer, but absolutely no PubSub message gets received (not even on transport layer). | |||
: Although this might be a rare case, we have encountered this in reality, with a buggy device that was transmitting incorrect IP header checksum in its packets, and the subscriber on Windows 11. If you are using WireShark, you can enable checksum validation through Edit -> Preferences -> Protocols -> IPv4, and then check "Validate the IPv4 checksum if possible". There is also information on the Internet that indicates that a zero Identification fields in the IPv4 header can cause the problem, but we have observed (on Windows 11) such packets being received just fine. | |||
= How to obtain network interface names = | |||
== On Windows == | |||
On Windows, we recommend using the following command to obtain a list of available network interfaces:<br/> | On Windows, we recommend using the following command to obtain a list of available network interfaces:<br/> | ||
{{Style=keyboard|netsh interface ip show interfaces}} | {{Style=keyboard|netsh interface ip show interfaces}} | ||
Other related commands are: | Other related Windows commands are: | ||
<pre>netsh interface show interface | <pre>netsh interface show interface | ||
ipconfig |findstr "adapter" | ipconfig |findstr "adapter" | ||
Line 22: | Line 33: | ||
wmic nic get NetConnectionID</pre> | wmic nic get NetConnectionID</pre> | ||
== On Linux == | |||
On Linux, we recommend using the following command to obtain a list of available network interfaces:<br/> | On Linux, we recommend using the following command to obtain a list of available network interfaces:<br/> | ||
{{Style=keyboard|netstat -i}} | {{Style=keyboard|netstat -i}} | ||
Other related commands are: | Other related Linux commands are: | ||
<pre>ip link show | <pre>ip link show | ||
nmcli device status | nmcli device status | ||
Line 31: | Line 43: | ||
ifconfig -a | ifconfig -a | ||
</pre> | </pre> | ||
== In command-line utilities == | |||
In the OpcCmd utility and UADemoPublisher, you can use the following command to show information that describes all network interfaces on the local computer:<br/> | |||
{{Style=keyboard|system networkInformation listInterfaces}} | |||
Example output: | |||
<pre style="font-size:11px;"> | |||
Getting all network interfaces... | |||
Network interfaces (sequence): 3 element(s) | |||
╒══╤══════════════════════════════════════╤════════════════════════════╤═══════════════════════════════════════╤════════════════════╤═════════════════╤══════════╤═════════════╤═════════════════╕ | |||
│[]│Id │Name │Description │NetworkInterfaceType│OperationalStatus│Speed │IsReceiveOnly│SupportsMulticast│ | |||
╞══╪══════════════════════════════════════╪════════════════════════════╪═══════════════════════════════════════╪════════════════════╪═════════════════╪══════════╪═════════════╪═════════════════╡ | |||
│ 0│{812B7AE6-B950-490F-ACE3-07B86C3BD92D}│Ethernet │Intel(R) Ethernet Connection (2) I219-V│Ethernet │Up │1000000000│False │True │ | |||
│ 1│{B2009DB7-D86A-4046-BD90-869B7D2CD98E}│VirtualBox Host-Only Network│VirtualBox Host-Only Ethernet Adapter │Ethernet │Up │1000000000│False │True │ | |||
│ 2│{C18E56BE-D700-11E7-86CC-806E6F6E6963}│Loopback Pseudo-Interface 1 │Software Loopback Interface 1 │Loopback │Up │1073741824│False │True │ | |||
╘══╧══════════════════════════════════════╧════════════════════════════╧═══════════════════════════════════════╧════════════════════╧═════════════════╧══════════╧═════════════╧═════════════════╛ | |||
Command finished (0.1 seconds). | |||
</pre></small> |
Latest revision as of 16:24, 27 October 2024
Common Issues
- Error "Unable to activate the adapter (...). Return code: -5"
- We have observed this error with Npcap 0.996. Upgrading to Npcap 0.9987 has resolved the problem.
- Error "Unable to activate the adapter (...). Return code: -8"
- On Linux, elevated privileges are needed in order to send raw Ethernet packets. Run your program with sudo to resolve this issue. On Windows, depending on how the driver was installed, elevated privileges might be needed as well.
- Error "Unable to load shared library 'libpcap' or one of its dependencies. ..."
- If you are on Ubuntu 18: Libpcap is "preinstalled", but SharpPcap won't find it. There are various ways how to resolve it. One of them is to create a copy of symlink /usr/lib/x86_64-linux-gnu/libpcap.so.0.8 to symlink libpcap.so in the same directory. On various other systems (tested with Ubuntu 20): "sudo apt-get install libpcap-dev".
- My subscription filter matches the publisher configuration, but messages are still being filtered out.
- Make sure that you only put information to the filter that is actually contained in the messages. For example, you may have specified a concrete dataset writer ID, based on the publisher configuration, in your filter. But, in UADP fixed profile, the dataset writer ID is not actually transmitted in the network messages, and therefore you must use zero for the dataset writer ID in your filter.
- Subscriber does not receive anything, even when no filter is specified - but I am sure the publisher works.
- With UDP or Ethernet protocols, check that you are publishing and subscribing on the intended network interfaces. On computers with multiple interfaces, which are common nowadays, a default interface is chosen by the software when no interface is specified, and it may commonly be a wrong choice. In tools like OpcCmd or UADemoSubscriber, use the --ConnectionNetworkInterface (-cni) option. In subscriber code, set the InterfaceName property of UAPubSubConnectionDescriptor.ResourceAddress. With MQTT protocol, check that the broker queue name (which is interpreted as topic name filter) is correct. When the topic name filter is incorrect, MQTT gives no error, but you will most likely receive no messages. In tools like OpcCmd or UADemoSubscriber, the broker queue name is specified using the --BrokerQueueName (-bqn) option.
- Subscriber does not receive anything, when on the same host as the publisher.
- This happens with some network adapters. You can install and use a loopback adapter to make it work. On Windows 10, run Add Hardware Wizard (hdwwiz.exe), tell it that you want to select the hardware manually from a list, and from Network Adapters, select Microsoft -> Microsoft KM-TEST Loopback Adapter. Be careful - adding a new adapter without further configuration may have other, sometimes unforeseen, consequences - such as that traffic might get routed into the adapter when you do not want it. It is recommended that you disable the adapter when not in use for your tests.
- There is a delay after the connection is established, before the dataset messages start coming.
- This may be due to use of delta frames by the publisher. QuickOPC does not deliver incomplete datasets (from the delta frames that are received before the first key frame) to you. It therefore needs to wait for the first key frame (or until all dataset fields can be assembled from the delta frames).
- When publishing with UDP unicast, no messages appear in network analyzer.
- Make sure the destination host is actually reachable on the network. For destination hosts on the local network, the destination IP address needs to be resolvable using ARP before a unicast packet can be even sent out. For destination hosts on other networks, it must be possible to resolve its IP address via the routing table.
Other issues
- I can see the UDP packets in network analyzer, but absolutely no PubSub message gets received (not even on transport layer).
- Although this might be a rare case, we have encountered this in reality, with a buggy device that was transmitting incorrect IP header checksum in its packets, and the subscriber on Windows 11. If you are using WireShark, you can enable checksum validation through Edit -> Preferences -> Protocols -> IPv4, and then check "Validate the IPv4 checksum if possible". There is also information on the Internet that indicates that a zero Identification fields in the IPv4 header can cause the problem, but we have observed (on Windows 11) such packets being received just fine.
How to obtain network interface names
On Windows
On Windows, we recommend using the following command to obtain a list of available network interfaces:
netsh interface ip show interfaces
Other related Windows commands are:
netsh interface show interface ipconfig |findstr "adapter" netsh mbn show interfaces wmic nic get NetConnectionID
On Linux
On Linux, we recommend using the following command to obtain a list of available network interfaces:
netstat -i
Other related Linux commands are:
ip link show nmcli device status nmcli connection show ifconfig -a
In command-line utilities
In the OpcCmd utility and UADemoPublisher, you can use the following command to show information that describes all network interfaces on the local computer:
system networkInformation listInterfaces
Example output:
Getting all network interfaces... Network interfaces (sequence): 3 element(s) ╒══╤══════════════════════════════════════╤════════════════════════════╤═══════════════════════════════════════╤════════════════════╤═════════════════╤══════════╤═════════════╤═════════════════╕ │[]│Id │Name │Description │NetworkInterfaceType│OperationalStatus│Speed │IsReceiveOnly│SupportsMulticast│ ╞══╪══════════════════════════════════════╪════════════════════════════╪═══════════════════════════════════════╪════════════════════╪═════════════════╪══════════╪═════════════╪═════════════════╡ │ 0│{812B7AE6-B950-490F-ACE3-07B86C3BD92D}│Ethernet │Intel(R) Ethernet Connection (2) I219-V│Ethernet │Up │1000000000│False │True │ │ 1│{B2009DB7-D86A-4046-BD90-869B7D2CD98E}│VirtualBox Host-Only Network│VirtualBox Host-Only Ethernet Adapter │Ethernet │Up │1000000000│False │True │ │ 2│{C18E56BE-D700-11E7-86CC-806E6F6E6963}│Loopback Pseudo-Interface 1 │Software Loopback Interface 1 │Loopback │Up │1073741824│False │True │ ╘══╧══════════════════════════════════════╧════════════════════════════╧═══════════════════════════════════════╧════════════════════╧═════════════════╧══════════╧═════════════╧═════════════════╛ Command finished (0.1 seconds).