Jump to content

Error -2539 trying to open multiple references to the same TDMS file with the Advanced TDMS palette.


Recommended Posts

Hi guys,

 

So I have an application that uses TDMS for data-logging. There's a continuous memory leak as I write new data. It's alleviated somewhat by setting disk cache high for each channel, but as I'm acquiring data continuously over long periods of time, this isn't a great long-term solution.

 

I've tried switching over to the Advanced TDMS palette, but I'm having a lot of trouble getting an implementation going. A single TDMS file is accessed concurrently by multiple processes. Ideally, I want each process to open its own reference to the file. This wasn't a problem with the standard TDMS palette, but I'm getting errors with the Advanced palette.

 

For example, error -2539 states:

 

"LabVIEW:  This file cannot be written to, because it is opened and locked by another thread or process. This typically happens when a file is written by a hardware driver, for example NI-DAQmx."

 

Is concurrent access not allowed in the "Advanced" palette? Or do I need to do additional work in the Open step to allow concurrent access?

Link to comment

You wouldn't happen to be writing 2D data and performing a transpose before the write?  And on version I think 2011 or older?

 

http://forums.ni.com/t5/LabVIEW/WARNING-TDMS-memory-leak-in-LV-2010/td-p/1874575

 

That was a nasty one that got me all the time.  If you can isolate it like that user we can get NI working on it, or testing it on different versions of LabVIEW.  What version are you using for this by the way?

Link to comment

You wouldn't happen to be writing 2D data and performing a transpose before the write?  And on version I think 2011 or older?

 

http://forums.ni.com/t5/LabVIEW/WARNING-TDMS-memory-leak-in-LV-2010/td-p/1874575

 

That was a nasty one that got me all the time.  If you can isolate it like that user we can get NI working on it, or testing it on different versions of LabVIEW.  What version are you using for this by the way?

 

I've nearly abandoned TDMS for these reasons except for in special cases.

Link to comment

I've nearly abandoned TDMS for these reasons except for in special cases.

It has issues for sure, but it is my preferred file format for the majority of the test software I write.  And NI keeps investing in it.  It seems every version of LabVIEW has some new TDMS functions under the advanced palette.  Few I actually use but still.

Link to comment

That was a nasty one that got me all the time.  If you can isolate it like that user we can get NI working on it, or testing it on different versions of LabVIEW.  What version are you using for this by the way?

 

No, I'm trying to write each channel separately as a 1D array, using the "Set Next Write Position" function to select channels.

 

I'm using 2013SP1.

 

Let's make some (very) basic troubleshooting: have you used Advanced Open with "enable asychronous?" = TRUE? And then used VIs from TDMS Advanced Asynchronous Pallete to read/write in all your processes?

 

Yes, asynchronous is set to True and I'm using the Advanced palette for all subsequent read/writes.

 

For now I've given up on trying to use multiple references and am just trying to get a single reference to work. Even here I'm running into problems.

 

I'm using the Advanced TDMS palette to create an on-disk circular buffer. I was able to successfully implement the buffer for a single channel of data.
 
However, when I try to write multiple channels of data, I continuously get "End of File Encountered" error 4. I am pre-allocating 60,000 data points for each channel using the "TDMS Set Channel Information" function.
 
I am able to (1) Set Next Write Position and (2) perform an Asynchronous Write to the first channel. But when I try to Set Next Write Position to the second channel, I immediately get an error 4.
 
The examples have not been helpful as none of them write to different channels in sequence. 
Link to comment

Named WF Array Project.zip

 

I created a project that demonstrates what I'm trying to do and the error. I'd really appreciate it if someone familiar with the Advanced TDMS palette could take a look.

 

This was coded in 2013SP1. If you need it back-converted, let me know.

 

Sorry about the file hierarchy, the project is located here:

 

Workspaces\V12000\_V12000 Common Labview Code\Named WF Array\Named WF Array.lvproj

Edited by Mike Le
Link to comment

Hi, I struggled quite a bit with it too but now everything works really nice, so let's see if I can help. There is a disable structure, should I look at the enable or disable case? In case it's the enable one, can you make a simplified version that has all the TDMS code in one VI and demonstrates what you're trying to achieve on the TDMS side only?

Link to comment

Unfortunately I didn't manage to dig deep into your code since a lot of it is beyond the scope of TDMS. However here is how my architecture works, in case it can inspire you:

 

Writer side:

  • Create file with
    • Disable Buffering = False
    • Asynchronous = False (I use Synchronous R/W)
  • Set Channel Information (couldn't find this one on your diagram but again I didn't look everywhere)
    • Channel names : the number of rows my 2D Array has in a write operation
    • Samples per channel = how many samples for each channel at each write operation (number of columns my 2D Array has)
  • Write using a 2D array that I don't need to transpose since it's built to have channels = rows and samples = columns (Advanced Synchronous Write)

 

Reader side:

  • Open file with
    • Disable Buffering = False
    • Asynchronous = False (I use Synchronous R/W)
    • Operation = Open (read-only) --> I think this is where you'll get an error if you don't open it in read-only
  • Read data using
    • Set Next Read Position
    • Advanced Synchronous Read

Edit: and of course both the reader and writer can perform their tasks on the same file simulateously

Edited by Manudelavega
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.