Jump to content

VI gets stuck on finish


Recommended Posts

Hello,

I have a problem with quite complex VI. The problem is that when I'm trying to finish (by clicking STOP BUTTON in an event structure) VI gets suspended, CPU ussage goes to 100%. This state can last a few minutes or forever. This behaviour can be seen mainly after long time VI working.

Application was tested under LV 8.2 and 8.21 as .exe and .vi - behaviour is the same.

Thanks in advance for your help.

wbiker

Link to comment

QUOTE(wbiker @ Sep 7 2007, 02:28 AM)

Hello,

I have a problem with quite complex VI. The problem is that when I'm trying to finish (by clicking STOP BUTTON in an event structure) VI gets suspended, CPU ussage goes to 100%. This state can last a few minutes or forever. This behaviour can be seen mainly after long time VI working.

Application was tested under LV 8.2 and 8.21 as .exe and .vi - behaviour is the same.

Thanks in advance for your help.

wbiker

By clicking the stop button on the toolbar you are not stopping the VI but really aborting it. If the program execution was at that point in an external code part you can end up with a locking situation since the external code may wait one some event message processing which will not happen anymore since the whol application was basically taken down brutally. Most NI drivers especially in newer LabVIEW versions are writting in such a way that they get informed by LabVIEW about aborts so that they can abort any waiting, but third party drivers usually don't have that, also because the means to be informed by LabVIEW about aborts are not really documented. But even NI drivers can still sometimes get stuck in such a way.

The toolbar stop button is really just a last measure to abort a program or for quick and dirty testing but should not be used as normal way of starting and especially stopping a LabVIEW program. The LabVIEW program should have some sort of event processing with an explicit quit button in which case the event processing loop (and any other parallel loop that might be running) gets properly terminated after which you can clean up any DAQ, Instrument, IO-Bus, etc operation properly by closing those resources and once the last item on the diagram has executed the program stops too, but this time cleanly.

Rolf Kalbermatter

Link to comment

QUOTE

By clicking the stop button on the toolbar you are not stopping the VI but really aborting it.

I wasn't clear enough, sorry.

My applicattion has special even case to handle the stop action. The problem appears on execution the stop event case.

QUOTE

Show us your code - we really can't diagnose the problem without it.

It is really big application to show the code I would have to present ~200vi's.

Please give me just some ideas what it can be.

Thanks

wgbiker

Link to comment

QUOTE(wbiker @ Sep 7 2007, 04:02 AM)

It is really big application to show the code I would have to present ~200vi's.

Please give me just some ideas what it can be.

Most likely you either call some external code incorrectly when this event occurres or probably also possible you do not close properly some functionality contained in external code which makes it hang. Another possibility is that you have multiple loops in your application and one of them instead of exiting too, starts to run freely without any asynchronous delay function in it anymore.

But without seeing some of your code and preferably a seriously scaled down application that exhibits still this behaviour it is not possible to give you more specific advice.

Rolf Kalbermatter

Link to comment

QUOTE(wbiker @ Sep 7 2007, 07:02 PM)

It is really big application to show the code I would have to present ~200vi's. Please give me just some ideas what it can be.

There's a whole lot of things it could be - really, a lot. Make a little example from scratch - try to encapsulate the issue, then we can help (or you might find that you find the problem yourself).

Link to comment

QUOTE(wbiker @ Sep 7 2007, 02:28 AM)

Hello,

I have a problem with quite complex VI. The problem is that when I'm trying to finish (by clicking STOP BUTTON in an event structure) VI gets suspended, CPU ussage goes to 100%. This state can last a few minutes or forever.

Thanks in advance for your help.

wbiker

Are you using VISA? If you don't specifically close your VISA references that can cause your problem. I know, 'cause it's happened to me.

George

Link to comment

Hello again,

I have found a probem!! (but I still i don't know why it occures:( )

In one of the SubVIs there are dynamic events used in order to refresh Front Panel during the measurement. This solution is used because measurement loop is inside another SubVI.

The problem is that after starting the measurement memory consumption (can be observed in Task Manager) is getting higher and higher (should be almost at the same level) so after 1000-th iteration it is about 150MB. This "memory leak" is the reason why entire application gets stuck at the end.

I simplified the VI I mentioned so it is possible to run it without any hardware, I put it as an attachement.

Could you please look at this and give me some advice.

Thanks in advance

wbiker

Link to comment

QUOTE(wbiker @ Sep 11 2007, 04:57 PM)

Hello again,

I have found a probem!! (but I still i don't know why it occures:( )

Thanks in advance

wbiker

Hi wbiker,

good you already found the memory leak. It made it quite easy for me to find the problem.

You should register for the events outside the while loop.

Now you re-register every time the while loop executes (for every event).

So register before the while loop (and unregister after the while loop)

Ton

Link to comment

QUOTE(tcplomp @ Sep 11 2007, 03:28 PM)

Hi wbiker,

good you already found the memory leak. It made it quite easy for me to find the problem.

You should register for the events outside the while loop.

Now you re-register every time the while loop executes (for every event).

So register before the while loop (and unregister after the while loop)

Ton

Thanks a lot !!!

Now it works fine.

wbiker

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.