07-23-2026 08:44 AM
Hi everyone,
I'm facing an issue with User Events in my LabVIEW application and would appreciate any suggestions.
.lvlibs).Some events are not being received or The Event which is being received are old events not new events. As a result:
The strange part is that other User Events using the same mechanism work correctly.
.lvlibs?Any debugging tips or suggestions would be greatly appreciated.
Solved! Go to Solution.
07-23-2026 10:22 AM
To Question Nr. 2.
Yes, of course, this is what the event registration and event registration refnum are for.
At the point of event registration, you have defined which object you want to receive events for. Not the point at which you wire it to the event structure, not at the point the loop around the event structure starts to execute.
Check out THIS video from Jack Dunaway to get a better understanding. I think you've got some misunderstanding as to how User Events work.
07-24-2026 05:12 AM
Thank you for your response.
In my application, I create and register all the User Events only once in the Main Launcher during initialization. As shown in the attached block diagram, I call Register For Events there and then pass both the User Event Refnum and the Event Registration Refnum to the different libraries that require them. None of the libraries create or register the events again.
The Event Structure in the consumer library uses the same Event Registration Refnum that was created in the Main Launcher.
07-24-2026 05:34 AM
You are sending the event registration refnum to multiple event structures? That will mean that each event will be received by any one of the event structures, not by all. You are splitting the events over all of your event structures. In order for all the event structures to receive all events, they each need their own event registration refnum.
07-24-2026 05:37 AM - edited 07-24-2026 05:40 AM
Do not use one register events node for all event structures, use one register events node for one event structure.
If you fork the wire and connect it to multiple events structures they will fight each other for the events.
07-24-2026 11:47 AM - edited 07-24-2026 11:57 AM
@UliB wrote:
Do not use one register events node for all event structures, use one register events node for one event structure.
If you fork the wire and connect it to multiple events structures they will fight each other for the events.
Edit: See https://www.youtube.com/watch?v=1uyCfLiqB6I
And here is why. Each Register for user Events creates exactly 1 Event Queue Reference. Similar to creating a filter Event that always discards Events across every Event Structure registered for that Event. The User Event will be processed EXACTLY ONCE across all Event Structure that share the User Event Refnum.
You have accidentally created a queue with 1 source and N readers for your User Event.
You can prove this to yourself by using the Event Inspection Window! That tool is underappreciated but helpful when you repeatedly shoot yourself in the foot.
I won't go so far as to say "Never branch a User Event Refnum Wire!" There may actually be times when you want a single User Event to take an if, then Else action so, LabVIEW allows this syntax. It is on the developer then to ensure exactly 1 Event Structure registered for the same User Event Refnum is actually active.
07-26-2026 08:12 AM - edited 07-26-2026 08:31 AM
@JÞB wrote:
You have accidentally created a queue with 1 source and N readers for your User Event.
You can prove this to yourself by using the Event Inspection Window! That tool is underappreciated but helpful when you repeatedly shoot yourself in the foot.
I won't go so far as to say "Never branch a User Event Refnum Wire!" There may actually be times when you want a single User Event to take an if, then Else action so, LabVIEW allows this syntax. It is on the developer then to ensure exactly 1 Event Structure registered for the same User Event Refnum is actually active.
Actually it is entirely possible to envision creating multiple handlers for the same user event registration. And as long as you don't care which handler is going to handle the event, but simply that exactly one of them is going to do that, it's not a problem. Possible reasons to do so could be that handling a specific event may be a lengthy process but that new events arriving should still be handled timely.
I would be slightly hesitant to do it in this way however as I could imagine that this use case is not very thoroughly exercised and tested and might result in an occasional race condition that could either result in an event being lost, processed twice or maybe a simple crash. The more proper solution would be to have one event receiver that spawns a new self terminating task for each incoming event.
Also, it is an obscure use pattern that future programmers on that application will most likely struggle to understand properly. And that future programmer quite easily could be the original programmer too.
Another gotcha to watch out for is of course about the lifetime of LabVIEW refnums. Creating refnums in a launcher that terminates after the real application got activated is the main problem many users run into when starting to build larger applications. Refnums only survive for as long as the top level VI in whose hierarchy it was created stays active. Once that top level VI terminates, all refnums created in its hierarchy are automatically collected and destroyed. For user events this can be extra problematic since the user event may have been created in such a hierarchy while the user event registration was correctly created in the current hierarchy, but when the original user event gets deallocated the registration is for a now invalid event and never will receive an event again.
Named refnums like Queues and Notifiers can alleviate that problem as the actual object is only deallocated when the last refnum to that object gets deallocated, but User Events and their registration are not named objects.
07-27-2026 02:09 AM
Thank you for the explanation. I have one point I'd like to clarify.
If multiple Event Structures truly share the same Event Registration Refnum, I would expect each generated User Event to be dequeued by only one Event Structure.
However, in my application, I can see that the same User Event is handled by multiple Event Structures, while a few Event Structures never receive it.
Wouldn't this suggest that those Event Structures actually have different Event Registration Refnums (i.e., separate registrations), or is there another mechanism that would allow the same User Event to be delivered to multiple Event Structures sharing a registration?
07-27-2026 02:25 AM
@akash_maxeye wrote:
If multiple Event Structures truly share the same Event Registration Refnum, I would expect each generated User Event to be dequeued by only one Event Structure.
That is a reasonable expectation, but as your experience and Rolf's imagination show, it's not something you can rely on. If you use the output of a register node with more than one event structure, you could get events multiple times or they could disappear. This behavior has been in LV since the introduction of events registration (I believe in LV 7.0, 2003), so I don't expect it will change. There was some work done on events around 2013, but I guess this behavior is still there.
The practical upshot is simple to phrase: Do not connect the output of a Register For Events node to more than one event structure.
Incidentally, you might expect it to appear in the documentation, but I believe the only reference is in a separate article (which is at least linked to from the help for the node) and even there it's kind of hiding in the caveats section at the end and seems to indicate that it's simply a single queue, whereas the actual behavior is more complicated than that:
Wire each Event structure that handles dynamic events to a unique Register For Events function. Branching the event registration refnum wire of a Register For Events function allows multiple Event structures to pull events from one queue, resulting in a race condition that may cause unpredictable behavior.
07-27-2026 02:55 AM
Thank you for the explanation. In my application, the launcher remains running for the entire lifetime of the application, so the User Event Refnums should remain valid.
Also, I've ensured there is sufficient time between consecutive Generate User Event calls.
What I'm observing is that some Event Structures receive the User Event correctly, while a few others never receive that same event. This behavior is consistent.
Given that, would you suspect an issue with the event registration itself (for example, some Event Structures not actually being registered for that specific User Event), rather than the lifetime of the User Event Refnum?
Is there any recommended way to verify that an Event Structure is actually registered for a particular User Event, or to inspect the contents of an Event Registration Refnum for debugging?