FieldPoint Family

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 6 with Open File

My SW is running on a FP2000 with LV7.1. It generates many text files; periodically, the files are opened, a few lines are added, and the files are reclosed. The program runs fine for 15 minutes or so, then suddenly all "Open/create/replace file.vi" start to fail. I debugged them and i saw that it's "Open File" that fails. From now on it will always generate error 6 for every file, existing or new. I debugged the file paths wired to Open File, they're valid, and there's nothing new with name formats, file sizes, file contents, access mode... Also:
- during this condition, FTP server doesn't work: i can browse the FP disk but can't transfer files
- if i stop the program, FTP starts working again
- if i reboot the FP or simply restart the program, all is ok again (for 15 minutes...)
- if i run the same program under windows, i don't experience the problem
- i've already tried to reformat the flash disk
 
help!!!
0 Kudos
Message 1 of 5
(3,997 Views)

typically the situation you describe would arise from some problems in accessing the Drive on the RT Target.

The most likely reason to the problem you are experiencing is that disk space is becoming insufficient after 15 minutes.

I would be very curious to look at your code and see how you programmed this application.

Also, remember that it is very good practice to open a session to a file at the beginning of your logging and keeping it open through the execution of your code. This saves a lot of time to your program.

 

0 Kudos
Message 2 of 5
(3,989 Views)
Absolutely NOT a problem of disk space, there is plenty of it. And if i stop and restart the program it works again with the same disk space!
The code is too complex to show, however there are some parallel cycles with different timings that read the channels and feed the data into arrays; another slow cycle reads and empties the arrays, calculates their mean, SD, etc and writes a statistic data line to the files. Files never get too big, as periodically logging switches to a new file with naming based on date. The bug may start everywhere in the mid of files.
I may optimize the code by opening/closing files only at their creation instead of at every line, but you see, accesses to files are not frequent anyway (probably 1/hour in real applications!), and i'm afraid i may just delay the problem by reducing the number of File Opens...
Do you know where i may find more info on possible "problems in accessing the Drive on the RT Target"?
0 Kudos
Message 3 of 5
(3,986 Views)
As the error comes up after some time the code has been running and it disappears whenever you restart your target, it appears the problem has to do with something that builds up over time.
I suggest you use the Tools>>Realtime System Manager to track what happens on the FP from a Memory/CPU point of view.
Also, try and see what happens with the attached example on your FP. I tested this on mine and it does not seem to cause any problem.
 
 
0 Kudos
Message 4 of 5
(3,974 Views)

Now it works 🙂

I noticed that there was yet another Open/Close pair hidden in a subVI (for testing file existence). I redesigned the program a bit to remove this pair and i haven't met the problem anymore. Still i don't know exactly why it didn't work, however it seems that some combinations of many fast Open/Close may somehow screw up the FP OS even if they're valid.

Grazie per l'aiuto!

0 Kudos
Message 5 of 5
(3,963 Views)