LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Write to XML File crashes when multiple Timed Loops present

Hello All,

 

It took me forever to track this bug down.

In this project we can edit operating parameters on the Host and send them down to an RT program in a cRIO-9025. The data is converted to XML and stored on the cRIO's disk.

Occasionally, the RT program would lock up and had to be rebooted.

It turns out that if you use Timed Loops , then a Write to XML File (or presumably any file write) will not return.

 

Attached is an example. This has 5 loops to make it crash faster, but it will eventually crash with only 2.

 

Paul J

  

0 Kudos
Message 1 of 3
(1,110 Views)

Hi Paul J,

 

What leads you to believe that the Write to XML File vi will not return?

 

In general it is not a good idea to place File I/O VIs inside of Timed Loops.  This is because File I/O is very nondeterministic.

 

In addition, the VI you are using (Write to XML File) does not append a file, but only creates or overwrites one.  Therefore every time that the loop runs, the OS must create or replace the file and then write to it, in only 100 ms.

 

I would guess that if you increased the period for that loops, the hangs would go away.  However, as I said before it is recommended that you only use File I/O functions in non-deterministic loops.

 

Have a great day,

 

Chris V

Applications Engineer
National Instruments
0 Kudos
Message 2 of 3
(1,091 Views)

Hello Chris,

 

I know that Write to XML File fails because I put in debug code in my actual program, a flat sequence which updated an indicator, and after the crash, the indicator had not updated.

 

Yes, I know that it replaces the file. It's a configuration file, not data gathering. This is just an example of the bug.

 

FYI,

I increased the period for the loop with the file save to 500msecs and it still crashed.

I then decreased it to 50 msecs, and replaced all of the other Timed loops with While loops and it does not crash, even though the file save takes much longer than 50 msecs, average ~150msecs.

I replaced the loop with the file save with a While loop while leaving the others as Timed loops and it does not crash.

So the bug is systemic and related to a file save in a Timed Loop when there are other Timed Loops.

 

I'm not looking for a solution, I'm only reporting a bug in Labview. The solution is not to use Timed Loops, especially, as you point out, when there is file saving. It cost me several days of dicking around to figure it out. Maybe someone can save some time if they find this.

 

Paul J

 

 

 

 

 

 

 

 

 

0 Kudos
Message 3 of 3
(1,086 Views)