10-05-2012 10:45 AM - edited 10-05-2012 11:09 AM
I have a program that is programmatcially connecting to Network Published PSP variables on a crio. Its a fairly simple application so I am directly communicating with the I/O channels by publishing their data with Scan engine.
My project is working fine when in developer mode but does not work after building an executable. The executable does not error, it completely locks up and I am forced to "End Task" within windows. Without errors it was a pain, but I have finally traced this behavior down to this portion of my code.
I open the connection within a shared clone reentrant class method that I use for initializing sensor data. I'm not sure if the open variable function does not support using calling it within a class method this way or if this is just some weird bug. I have built smaller test executables using just the open variable function that seem to work fine when run. I have also tried non-reentrant execution with the same effect.
I'm also wondering if my Run Time engine could be corrupted, but I'm not sure how to check that as this executable is on my development computer. I can't seem to find a way to re-install the runtime without completely removing LV2012 and starting from scratch. Thanks
Solved! Go to Solution.
10-05-2012 01:17 PM
I have finally isolated the source of my executable crash and I believe it is a BUG within labview itself however, I do not have an way to verify on a different OS or system. Is there a forum or bug report form I can fill out?
Opening a variable connection programmatically within a time-loop is causing Labview built executable's to crash on my computer. You must have a variable connection to replicate this problem. I currently have network published psp variable on a crio that I am connecting to. If I replace the time loop with a normal while loop, the executable will not crash and functions normally. I do not think this is normal behavior of the time loop as it works just fine in development mode.
I have attached a sample project. I am currently running Win XP and LV 2012 f1, however, I was able to replicate this bug in 2011 SP1 as well.
10-05-2012 01:26 PM
One question I have is why are you repeatedly opening a shared variable reference in a loop? You are opening the reference and never closing it. You should be opening it once outside the loop, using it repeatedly in the loop, and closing it after the loop. I don't know if what you are doing would cause the particular crash you are seeing, but I can certainly see it being a problem in LabVIEW of continually opening up a resource and never closing it.
10-05-2012 01:43 PM - edited 10-05-2012 01:45 PM
@OriolesFan wrote:
One question I have is why are you repeatedly opening a shared variable reference in a loop? You are opening the reference and never closing it. You should be opening it once outside the loop, using it repeatedly in the loop, and closing it after the loop. I don't know if what you are doing would cause the particular crash you are seeing, but I can certainly see it being a problem in LabVIEW of continually opening up a resource and never closing it.
Sorry this was a really simple test case i put together very quickly and your points are valid. Not my best example code, however, if do things the right way i still get the same executable crash.
The following code causes and executable crash when built and run.
This code works when built and run:
and either does this one.
10-08-2012 12:06 PM
You'll notice there's a coersion dot on the input to the right shift register. The Open function outputs a slightly different type than it takes in.
First data type:
Second data type:
It will work great if the shift register's data type is correct.
10-08-2012 03:05 PM
@craig-H wrote:
You'll notice there's a coersion dot on the input to the right shift register. The Open function outputs a slightly different type than it takes in.
First data type:
Second data type:
It will work great if the shift register's data type is correct.
I guess i'm confused b/c my first example doesn't work either and it still crashes if i only open and write once in the loop and don't use a shift register. You still have the same coerssion dot when using a non-timed while loop as well. I've moved on after replacing the timed loop with a non-timed while loop for the time being, i have a project to finish and can't trouble shoot this till its done. It is most likely an issue with my computer.
10-08-2012 03:55 PM - edited 10-08-2012 03:55 PM
While the wire is the same for both references they contain different data types, meaning that the shared variable refnum coming into "Open Variable Connection" is slightly different than the type that is coming out.
Your code works where the shift register's type is initialized to the refnum after it comes out of the open function and my guess is that your class's cluster is referencing the initial type as well.
The functionality is definitely a little bit confusing and the way the refnums change does not make it easy to use them within classes. It is also wierd how execution changes between timed and non-timed loops.
10-11-2012 11:16 AM
Just an update to this forum, I've been working with John on a service request related to this forum, and I have been unable to reproduce this crash on Windows 7 or Windows XP (LabVIEW 2012).