Jump to content

Event Structure Queue


Recommended Posts

So I just fixed was is probably the nastiest code bug I've ever had in my career. I had an event structure in a user interface that would run all fat and happy for weeks, and then it would get in a mode where it would start taking several minutes to process a front panel input. It would be in this mode for about an hour, then return to normal function again. This bug drove me and my users crazy for months.

Yesterday I finally figured it out. The event structure was processing both front panel events and programmaticaly fired events. Due to a programming bug on my part, sometimes the programic events would fire 100s of times more often then I'd intended. Most of the time, the user interface could keep up with the extra events so I'd never noticed anything was wrong. But if the user performed a ceritan sequence of front panel actions, it would cause a slight bottleneck in the event structure. This would cause a flood of unprocessed programmic events to stack up, slowing everything down. After a while, the event structure would catch back up and everying would be fine again. This was one of those "perfect storm" bugs where a lot of things had to happen in the right order for things to go wrong. I'm pretty happy I figured it out.

So this led me to the question, is there anyway to determine how many unprocessed events are waiting in an event queue? I think this question had come up before, but I couldn't find any threads that answered it.

Link to comment

So I just fixed was is probably the nastiest code bug I've ever had in my career.... Due to a programming bug on my part, sometimes the programic events would fire 100s of times more often then I'd intended.

Just don't let Norm find out you're using Val(Sgnl). ;)

So this led me to the question, is there anyway to determine how many unprocessed events are waiting in an event queue?

There is not currently a method to know how many unprocessed events are in the "Event Queue" of the Event Handler Structure, here's the discussion. But there are a few Ideas (Discard Stale Entries, Event Queue Size Terminal, Register New Refs, Priority, Control Event Buffer) you can vote for to make the "Event Queue" behave more like an Event Queue.

  • Like 1
Link to comment

Just don't let Norm find out you're using Val(Sgnl). ;)

It was nothing like that! Actually I was using the DSC to generate a dynamic event every time the alarm status of a shared variable changed. Normally that would be about 1 event an hour. Unbeknowst to me, the option to generate an event every time the shared variable value changed had been checked on several dozen of those shared variables. I don't remember checking that option, but it must have been me. So when our process was in a rapidly changing state, it generated lots and lots of dynamic events. But since the problem wasn't actually in my code, but in the shared variable configuration, I barked up the wrong tree for months trying to track this down.

There is not currently a method to know how many unprocessed events are in the "Event Queue" of the Event Handler Structure, here's the discussion. But there are a few Ideas (Discard Stale Entries, Event Queue Size Terminal, Register New Refs, Priority, Control Event Buffer) you can vote for to make the "Event Queue" behave more like an Event Queue.

Great info, thanks!

Link to comment
  • 1 month later...

There is not currently a method to know how many unprocessed events are in the "Event Queue" of the Event Handler Structure, here's the discussion. But there are a few Ideas (Discard Stale Entries, Event Queue Size Terminal, Register New Refs, Priority, Control Event Buffer) you can vote for to make the "Event Queue" behave more like an Event Queue.

I have developed my own framework which help me in this scenario. Also it offers complete "loose coupling" making application extension very simple.

see this post http://www.jambhekar.com/blogs/?p=48

Also you can see the monitor app utility which allows you to see which messages are pending for processing

Link to comment

the option to generate an event every time the shared variable value changed had been checked on several dozen of those shared variables.

In a current project I find the event structure bogs down on startup as a bunch of these events gets processed, after a while every goes back to normal and the Event Structure works fast.

I do find this to be a little bit of a performance issue on startup, I need to investigate further tho.

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
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.