LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Second Thread running under RunUserInterface generates sporadic GPF

Hello Danut81,

I ran the example you posted at least 40 times and never saw a general protection fault.  When you run the example and get the crash can you go to Run>>Threads... and see what functions the threads are in? 
Kristen
National Instruments
0 Kudos
Message 11 of 20
(1,983 Views)

The main thread is in ProcessSystemEvents and the secondary in the RunUserInterface.

If it doesn't crash from inside CVI try to run the .exe outside CVI. In my case it crashes from both sides.

I attach now my compiled .exe. Try to run it to and see if GPF occurs.

 

 

 

 

0 Kudos
Message 12 of 20
(1,973 Views)
I had got this error in my application, when I tried to release some threads that I createrd dynamically.

Just before to release the thread I added the command:
CmtWaitForThreadPoolFunctionCompletion

So it works.


0 Kudos
Message 13 of 20
(1,956 Views)
Danut81,

Your executable did not crash for me either.  Did you try Oliveira's suggestion?
Kristen
National Instruments
0 Kudos
Message 14 of 20
(1,926 Views)
Hi,
 
I don't hink that adding CmtWaitForThreadPoolFunctionCompletion will help me because the treads causes  the GPF while running not while i 'm trying to finish the thread.
I have tested the application on 4 computers and finally it had crash. How many times you have runed the application?
 
Sometimes it takes  more than 20 times to run it until it crashes. Try to run it a few times from Cvi and the run it from outside CVI.
Set the Sleep Policy is set to Sleep More while you run it from CVI.
 
I have added a test.bat file in the archive so it can run automaticaly the program. Run test.bat, i'm sure in the end it will crash.
0 Kudos
Message 15 of 20
(1,912 Views)
Hi,

I let it run at least 40 times and never saw a crash.  Do you only see the crash on one computer, and are unable to do it on the other 3? 
Kristen
National Instruments
0 Kudos
Message 16 of 20
(1,880 Views)

Hello,

On 4 computers that i made the test  the application crashed. I also tested on 1 computer with CVI 8.1 and againg it crashed.

So, i guess it is not a problem on my system that generates the fault.

0 Kudos
Message 17 of 20
(1,872 Views)
I had a colleague run your program and he was able to get it to crash.  I'll ask around and see if anyone else know what could be causing this problem.
Kristen
National Instruments
0 Kudos
Message 18 of 20
(1,839 Views)
Has anyone found a resolution to this issue? I'm having a similar problem with a program that is constructed in the same manner but in CVI 8.0.1. My application crashes occationally on the RunUserInterface but not everytime and it only crashes once I spawn a new thread which calls ProcessSystemEvents in a while(!quit) loop. Other times it fails when calling CVI table functions (InsertTableRows, GetNumTableRows). If I remove these table functions the application will crash at RunUserInterface most of the time.
 
Thanks,
Craig
 
 
 
 
0 Kudos
Message 19 of 20
(1,480 Views)
Hello Craig,

It sounds like from your post that there are a number of reasons that could be causing your different crashes.  Usually we see something happening when threads are not carefully managed.  Are you able to narrow down your program to something small that reproduces the crashes some of the time.  If you can, post your project here and I'll take a look at it.
Kristen
National Instruments
0 Kudos
Message 20 of 20
(1,429 Views)