LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

files don't update until vi stops

Solved!
Go to solution

At some point in recent LV and MacOS updates, I lost the ability to have text files show live updates as they were modified.  Text entered via the VI does not show up in the text file until the vi stops execution. It doesn't matter if the loop is stopped and the file closed, or if the execution is aborted.  The file is created, can be opened by a text editor, but does not show any entered text until the VI stops. I need to be able to examine file contents while the VI is executing and can no longer do this.  

 

Attached a simple test vi that replicates this behavior.

 

LV2017, MacOS 10.14.5

 

 

0 Kudos
Message 1 of 7
(2,253 Views)

I am able to see changes to the file while the VI is running. The button "Write now?" is set to "switch until released", so if you unclick your mouse before the button gets read, nothing gets written to the file.

 

Windows 10, LV 2019

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

I am aware of that.  The text is written to the file, and shows up when the vi stops running, so it is being written.  It just is not visible while the vi is executing.  This may be a Mac/WIndows thing, but it has not always been the case for MacOS.  Somewhere in the last couple of years the updates stopped showing up visibly.

0 Kudos
Message 3 of 7
(2,230 Views)
Solution
Accepted by topic author bhales

You might need an occasional flush. 😄

Message 4 of 7
(2,222 Views)

Hi Altenbach,

That's really interesting. I often assumed that writing data throughout a test will guarantee that I have most of my data saved to disk in the event of a crash or power outage, but is that not the case if I don't "flush" or close the file?

0 Kudos
Message 5 of 7
(2,150 Views)

Exactly. I think write cache buffering got introduced in Windows 7 (see here).

 

An explanation of disk IO caching

 

Even in windows 10, you can go to the device manager and change the cache behavior for each disk. Here's the configuration seen for one of my disks. So you can still turn it off for more reliability, but it'll cost you in performance. I think the smart use of "flush file" at key points of execution is probably sufficient.

 

WriteCache.png

 

 

 

Message 6 of 7
(2,140 Views)

That did it.  Thanks!

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