07-26-2022 08:55 AM
Hi there.
I have an application that has two separate exe's. The main program creates TDMS file with data. The second program is a measurement viewer that reads the measurement file concurrently. In the development environment, both of my top level VI's work fine. After compilation with the executables I'm facing problems when I want to read the data.
The main program (TDMS write) leaves the file reference open. In the viewer program the error "-2503" occurs when opening the file.
Is a concurrent access to TDMS files possible from two separate processes/executables? I am using LabVIEW 2020 (32-bit).
Many thanks in advance!
07-26-2022 09:21 AM - edited 07-26-2022 09:44 AM
Can you share some simplified code how you are actually doing things? (For example do you open the file in read-only mode in the second application?)
07-26-2022 09:24 AM
Hi P,
@Wielsch-P wrote:
Is a concurrent access to TDMS files possible from two separate processes/executables?
I guess the answer is "No!"…
TDMS is more than just one big file. And there's a lot of formatting inside to handle all those groups, channels, properties, etc. And still it is made for vrey fast streaming of data to disk…
Accessing a TDMS, which is still written to, is trying to read a file with incomplete formatting information!
@Wielsch-P wrote:
The main program creates TDMS file with data. The second program is a measurement viewer that reads the measurement file concurrently. In the development environment, both of my top level VI's work fine.
This might work because both routines (write/read) belong to the same context (LabVIEW IDE). So they have access to the very same file handling instance and the very same in-memory TDMS data structures.
IMHO it's not a good idea to already open and view a file which is still actively used to store data into…
07-26-2022 09:32 AM
Are you using "open (read-only)" option for your 2nd exe when open the TDMS file?
Each exe is a process in Windows. You can't have 2 exe write to the same file.
Some applications will lock the file when it opens the file. And won't let go even after the file is closed.
LabVIEW is one of them. Another example is Outlook.
07-26-2022 01:55 PM - edited 07-26-2022 01:56 PM
Two separate EXE's opening the same file as read/write will return a Windows File Sharing Violation.
Try opening the file as Read Only in your measurement viewer program.
BTW: It works in the development environment because your VI's are running under one program (labview.exe)
07-27-2022 12:27 AM
Unfortunately I have to spend a little more time to make a simplified code, because the project is relatively complex (with object-based programming). I attached two screenshots from the "TDMS Open".
Yes, I open the file in read-only mode from the second application. In the Write part I leave the reference open.
What solved one of the problems (error -2503) is that I create the file without disabling buffering. Now I can open and read from it, but only the values after the last save, while in the development environment it works (so the values are updated constantly when new values are written to the file).