LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help me determine why this program locks up

This is a simple program using Agilent 34970A data loggers. It simply scans the data loggers every five minutes and store the results in a set of files. I have been using these data loggers with Lab View for years and never ran into a problem like this.

 

The compiled program will run hours to days then just lock up. No errors are reported or displayed. It requires a complete shutdown and restart of Windows (XP-SP3) to run it again.

 

I have tried different 34970A's, different cards in the 34970A's, different USB to Serial converters, different serial cables, a powered USB hub, and, a different computer.

 

So since I have replaced every single piece of hardware in the test setup it leaves only the software. I have updated VISA and LabView runtimes on the target machine to the latest releases.

 

The program does seem to always lock up on an instrument scan.

 

Please look at the attached vi's, I believe I have included all the required sub vi's and instrument lib. If you discover anything missing just reply and I will attach it.

 

The program is fairly simple but there are a few extraneous things that I have added for troubleshooting, that normally would not be in there. Feel free to critique, this is certainly not the best work I have ever done but I can take the criticism.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 1 of 6
(2,121 Views)

When I run into lock ups like this which I can't figure out, I usually put logging code into the code. This tells you what things happened and when the program will get stuck, you can see what the last thing that happened was and try to figure out from that what the problem is.

 

If you're going to have a lot of data, set it up so that a new file is created every hour (or every minute, or whatever interval is reasonable). Also, make sure you write each line to the file immediately, because it's important not to lose the data when the program gets stuck.

 

As for specific things in the program, I didn't see anything obvious, other than the potential for the HW calls to get stuck. There is a while loop in the Scan Now subVI, but I don't think there's a case which can cause it to loop endlessly, unless maybe you get a malformed string.

 

Another thing to check is that memory isn't been gobbled up by the app, but it doesn't sound like this is your case.


___________________
Try to take over the world!
0 Kudos
Message 2 of 6
(2,108 Views)

RTSLVU,

I looked over your VI and noticed that you are opening multiple files at a time and storing all of the referencing in an array. Do you have an eatimate of the number of files you have open at one time? It is a good practice to close a file before opening another one. How often does your program go to the close or error state? Try running your VI and manually stopping it with a stop button in your while loop and see if you get an error. I hope this helps.

Regards,
Michelle Gilliard
Applications Engineer
National Instruments

Michelle G
Applications Engineering
National Instruments
0 Kudos
Message 3 of 6
(2,081 Views)

@Michelle_G wrote:

RTSLVU,

I looked over your VI and noticed that you are opening multiple files at a time and storing all of the referencing in an array. Do you have an eatimate of the number of files you have open at one time? It is a good practice to close a file before opening another one. How often does your program go to the close or error state? Try running your VI and manually stopping it with a stop button in your while loop and see if you get an error. I hope this helps.

Regards,
Michelle Gilliard
Applications Engineer
National Instruments


There are five data files opened when the program starts. These files remain open as each file is written to every five minutes. Before each scan of the 34970A's the week number is checked, if it is not equal to what is was when teh files were opened, the currently open data files will be closed and new ones opened. This test is intended to run for several months. I do not want too many data files to deal with so I decided on one week of data per file.

 

Are you saying I should open and close each file one by one everytime I write to it?

 

I doubt this is a file handle problem and memory usage is constant for the last 24 hrs. at  around 36,884k so if it's a memory leak, it's a awfully slow one...

 

I put a counter in the error case, and some stuff to reset the comm ports. But the error counter is always zero when it crashes. I also have an indicator that showes the current stage. It seems to always lockup in the "scan" state, I do not get a VISA timeout error but I have to reboot Windows to get LabView or even NI-MAX to see the instruments after a lockup.

 

This leads me to believe it is a comunication or VISA problem.

 

I have lowered the baud rate to 9600 in a recent revision and am waiting...

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 6
(2,073 Views)

@RTSLVU wrote:
I also have an indicator that showes the current stage. It seems to always lockup in the "scan" state, I do not get a VISA timeout error but I have to reboot Windows to get LabView or even NI-MAX to see the instruments after a lockup.

 

This leads me to believe it is a comunication or VISA problem. 


That sounds reasonable, but not absolute. My suggestion was to log at a higher resolution (up to before and after every function in the code).


___________________
Try to take over the world!
0 Kudos
Message 5 of 6
(2,066 Views)

@tst wrote:

That sounds reasonable, but not absolute. My suggestion was to log at a higher resolution (up to before and after every function in the code).


 

Yeah, I understand that. I am hoping lowering the baud ratefixes it before I get ugly with the logging.

That will definantly be my next step.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 6 of 6
(2,062 Views)