LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Very strange issue saving files

I am experiencing a very strange issue saving files and would like to know if anyone else has ever seen anything like this. I have an application which is reading bitmap images from a device and saving them to disk. The call to save the image is "Write BMP File.vi". The application does not get any errors, all filenames are correct yet the file is not seen in the file system. In one case, the files magically appeared about 30 minutes after stopping the application. This looks like the OS is somehow caching or buffering the files before writing them. In other cases the files are never saved to disk. I have seen this on multiple computers. The application used to work flawlessly and nothing was changed with respect to saving the files. Does anyone know of any settings in the OS that may cause this. Our IT department has been rolling out various new policies for our computers. This is extremely frustrating and perplexing. This is the code and as mentioned, no errors are generated. The image is correct and valid. This appears to be some weird behavior or policy on with the file system itself.

 

Save image.png



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 1 of 12
(3,055 Views)

Two places to look come to mind.

 

1) Check the system Event Logs to see if there is a clue as to what is happening.

2) Virus Protection is possibly detecting your code as being harmful and putting a stop to the file writing or taking its own good time analyzing the files to decide if they should be put in quarantene

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 12
(3,040 Views)

That's the craziest thing I have ever heard.

 

The vi you uploaded is missing "TopLevel.lvclass" so I can't run it here to see for myself

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 3 of 12
(3,015 Views)

Yes, this code was part of a large application. I was just posting the code that saves the file so you can see there isn't much there. Probes on the wires show everything is fine yet the files don't get saved. I clearly see it being called and executed with no errors. Even probed the "Write BMP File.vi" and everything is fine there are well. This is very baffling.

 

However, as I mentioned our IT department keeps rolling out esoteric policies that cause strange issues on our computers.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 4 of 12
(3,013 Views)

+1 for antivirus issue. Can you try it on a pc that does not have the company profile or on a VM? 

 

Just a hunch, try unplugging the network cable. I once had issues with writing files locally (took long time, although not that long) when the network cable was plugged in to a specific company network. The client had a specific antivirus policy setting when connected to that network but not to another.

Certified LabVIEW Architect
0 Kudos
Message 5 of 12
(2,830 Views)

What if you check for file existence after writing?

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 6 of 12
(2,810 Views)
Does Your Company use OneDrive? I've seen some strange behavior with files that took ages to synchronize from the folders selected to upload to OneDrive.
Don't forget to rate a good Answer....
---------------------------------------------------------
Here should be some cool signature

But there's NOT

LabVIEW 2012-2017
---------------------------------------------------------
0 Kudos
Message 7 of 12
(2,700 Views)

"What if you check for file existence after writing?"

 

I would not count on that to work since the OS can be delayed in updating the directory.

 

I recall pounding "f5" to force updates.

 

There was yet another time I had to use a hack to write pdf files and I had to implement a loop to keep checking to see when the file actually showed up.

 

Generally speaking...

 

The services provided by the OS are a lot like eating at a fancy eatery. Nothing happens fast.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 8 of 12
(2,685 Views)

@Ben  ha scritto:

"What if you check for file existence after writing?"

 

I would not count on that to work since the OS can be delayed in updating the directory.

 

I recall pounding "f5" to force updates.

 

There was yet another time I had to use a hack to write pdf files and I had to implement a loop to keep checking to see when the file actually showed up.

 

Generally speaking...

 

The services provided by the OS are a lot like eating at a fancy eatery. Nothing happens fast.

 

Ben


Actually it wasn't a suggestion, just a simple question.

Since the write does not generate any error, I was curious to know whether a check like this could also be cheated...

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 9 of 12
(2,681 Views)

Modern computers and disk interfaces are pretty quick so it could be hard to catch it.

 

But if you look under the hood, as soon as we pass data to be written to disk, the "write" part of our code is done but the disk sub-system still has to allocate space on the hard-drive, move the positioner to the correct cylinder, wait for the rotational latency to get the correct sector under the heads and write the data, mark the file as closed, doe the same to update the directory file.

 

Which reminds me!

 

Disk Caching?

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 10 of 12
(2,661 Views)