NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Deadlock when accessing DLL from TestStand over Labview

Hi,
 
I have a problem which is a little bit similar to the problem, you can find under:
 
 
 
Here's what I'm trying:
 
- My Labview application is running parallel to the TestStand flow.
- I send a command from TestStand to Labview, by using a Subvi which accesses a Labview Queue.
- This command initiates a DLL call.
- The DLL is programmed in Visual C and the function I call in it will run in a WHILE loop.
- This loop polls an interface during the whole execution of the Labview application.
- So, the DLL function is active in another Labview thread the whole time.
- Other threads should execute normally in Labview.
 
Here starts the problem:
Exactly in the moment this DLL function is called, a Deadlock occurs in Labview, no other threads in Labview will execute anymore.
The weird thing about this: When I execute the Labview App. without TestStand, everything looks fine. One thread is stucked correctly in the loop of the DLL function and the other LV threads are running as they should.
 
What I do wrong????
 
-----------------------------------------------
I use Labview 8.5 and TestStand 4.0
All DLL calls are reentrant (Run in any Thread)
0 Kudos
Message 1 of 7
(3,973 Views)
Do really all LabVIEW threads lock up, or just the UI thread, which means there would be no User Interface updates?

You could check this by having one thread write to disk continously, for example.

Regards,
Johannes

NI Germany
686730
0 Kudos
Message 2 of 7
(3,955 Views)
Hi Johannes,
 
I am pretty sure that all threads lock up. My UI Thread runs as a statemachine and is completely locked, immediatelly after entering the DLL funtions in the other thread.
 
I have attached a screenshot of the situation. In the lower loop you can see the DLL function, which locks the upper loop (UI thread). No further action is possible after entering the DLL function, wether from the UI or from TestStand. Without the use of TestStand, the upper thread is working normal, if the DLL function is active.
 
Thanks a lot and best begards
0 Kudos
Message 3 of 7
(3,951 Views)

Hi PVV_Ben

Have you tried substituting the While Loop that contains the DLL with a Timed Loop ?
I see similar behavior a couple of times and in that cases using a timed loop solved the issue.

I'm not sure exactly why it works probably it's something connected on how LV allocates threads of while loops Vs Timed Loops.

It cost little and if it solve the problem you're back on the way 🙂

Have a good Day

Filippo

 


 

FiloP
It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong.
Richard P. Feynman
0 Kudos
Message 4 of 7
(3,945 Views)

Hi Filippo,

you're right, your idea helped me out! Thanks a lot!!!!!!!

However now the Dequeue function isn't working properly now: When I enqueue the "Spy" command, the Dequeue VI in the timed loop never gets it!
Maybe I have to play a little bit with the timed loop settings.

Anyway, my biggest problem is fixed! Thanks a lot again!!!!!!

0 Kudos
Message 5 of 7
(3,937 Views)
PVV_BEN,
 
Have you checked your VI's execution system as described in this KB:
 
Sometimes this problem is caused because VI's called through LabVIEW's ActiveX server and set to 'Same as Caller' for execution system automatically run in the UI thread.
Josh W.
Certified TestStand Architect
Formerly blue
0 Kudos
Message 6 of 7
(3,876 Views)
Hi Josh,
 
thanks for your reply. I have found a solution the last days!
 
As you can see on the image, I have two big loops in my VI. Now I replaced them both with the timed loop. Now it works fine!
 
Thanks to all who helped me with the problem!
0 Kudos
Message 7 of 7
(3,864 Views)