11-23-2011 09:50 AM
The short question: Has anyone ever successfully used the Owner Document property of an Element? How?
I finally narrowed a LabVIEW crash down to calling that property. I believe that the property creates a second reference to the XML Document (the first reference being the normal, New Document), and when the references are closed, there's a double close that results in the crash mentioned a few times in other posts here.
I've tried a variety of strategies for closing the references trying to find an order that works, but no matter what, if I have called the Owner Document property, the final close of the Document causes a crash, and that's whether I explicitly do the close or let LabVIEW clean up after the vi.
I'm running 2010 on Linux, but I believe the crash happened on Windows too. It definitely happened with previous versions of LabVIEW as well... I've been running up against this crash for about a year now!
~Chris
11-23-2011 10:08 AM
Here's a quick demo of what I'm talking about. There's nothing tricky about it, I don't think... the three closes were attempts to close without a crash, and the crash always happens as I try to close the Document (the select is just tacked on to see if execution gets past the close).
11-28-2011 05:27 PM
Closing an element whose owner document has already been closed will result access violation. So that is why LabVIEW crashes. I tried re-arranging the order in which the references get closed and have had your example VI run without crashing. Just make sure you have the reference coming out of your last property node (the one you close second in your shown VI) close first.
11-28-2011 06:51 PM
Thanks for giving it a shot, Eric, but your order of closing is the order that I tried first... and it crashes here. Here's a screenshot rearranged that way to make sure we're on the same page:
When it's arranged like this, the crash occurs during the second close, when the DocumentElement reference is closed.
So to recap: closing the DocumentElement ref first lets the OwnerDocument ref close but there's a crash when closing the Document, BUT when closing the OwnerDocument ref first the crash is at closing the DocumentElement ref. To me this shows that closing the OwnerDocument ref doesn't just destroy the reference, but closes the whole Document, leading to a crash from double closure in the first case and a crash from closing something whose owner has already been closed in the second.
If you have a working vi that uses OwnerDocument, would you attach it? Again, I'm on LV2010 sp1 if that makes a difference.
Thanks a lot!
11-28-2011 07:53 PM
Is the Owner Document reference pointing to the same object as the original document reference?
If so, then closing the same thing twice is probably causing the problem.
11-29-2011 05:31 AM
Ravens Fan, yes, the two references point to the same object. The problem is that one way or another the OwnerDocument and the Document will both be closed. If I don't close them myself in my program, LabVIEW will try to close them upon exit from the program during its cleanup. Either way will lead to a crash.
For me this makes the OwnerDocument functionality entirely unusable, but I'm interested in seeing how Eric L. was able to make it work.
11-30-2011 11:45 AM
Hey crcarlin,
Unfortunately I had wired one of the references wrong so I ran the VI without ever closing the original reference (the one you close last.) That is why it was working. Why is it you say that reference must be closed? I am just running your simple VI you posted but without closing that reference it seems to run fine.
11-30-2011 11:54 AM
Hi, Eric
So do you see the crash if you explicitly close all three references as in the last picture I posted?
If I don't close the reference myself (or if I don't close anything myself) LabVIEW crashes anyway. I figure upon finishing execution, LabVIEW closes the references automatically as part of clean up.
11-30-2011 03:46 PM
I did get the crash when I closed each one. So far I have gotten no crashes when not closing the last one. LabVIEW does not automatically close references when it is done running. Have you tried your whole VI without closing that reference?
11-30-2011 03:53 PM
Hi, Eric
Yes, I experience precisely the same behavior whether I close the last one or not. If I don't close the last one explicitly in my VI, LabVIEW crashes the moment execution finishes, exactly as if it is tacking on an final close (even if that's not what it's really doing).
It sounds like I'm seeing a crash where you're not. I've seen this crash under a few different versions of LabVIEW (at least 2009 and 2010, maybe even from the 8.6 or so) all running under Linux. Could Linux be the deciding factor? I might be able to try it under Windows tomorrow, but all of our production systems are Linux.
~Chris