LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Values not passed to subVIs in builds in LV2014 and 2015

Sorry for the strange title, but its a strange problem. We have a very large application that we built in LabVIEW 2009 and have mainatined and expanded through LabVIEW 2013. When we tried to upgrade to 2014, we ran into issues with our built applications not working even though everything validated in the development environment. At the time, we were rushed, so we passed over 2014 and now we are trying again with 2015. We opened our application projects and did builds without any issues. The applications seemed to open fine and most of the functionality worked, however there were certain parts that didn't. Our application architecture uses a small main VI with a lot of spawned VIs running as processes that are accessed through a messaging system. It works really well and has been for the last 6 years. We did a lot of troubleshooting and narrowed down the problem to what seems to be a change in how the application builder tries to optimize executable size. The size of our executables shrank considerably starting with 2014. To test our hypothesis, I made the attached library and it accurately reproduces the behavior we see (in a much smaller and non-proprietary way!)

The library contains a main VI and six subVIs. The main VI creates two user events, one is a 1D DBL array data type and the other is a type-defined cluster of a String and a scalar DBL. Once a second, the VI will generate a 100 point random array and generate a 1D DBL array event with this data. There are six subVIs that all do exactly the same thing: register for the 1D DBL event, on that event, calculate the mean of the array, then generate the other event with the mean and the name of the process generating the event. The main VI is registered for these return events and uses the process name to populate a table with the results. Super simple and quite representative of our application in general (though our application uses many more data types and a more complex message routing.) The six subVIs are a mix of two properties: calling method and whether they contain a front panel control that is referenced in the code. The three calling methods we use are 1) Launch Asynchronously with Call and Forget and using the connector pane to pass the two event references, 2) Use VI Server to run the VI and have the references read within the launched VIs from a functional global variable, and 3) Use VI Server to set the value of front panel controls by name and then running the VIs. In the development environment, all six VIs spawn and return results to the main VI.

But if you build an executable from the main VI with default settings, the last two VIs will not return values. It should be noted that all the VIs launched with VI server are launched using the same subVI to do the VI server calls. If you open the build settings and in the Source File Settings page, you disable "Use Default Sattings" and "Remove Front Panel" for "Call By Name Process.vi" and "Call By Name UI.vi" and rebuild, then "Call By Name UI.vi" will return values when the application runs, but "Call By Name Process.vi" still won't. We can't get "Call By Name Process.vi" to run in an executable except by enabling debugging in the application, but this goes against recommended optimization practices and has only changed since LabVIEW 2014. The application runs without issues in LabVIEW 2013. The other thing to note is in the build settings under Source File Settings, the VIs in the Process Spawns folder have Remove Front Panel checked by default while those in the UI Spawns folder do not. Also, setting the "Show" input True on our "Launch Spawn.vi", will open the front panel of the called VI even if the "Remove Front Panel" is checked.

One last thing to note is that the VIs that don't return values to the main VI are actually getting the data event from the main VI. If you add a front panel indicator to "Call By Name Process.vi" it will show the mean value updating with all the other spawned VIs, it just can't send the result back to the main VI. If you put an error indicator on the Generate Event, it doesn't indicate that an error has occurred, but obviously, the event isn't being generated.

I'm sorry for the overly long description, but we've already done a lot of poking at this and I thought I would help by passing along what we have learned so far. Mostly, we'd just like to have a solution for this, since "Launch Spawn.vi" is how we open most of the processes on our large applications and it will be time consuming (to say the least) to replace a generic launching tool with custom launch VIs for everything.

Thanks for looking.

Message 1 of 11
(3,935 Views)

I cannot explain what is going on but, I was able to duplicate your problem and was also able to fix the issue, although I must admit i am not sure WHY the fix actually works. In the build spec I added the Call by name process and the FGV process to be always included and now it works like it does in the development environment. 




Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 2 of 11
(3,898 Views)

I can't open a 2015 file yet but, perhaps I can shed some light.

Check the build spec here

Capture.PNG

Sicne it seam like you are spawning by name the vis appear unused and the built library will not contain those vi's by default.  unchecking those options should help


"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 11
(3,874 Views)

You are right, forcing "Call By Name Process.vi" to always include does seem to make it work. It might have to be our work around for now. It will take some time to identify all the VIs that we need to do that with in our larger applications. I never had a problem with "FGV Process.vi" running properly.

