Page 1 of 1

Changing event queue size from default

Posted: Tue Jul 18, 2023 12:57 pm
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?

Re: Changing event queue size from default

Posted: Wed Jul 19, 2023 10:53 am
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

Re: Changing event queue size from default

Posted: Wed Jul 19, 2023 11:07 am
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?

Re: Changing event queue size from default

Posted: Wed Jul 19, 2023 11:31 am
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

Re: Changing event queue size from default

Posted: Wed Jul 19, 2023 12:30 pm
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

Re: Changing event queue size from default

Posted: Thu Jul 20, 2023 11:14 pm
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.

Re: Changing event queue size from default

Posted: Fri Jul 21, 2023 3:52 pm
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