LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with ActiveX Callbacks in LabVIEW 7

Have encountered an interesting problem with ActiveX "Reg Event Callback" in LV7 (WinXP):

In a nutshell, when a lot of events fire in rapid succession, the user-interface locks up.

The events still fire, and the front panel controls update, but the front panel will not respond to clicks. Interestingly, if the block diagram is open, you can stop it and turn on execution highlighting, etc...

- I've discovered that the problem we're encountering is related to multiple events firing before the (reentrant) callback VI has finished executing from the 1st event.

- by watching the Performance data in task manager, and tracking the # of handles used by LabVIEW, I find that when this happens, the # of handles increases, b
ut never decreases until you stop the VI

- I would expect several (nearly) instantaneous events to launch multiple copies of that callback VI, and I can believe that would increase the # handles, but I would expect that LabVIEW would catchup shortly thereafter and the # handles would return to its starting count.


As an aside, using the old ActiveX event and callback method with the exact same version of the activeX control does not have this problem, events just queue up and then fire appropriately.

Anyone seen anything like this?
Anyone (NI guys) have any ideas?
Follow up question (NI guys): when will the support for the old ActiveX event stuff dry up?

Thanks in advance,
Ben

Ben Zimmer
bzimmer@meikleautomation.com
Software Developer
Meikle Automation
0 Kudos
Message 1 of 8
(3,852 Views)
> In a nutshell, when a lot of events fire in rapid succession, the
> user-interface locks up.
>

I can't really replicate your problem since I'm responding to these on a
Mac. But the event structure has a Boolean checkbox for Locking the UI
during the processing. This makes sense for UI events, and may
sometimes make sense for User Events. Look for a way to turn off the UI
locking during the processing of the events. Of course this may also be
caused by the ActiveX control needing to run in the UI thread, and it
may be difficult to tell the difference except to experiment with them.

Because the diagram still responds, I expect it to be the locking.
As for the handles, most LV allocations aren't tracked in the
performance monitor. Since th
e handles are cleared up when the VI goes
idle, I suspect that it is the cleanup/garbage collection of LV that is
closing ActiveX references that are being opened and never closed. You
might look around in the reentrant VI or other code in your app for
ActiveX references that may need to be closed explicitly on your
diagrams. If the handles didn't return at idle, it might be more
indicative of a bug in LV.

> Anyone seen anything like this?
> Anyone (NI guys) have any ideas?
> Follow up question (NI guys): when will the support for the old
> ActiveX event stuff dry up?
>

I'd say the dry-up date has something to do with when you and other
users find that the new stuff totally eclipses it.

Greg McKaskle
Message 2 of 8
(3,850 Views)
Hi Ben,

How are you calling the ActiveX "Reg Event Callback"? Are you also using the "Unregister for Event" node?

If the ActiveX event registration is placed inside a loop, this may cause LabView to lock up. If you are using the Unregister for Event node in conjunction with the Register Event Callback node, the problem occurs because the Unregister for Event node and Register Event Callback node are not running in the same thread. Register Callback Event always runs in the User Interface (UI) Thread while Unregister for Event runs in the Execution thread. Deadlock occurs in the unregistration process since the Unregister for Event node will place a lock on a mutex in the Execution Thread and the Register Event Callback node is never seeing that this mut
ex is released in the UI Thread.

The temporary fix is simply to avoid firing multiple events successively. The issue is new to Labview 7.0 and it has been documented in our Labview database.

As far as support the old ActiveX events, there has been no mentioning of phasing that out. As long as the older ActiveX controls continue to exist on future releases of Labview, then support for those controls will continue to exist.

And as always, customer input regarding ActiveX and Labview is always appreciated. Thanks and have a great day!

Kileen Cheng
Applications Engineer
National Instruments
0 Kudos
Message 3 of 8
(3,850 Views)
Hi Kileen and Greg,

Thanks for the responses. As you can see from the attached screenshots, I'm just doing a Reg Event Callback, and the callback VI is extremely simple.

I'm glad the old-style method will stay intact, the attached warning says differently in no uncertain terms.

Regards,
Ben
Download All
0 Kudos
Message 4 of 8
(3,850 Views)
Hi Ben,

The error message warns about the use of three ActiveX Event VIs that will no longer be supported in future versions of Labview. Following version 6 of Labview, the use of ActiveX Event VIs is shifting to the use of Register Event Callback VI instead. In looking at your screenshots, I did not see any use of the older ActiveX Event VIs. If possible, try attaching the actual VI to the post and I will take a look at that.

At least in terms of support, phone support currently exists for Labview 6 and 7. With the release of Labview 8, support for Labview 6 will slowly be phased out. In this case, phone support for the ActiveX Event VIs will no longer continue as they are no longer included in the versions of Labview for
which phone support is provided. However, Discussion Forums and web-based resources would be your best venue of support for those features.

I would strongly recommend that you migrate to replacing ActiveX Event VIs to using the Register Event Callback VI. The following is a KnowledgeBase article describing the transition of ActiveX in Labview:
Migrating from the ActiveX Event VIs to Using the Register Event Callback Node

Also, are you using the Automation Open/Close VIs? These two VIs will allow acquire/release informatio nof the ActiveX object. I have attached a couple example programs that are included in Labview to help demonstrate this concept.

Hope this helps!

Kileen Cheng
Applications Engineer
National Instruments
0 Kudos
Message 5 of 8
(3,851 Views)
Hi Kileen,

Thanks again for the repsonse.

Perhaps I wasn't sufficiently clear in my first post, but example code I posted above demonstrated the problems we're having with the new ActiveX callback method. The old methods work.

We're reverted to the LV6 method (whose code I did not post, but whose warning message I did), and it continues to work fine, running in LV7.

As far as support goes, I'm less concerned about tech support, and more afraid of the old ActiveX methods being removed entirely from LV7++, without the corresponding problems getting fixed first.

Thanks for the examples, I've found those previously, and we're opening and closing the refs properly.

Thanks again,
Ben
0 Kudos
Message 6 of 8
(3,850 Views)
Ben, did you ever solve your problem?


Jeff
0 Kudos
Message 7 of 8
(3,794 Views)
Hi all,

following the thread of Ben, I have a related problem with ActiveX and its new handling with version 7.0 and higher. It concerns those applications where you expect a reply from the callback vi triggered by an ActiveX event. Previously we would have used the "Wait on ActiveX event" to retrieve the Data... what is the new way of handling this data?

Sorry if my explanation is not clear, but I am a complete newbie in this ActiveX thing.

Thank you

GAbriel
0 Kudos
Message 8 of 8
(3,730 Views)