This content is not available in your preferred language.

The content is shown in another available language. Your browser may include features that can help translate the text.

Troubleshooting Network-Published Shared Variables Communication With LabVIEW

Updated Sep 12, 2024

Reported In

Software

  • LabVIEW
  • Distributed System Manager

Issue Details

  • I am having trouble communicating with my network-published shared variables over the network. My shared variables work in the development environment but not when they are built into an executable.
  • My network-published shared variables are not working the way I would expect them to. There is a discrepancy between values being written to the variables and the values being read from them.
  • When trying to access a shared variable in my code, I receive an error: Error -1950679034: The shared variable has no value.
  • When trying to access a Shared Variable in my code using the Open Variable Connection VI, I receive an error: Error 1950678943: Timed out while attempting to open a connection to the variable.
  • My shared variables will not stay deployed in the Shared Variable Engine.
  • Shared Variable stopped updating on my host VI, pulling the information from a CompactRIO.

Solution

There are several things that can prevent network-published shared variables from updating on other network machines. Depending on your system (general or real-time), you can choose to follow either set of the troubleshooting steps listed below. 

General Troubleshooting

  1. Make sure that the shared variable is set to Network-Published. To check this, right-click on the variable and select Properties
  2. If your shared variables are bound, make sure the path is correct. To check this, right-click on the variable, select Properties, and check the Bind to section.
 
NPVariablesLV2023Q3.png
 
  1. Make sure that shared variables are initialized sequentially and not in a parallel way. See the Serialize Shared Variable Execution section for further information on this topic.
  2. Make sure that the library containing the shared variable has been deployed. To check this, right-click on the library hosting the shared variable and select one of the deploy options. You can use the Distributed System Manager to check if the variables have been deployed by navigating to Tools>>Distributed System Manager. If you're using LabVIEW 8.5 or earlier, you can use the Variable Manager, which can be accessed by selecting Tools>>Shared Variable>>Variable Manager.
    • From the Distributed System Manager, you will be able to check the status of your shared variable. You will also be able to check the timestamp to determine if the variable is being written at the correct times. This can help you determine if a write is failing or if it is being written more often than expected.
    • Please note that variables that use the array and cluster data type do not display the values of individual components.
  3. If your computer is using a firewall, make sure you configure it according to the following documentation: Configuring Firewalls and Network Address Translating Routers for Shared Variables . A quick test you can perform is to disable the firewall temporarily to see if this might be the cause of the issue. If you are able to read the shared variables after disabling them, then it means the firewall configuration is blocking them and needs to be configured to allow NI-PSP packets. You can check the status of the firewall by going to the Security Center in Control Panel. For more information on potential firewall problems, please see Configuring Software and Hardware Firewalls to Support NI Products. Firewall-related issues would result in Error -1950679034: The shared variable has no value.
  4. If your antivirus software has a firewall, make sure to disable it or include exceptions there as well. Some antivirus such as Microsoft Defender have been identified to present these restrictions.
  5. Ensure the target that you are deploying the variables to has the correct IP address in the LabVIEW project. For example, if you have multiple network interfaces, right-click My Computer>>Properties and ensure the IP address on it is the IP address of the network interface you expect to be using. If it isn't, manually change it to the correct IP address.
  6. Check to see whether the shared variable is hosted on a computer that is on the same IP subnet. If it is not, you can register the remote computer by going to Tools>>Shared Variable>>Register Computer
  7. If the PC has multiple network cards trying to access the shared variable, try disabling the ones that aren’t in use. Also, check that the appropriate network card is set as the primary network by referring to How do I Connect to Ethernet Targets with Multiple Network Cards in the Host?  
  8. Ensure the Shared Variable Engine is running. Navigate to Windows Services and check that the NI Variable Engine process is present and running. If it is not present, install the LabVIEW Run-Time. If it is present and not running, right-click the process and start it. To ensure it starts automatically, enter the properties for the services, and ensure the Startup Type is set to Automatic. On the Recovery tab of the service properties, you can also set the Variable Engine to retry on the first, second, and all subsequent attempts if starting the shared variable engine fails. 
  9. Ensure NI Shared Variable Engine dependent services are also running (NI Configuration Manager and NI PSP Service Locator). Complete the same procedure detailed in the last step for these dependent services.
  10. Restart your NI Services and restart the MAX database .
  11. Use a LabVIEW shipping example to test the connection between the client and server using different methods. The example related to NSV can be accessed from Help>> Find Examples>> Networking>>Shared Variable. Using the example can help narrow down the issue and identify if it is something specific to the code or other settings.
  12. If the variable value is not updating, displaying incorrect values, or changing its value without command, try recreating the network-shared variable with a different name and replacing the original one.
  13. Remove the VIs that utilize shared variables from your project and restart LabVIEW. Then, proceed to open your project and re-add the VIs.  
  14. If you experience an issue when using the LabVIEW development environment after a software update, repair the LabVIEW installation by following the steps in this article: Repair Software In NI Package Manager (NIPM) .  

Troubleshooting for a Real-Time (RT) System

  1. Verify that the DIP switches are set correctly on your real-time target. If shared variables work when running from the development environment, but not when setting a startup executable, make sure that the dip switch for No Startup App is switched OFF.
  2. Ensure the variables are deployed to the real-time system by right-clicking the library and selecting Deploy All.
  3. Check the DNS IP on the RT target.  If this IP is set to something that is not a valid DNS server, the shared variables will update slowly due to DNS timeouts that occur. By changing this entry to 0.0.0.0, the shared variables should update at the appropriate rate.
  4. Adjust the timing or add a Wait to the Timed Loops that write to the shared variables. If the Timed Loop runs at a high frequency and starves other processes, the variable will seem like it is updating very slowly or not at all.
  5. If using shared variables with a real-time executable, make sure that no front panel objects are bound to shared variables. Front panel objects are removed when you build a real-time executable, causing the shared variables not to update. If you are intending to deploy your application as an executable, use shared variable nodes on the block diagram.
  6. If you are trying to read a shared variable from a real-time target, ensure that Variable Client Support has been installed on the target. This can be checked in Measurement & Automation Explorer by expanding the [+] next to the real-time target under Remote Systems and expanding the [+] next to Software. If the shared variable is being hosted by the real-time target, ensure that the Network Variable Engine is installed by using the same method. The Network Variable Engine will not work correctly on FieldPoint 2000, 2010, and 2015 controllers because they do not have sufficient memory.
  7. If your shared variable lives in the RT target, and you are not able to see the updated value of the variable using your host VI or the Distributed System Manager, try moving it from the RT target to the Host. A hint could be if you run the Distributed System Manager and the variable is not showing on the host deployed variables and the value is No known value.
  8. If the variable value is not updating, displaying incorrect values, or changing its value without command, try recreating the variable with a different name and replacing the original one for it. 
  9. If you are trying to access shared variables hosted on the RT target without a network, check if the target uses the same hostname with and without a network connection. In case it is not, add a hostname to an IP address through a locally stored text file that contains IP-address-to-host-name mappings. Add the IP address followed by the corresponding host name separated by at least one space in file/etc/hosts at the RT target and reboot it.