I did a little more testing with "Call By Name Process.vi" and it receives the event from the main VI and doesn't seem to send the response event, but also, the Generate Event doesn't raise an error. Casting the return event reference to I32 shows that the value is the same as the reference in the working VIs as well, so its not losing the value. I should change the title of my thread.

Funny thing just happened: By telling "FGV Process.vi" not to remove its front panel, "Call By Name Process.vi" started working, even when they weren't added to always include. Its very weird and 'm uncertain there will be a solution other than going through our codebase and checking the build settings of every launched VI. That is disappointing since those settings are build specific and we have many applications that use our libraries.

One more thing, I tested in the 2016 beta and it exhibits the same behaviors. 

0 Kudos
Message 4 of 11
(3,862 Views)

The VIs aren't actually called by name, they are called with a static VI reference on the block diagram of the main VI. Changing the exclusion settings did "fix" the problem if I unchecked Remove unused members of project libraries, but that forced an inclusion of vilib and the executable blew up from 250kB to 5.5MB.

0 Kudos
Message 5 of 11
(3,854 Views)

Hi Chris,

 

I am looking into your issue. I was able to reproduce the problem in LabVIEW 2015 and will be looking into this further. 

Aaron Douglass
Applications Engineer
National Instruments
0 Kudos
Message 6 of 11
(3,652 Views)

@Chris.Osiecki wrote:

The VIs aren't actually called by name, they are called with a static VI reference on the block diagram of the main VI. Changing the exclusion settings did "fix" the problem if I unchecked Remove unused members of project libraries, but that forced an inclusion of vilib and the executable blew up from 250kB to 5.5MB.


That actually makes a bit of sense.  you call a vi in a lvlib dynamicallyyou need to add it to the build spec somehow.  a lvlib is a single file so, the entire lvlib needs to be loaded to have the vi in the build.  depending on how large the library is you can get a lot of bloat in the exe.

 

Most libraries are not 5.25MB (if yours is you may want to consider restructuringSmiley Wink)  Changing the exclusion settings would apply to all lvlibs.  Try adding the specific lvlib to the allways encluded source file list instead


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 11
(3,604 Views)

Has anybody made any progress with this?

 

I am having almost exactly the same problem:

 

Project worked in 2012.

Upgrade to 2015, build exe.

Everything seems to work except for one dynamically launched subvi which is not receiving events.

 

The dynamic VI does run, but events are not being executed. I tried unchecking "Remove unused members of project libraries" and am recompiling, but now build is taking forever, and I am pretty sure it will be huge when it is done, so it is not really a long-term solution.

0 Kudos
Message 8 of 11
(3,343 Views)

Hey Luke,

 

If I understand your project, it sounds like you have a dynamically-launched subVI taking user events. Also it sounds like the dynamically-called VI is a part of a library. Is that correct? Would you be willing to share more about what you’re working on? If not, could you share a subset? If not, can you explain your problem in better detail?

 

Are you passing user events into a subVI to be executed by an event structure? If so, can we help debug the dynamically-called VI a bit?

 

You said the dynamic VI does run, but events are not being executed. At what points are things not working as desired? Is the event being seen inside the subVI? Is the event structure not executing as desired?

 

Also this issue is similar to Chris’, but they don’t sound like they’re the same. As a result, you may consider creating a new thread with the new issue.

 

Ryan B.
Technical Support Engineer
National Instruments
0 Kudos
Message 9 of 11
(3,280 Views)

Thanks for the reply RB.

 

After flailing around for most of another day, I believe I have resolved my issue. So I'm going to put off answering all of your questions for now and just tell you what I've discovered. I'll try to describe it in words as it is difficult for me to post example code due to my working environment.

 

The dynamic VI is relatively simple, consisting of a single while loop with an event structure. The loop has a class on a shift register. The shift register should have initialized with a parent class type, and the event structure has an event that would change the class to one of a couple different child-class types. The problem was that one of the child classes was wired directly into the shift-register initialization terminal, when it SHOULD have been initialized with a wire of the PARENT type. I hope that makes sense. Casting the child-class to the parent class and then wiring that into the initialization terminal solved the problem.

 

So I was clearly doing something wrong, but it feels like there might be a LabVIEW bug in there as well? At least, with other data types if you wire up incompatible things to the two terminals of a shift register you get a broken run arrow.

 

If you are wanting to reproduce this but are unable to according to my cryptic description let me know and I can figure out a way to post an example.

0 Kudos
Message 10 of 11
(3,272 Views)