LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Shared variable stuck across restarts on RT target

Hello again all you helpful forum-goers!

 

I have run into a very strange situation involving shared variables and the file system on a real-time target.  One of my network-published shared variables, all of which are hosted on the real-time target of a Hypervisor computer (one which has some cores running the real-time OS, and some running Windows), seems to have a value stuck in it even though I have changed the value and restarted the entire computer.

 

The shared variable in question is called Network Config, and it is a cluster of integer values representing the IP address and UDP ports I am using in my application.  The value in question is the UDP input port.  The value which seems to be stuck in that variable is 52274. 

 

Test #1:

I have used the Windows side of my application to change the shared variable to a different value (e.g. 52277), and I can see the code on the real-time side has changed to use that value (it receives UDP on the new port and no longer on the old port).  Also, my real-time code writes the network configuration settings to a file on the real-time side whenever they change, as the Windows side of my application is optional, and the real-time side needs to work with the latest setting if it is started up without the Windows side ever being opened.  When I changed the value to 52277, I used Internet Explorer to look at the file system of the real-time target, and I could see the settings file was updated to have the new port value.  I exited Windows application, checked the real-time file again to verify it still showed the new value (it did), then restarted my whole computer.  When the computer finished restarting, I looked at the real-time settings file again using IE and saw it had changed to 52274, and I can verify my real-time code was using that value.

 

Test #2:

I changed the name of the real-time settings file slightly, rebuild and deployed my code, restarting the real-time side through the LabVIEW development environment.  My file access VI has a case for if the file is not found, it uses default values, specifically 52271 for the UDP input port, so it should have gone to that.  After it finished restarting, I looked at the file folder using IE, found the new settings file name, and it had 52274 as the port number.  Grr!

 

I have done a search for 52274 throughout my real-time code, and it was not found (52271, the default in the file not found case, was findable for reference).  So my only remaining idea is something with the shared variable engine not really restarting even when I restarted my whole computer?  I just don't know anymore.  I have attached the network communication VI for my application, with the VIs that actually do anything with the data removed for proprietary reasons, so you can see my logic for when to read/write the settings file, along with my settings file access VI.

 

If anyone has any ideas as to what could be going on here, I'd be very grateful for them!

 

Thank you,

 

-Joe

 

P.S.  Note that the conversion dot is because I use a typedef version of my Network Config cluster everywhere except for the shared variable (since they cannot use typedefs), where I use a identical copy saved as a normal control instead.

 

P.P.S.  Note also that although this VI doesn't show it, on the remote computer where I am actually using these VIs, I have added additional code to ignore a new value from the Network Config shared variable if the error code coming from that variable is non-0; in that case I just keep the value coming from the shift register.  I'm not sure if that is helping at all, so I haven't added it to my primary source file on my computer, which is what I am attaching.  The point is, doing that doesn't seem to be helping.

 

[Edit] P.P.P.S.  My browser doesn't seem to be allowing me to actually attach my VIs.  (Grr)  I'll talk to my IT department to try to get that fixed ASAP and get them posted.

0 Kudos
Message 1 of 7
(3,105 Views)

@jmorris wrote:

[Edit] P.P.P.S.  My browser doesn't seem to be allowing me to actually attach my VIs.  (Grr)  I'll talk to my IT department to try to get that fixed ASAP and get them posted.


Are you using IE8 with compatibility mode turned on?  If so, turn off compatibility mode.


See  Problem uploading attachments. By Jordan's latest response, it seems that Lithium doesn't care that they broke it or want to fix it.

0 Kudos
Message 2 of 7
(3,098 Views)

Sadly I am stuck using Internet Explorer 7.  😛  I don't see a "Compatibility Mode" option anywhere, so I'm guessing that was introduced in IE 8.  Any other thoughts?

0 Kudos
Message 3 of 7
(3,092 Views)

Using a different browser just to post these VIs.

Download All
0 Kudos
Message 4 of 7
(3,083 Views)

@jmorris wrote:

Sadly I am stuck using Internet Explorer 7.  😛  I don't see a "Compatibility Mode" option anywhere, so I'm guessing that was introduced in IE 8.  Any other thoughts?



That might be it.  Compatibility mode was introduced with IE8 and I think that was so the browser would lie to websites saying it is IE7 since some websites weren't capable of setting up webpages for the newer browsers.

 

Now we must be in an era where the people programming webpages are capable of programming for things that work with older browsers like IE7 or IE8 in compatibility mode.

0 Kudos
Message 5 of 7
(3,073 Views)

For anyone tracking this or coming across it in the future, the problem seems to have been in my comparison of the input config cluster to a blank version of that cluster in the Access Network Config File VI.  Both are the same typedef, but when I changed my logic for deciding whether to read from the file or write to the file to be based on an input Boolean control, rather on whether the input config cluster equaled the default value (which I meant to be synonymous with "input was not connected"), the problem went away.  I can't say that I understand what was going on completely, but at least it seems to be working now.  Note to self: don't do comparisons to default cluster values.  😛

0 Kudos
Message 6 of 7
(3,029 Views)

Okay, the previous post wasn't the solution (although it was still a good idea).  The problem is back, I'm still not sure why.  Some additional tests I performed:

 

1) After the computer started up, I checked the RT file setting (port ending in 5), then changed it to 8 by setting the shared variable value in the Windows application, then stopped the RT executable gracefully (setting a Stop shared variable true which all loops watched), verified it was stopped by checking a shared variable that is updated on every RT loop and seeing it indicate a timeout, verified the RT file still had the new value via IE, then restarted the computer.  When it came back up, the file was back at 5.

 

2) After the computer started up, I changed the RT file from 5 to 7 via the IE interface, then restarted the computer.  When it came back up, the file was back at 5.

 

I have also undeployed and redeployed all of my shared variables to no avail.  If the shared variable is stuck across reboots, why does it not remember the new value of 8 which I wrote to it?  If the RT file is stuck in a non-committed state (to use a database term), such that it reverts when I restart, why is that happening, and what can I do about it?  I tried adding explicit open and close file VIs around my writing the RT file, but that didn't help.  I can sometimes get the RT file to stay changed if I stop the RT executable, and restart the RT side of the computer through the LabVIEW development environment, but not reliably (if it was reliable, I was just going to gracefully stop the RT exeutable through the Stop variable and then tell the user they had to reboot the computer after changing the setting, but it isn't).

 

I would very much appreciate any suggestions as to what could possibly be going wrong, even if you don't include a way to fix it.  This issue is driving me crazy!  😛

 

Thank you,

 

-Joe

0 Kudos
Message 7 of 7
(2,994 Views)