Changing event queue size from default

Comments & issues
Post Reply
Rhybot
Phidgeteer!
Posts: 52
Joined: Wed Aug 14, 2019 4:58 pm
Contact:

Changing event queue size from default

Post by Rhybot »

viewtopic.php?t=10514 asks if events are handled serially, and they are sequentially handled per-channel. It also says the event queue size is 200.

Just wondering, is it possible to change the event queue size away from 200? For example, set to 1000?
User avatar
Patrick
Lead Developer
Posts: 634
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: Changing event queue size from default

Post by Patrick »

It's not configurable without rebuilding the library.

If you are filling the internal queue, you'll see an error event on your channel with type EEPHIDGET_DISPATCH. A bigger queue probably isn't the right solution - if you are doing blocking work in the event handlers, it would be better to move that work to another thread. When we want to deal with high data rates in the control panel, or internal tests, we generally fill a queue in the event handler, and then deal with the data in chunks from another thread.

-Patrick
Rhybot
Phidgeteer!
Posts: 52
Joined: Wed Aug 14, 2019 4:58 pm
Contact:

Re: Changing event queue size from default

Post by Rhybot »

Hi Patrick,

Thanks for the suggestion, and actually already have long-running tasks run on a thread. Yes, I don't fully understand why my queue is filling up, so I am just looking at all options. I am getting the EEPHIDGET_DISPATCH error:

```txt
Phidget API emitted an error event with error event code 4 and error event description 'Current Input Ch:0 -> DAQ1400 -> HUB0000 Port:0 S/N:562433: Event queue is full; dropping event(s). Make sure data event handlers are fast and non-blocking, or reduce data rate.'.
```

> without rebuilding the library

Out of curiosity, how can one rebuild the library? Are there docs on this somewhere?
User avatar
Patrick
Lead Developer
Posts: 634
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: Changing event queue size from default

Post by Patrick »

You can build from source if you are on Linux - we don't distribute the full source for Windows or macOS.

What's your environment? OS? Language? GUI or console app? There is usually a solvable reason for dropped events.

-Patrick
Rhybot
Phidgeteer!
Posts: 52
Joined: Wed Aug 14, 2019 4:58 pm
Contact:

Re: Changing event queue size from default

Post by Rhybot »

Sounds good on not distributing Windows or macOS source. In my use case, I am using Python 3.11 with Phidget22 package on Windows 10, with about 10 Phidgets connected running an instrument.

I think I have a multithreading issue somewhere in my application code such that one of the event handlers gets hung up or delayed too long over time (the queue randomly just fills up on day 2 or 3 of a run). I am separately investigating possible reasons for a multithreading issue.

If you have any suggestions, I am open to them :D
Rhybot
Phidgeteer!
Posts: 52
Joined: Wed Aug 14, 2019 4:58 pm
Contact:

Re: Changing event queue size from default

Post by Rhybot »

https://www.phidgets.com/downloads/phid ... s/windows/

In phidget22-fullsource, there seems to be the full source. Is that the current version underlying Phidget22?

I am wondering if I can change the queue size there, and somehow rebuild with a bigger queue size.
User avatar
Patrick
Lead Developer
Posts: 634
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: Changing event queue size from default

Post by Patrick »

hi,

contact me at patrick@phidgets.com

I can send you the source, or get you a custom build.

That download is a very old copy of the library from 2018.

-Patrick
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests