LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event Structure Event Handling Error with Messenger Channel

I have essentially a producer consumer architecture that uses a messenger channel to trigger events and pass data to the consumer loop. My code started hanging on the event structure. By using the Event Inspector Window (and a lot of break points), I was able to narrow it down to the event structure not handling events as expected. The screenshots below show an example of what I see. In the example, I press the "help"  button, then press the login button. Here's the order of what happens:

  • Press help button
  • Event Inspector Window shows the unhandled help value change event
  • The event structure handles the help button value change then the event moves to the event log
  • The consumer loop processes the help event
  • Press the login button
  • Event Inspector Window shows the unhandled login value change event

So far, so good. Now it gets funky...

  • Event structure doesn't complete execution. The event is still in the unhandled events queue, BUT the consumer loop processes the login event as if the event structure has completed is execution.
  • On the next iteration of the consumer loop, the the messenger channel read VI times out and at that point, the event finally gets handled as shown in the Event Inspector Window

While debugging, I noticed that when the event structure was hung, the highlight execution dots went into the event structure along the channel wire. I realize that channel wires are asynchronous, so the dot's don't really mean anything, but it seems odd that they would be going into the event structure which only contains channel writers, not readers

 

I created a new copy of the VI and ended up deleting and reconnecting the wires that go from the channel writers in the event structure. This has the code working again. When I tried to do the same thing on the original VI, it didn't fix the problem. So the good news is that I have a working version of my code and a broken version that I can use to recreate the problem.

But the question is, has anyone seen this behavior using event structures with or without messenger channel wires?

0 Kudos
Message 1 of 7
(2,320 Views)

I have a lot of experience using Messenger Channel Wires.  I find that user-supplied pictures of parts of their Block Diagrams are so unhelpful that it is a waste of time to view them.  Some of my Projects have literally a hundred different Messenger Channels active, many involving Event Structures.

 

I would be happy to take a look at your VI (or VIs -- if you have a LabVIEW Project containing them, right-click the folder containing the Project, choose Send To, Compressed Folder, then attach the .ZIP file) -- attach them to your Reply, please.

 

Bob Schor

0 Kudos
Message 2 of 7
(2,279 Views)

I'll see if I can simplify it send the project.

0 Kudos
Message 3 of 7
(2,258 Views)

I've attached a simplified version of my code. If you open the event inspector window and run the code, you can see the behavior. If you press help, the event is handled before the help pop-up window is displayed. If you press login, the event isn't handled before the login pop-up window is displayed. This seems like a bug to me. It doesn't cause a problem in this simplified code, but it caused me all sorts of consternation in my full application.

0 Kudos
Message 4 of 7
(2,248 Views)

You don't have to send the whole Project, but you at least need to send the VI that has the Messenger Channel and Event Loop.  Since Channel Wires don't (usually) "migrate" across VIs, the one VI might be enough ...  Sorry to have led you on a chase for Wild Geese ...

 

Bob Schor

0 Kudos
Message 5 of 7
(2,244 Views)

Don't worry, I'll spare you the headache of seeing the whole project. The version I attached in the other post is much simplified but still able to show the event structure oddity.

0 Kudos
Message 6 of 7
(2,242 Views)

Well, there are a lot of broken wires, too many to try running the code.  However, I might have found the problem -- you have a "Mixed-Metaphor Messenger Channel" -- you generate two Messages using Write Messenger with Abort, but the Exit condition is created with Write Messenger.  I haven't tested this to be sure, but I thought that once you define a channel by its Writer, you had to use the same Writer (and the corresponding Reader) everywhere.

 

Try it at your end and let us know!

 

Bob Schor

0 Kudos
Message 7 of 7
(2,236 Views)