what is Task queue depth

k7dq

Member
Premium Subscriber
Joined
Dec 22, 2016
Messages
19
Location
Clinton, Ut
I have loaded the new UI version of boatbod OP25 multi_rx.py (raspberrypi bookworm os). I have noticed something new showing up in stderr.2. I have -v 2 (and previously -v 5).
Task queue depth is 1. (Or 2).
what are these messages for and why so many (even in -v 2) ?
I would think it wouldn’t be necessary for -v 2 or even -v 5

ps. I do like the UI.
 

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
1,100
Location
NE Wisconsin
I have loaded the new UI version of boatbod OP25 multi_rx.py (raspberrypi bookworm os). I have noticed something new showing up in stderr.2. I have -v 2 (and previously -v 5).
Task queue depth is 1. (Or 2).
what are these messages for and why so many (even in -v 2) ?
I would think it wouldn’t be necessary for -v 2 or even -v 5

ps. I do like the UI.
I have 10 instances of multi_rx.py with the new UI running on GR3.8 and GR3.10 Linux systems that haven't logged any such messages.
However, none of them are on Raspbian Bookworm. It begs the question if this might be specific to Bookworm?

Perhaps @boatbod will chime in?
 
Last edited:

boatbod

Member
Joined
Mar 3, 2007
Messages
3,500
Location
Talbot Co, MD
I've not experienced the messages you've seen, but a cursory google search suggests they might be related to python's waitress module, which op25 uses to provide the http server for the terminal.

and

Is this a particularly slow or low-memory machine you are running op25 on? Possibly it's not keeping up with terminal demand even though it only polls on 1 second intervals.
 

k7dq

Member
Premium Subscriber
Joined
Dec 22, 2016
Messages
19
Location
Clinton, Ut
Ahh, this is running on a Raspberrypi 3 which isn’t a fast machine compared to the 4 or 5 and memory is smaller. I also converted it from 32bit to a 64 bit OS. I will have to see if I get the same messages if I run it on a pi4.
 

k7dq

Member
Premium Subscriber
Joined
Dec 22, 2016
Messages
19
Location
Clinton, Ut
Did some more testing. On the pi4 no Task queue messages as long as I didnt have the web page up, but as soon as I started the web page, I got a bunch of the queue messages. The messages stopped when I switched to Legacy UI.
same behavior with the pi3, no queue messages until I started a web browser. And of course they stop when going to Legacy UI.
 

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
1,100
Location
NE Wisconsin
Did some more testing. On the pi4 no Task queue messages as long as I didnt have the web page up, but as soon as I started the web page, I got a bunch of the queue messages.
I have a few PI-4B's running boatbod op25 on the NEW UI that are solid. I would look to the Micro-SD card's that you're using as most likely having substandard read/write speeds. BTW, just assisted another op25 user with the NEW UI about a week ago where we did some initial testing using his Raspberry Pi-3B+ that worked well on the NEW UI once we tested and selected a decent Micro-SD to flash.

Although there are a number of programs available for testing SD and USB media, I have been using, and have had great results using
Check Flash for my testing. See the screen capture below comparing a SanDisk Ultra against a SanDisk Extreme Micro-SD.

SanDisk Ultra 32 GB (Very slow write speed with marginal read speed)

SsnDisk Ultra.png
SanDisk Extreme 32 GB (Very fast read/write speeds. Works great with OP25 NEW UI)

SanDisk Extreme.png
 
Last edited:

k7dq

Member
Premium Subscriber
Joined
Dec 22, 2016
Messages
19
Location
Clinton, Ut
Well my pi4 has an ultra Sandisk 64bit and my pi3 has a Samsung evo 32bit. Which when tested has a write speed around 18mb/s.
i had already ordered some new ”Raspberrypi“ recommended SD, and will test again when I get them.
 

dave3825

* * * * * * * * * * * *
Premium Subscriber
Joined
Feb 17, 2003
Messages
9,451
Location
Suffolk County NY
For kicks, I asked Grok, who responded with this.

In the context of **boatbod's OP25** (a fork of the OP25 software for decoding P25 digital radio signals), the **"Task queue depth"** messages appearing in the `stderr.2` log file typically indicate warnings from the **Waitress** web server, which is used to serve the web interface for OP25. These messages reflect the number of pending tasks (requests) in the server's queue, often due to high load or slow processing of HTTP requests.

### Explanation of Task Queue Depth
- **Task queue depth** refers to the number of tasks (e.g., HTTP requests for the web interface, such as fetching constellation plots or other data) that are queued up in Waitress, waiting to be processed.
- A depth of **1 or 2** (as noted in your query) suggests a minor backlog, where the server is slightly overloaded or struggling to keep up with incoming requests.
- These messages are logged when the Waitress server's task queue exceeds a certain threshold, often due to:
- **High verbosity (-v 2 or -v 5)**: Higher verbosity levels generate more log output, which can increase processing demands and contribute to queuing.
- **Resource constraints**: Running OP25 on a Raspberry Pi (e.g., with Raspbian Bookworm) may lead to performance bottlenecks, especially if multiple instances of `multi_rx.py` or other processes are active.
- **Web interface load**: Frequent requests to the OP25 web interface (e.g., refreshing plots or accessing logs) can overload the server, especially on low-powered hardware.
- **Specific to Bookworm?**: Some users have noted these messages appear more frequently on Raspberry Pi OS Bookworm, possibly due to changes in the OS, Python, or Waitress versions, though this is not confirmed.[](https://forums.radioreference.com/threads/what-is-task-queue-depth.488131/)

### Why Are These Messages Appearing?
1. **Verbose Logging (-v 2 or -v 5)**:
- With `-v 2` or higher, OP25 logs more detailed information, including task queue depth warnings from Waitress. These warnings may not be critical but appear frequently because the server is logging every instance of a non-zero queue depth.
- Even at `-v 2`, the system may log these messages if the web interface is accessed or if background tasks (e.g., plot generation) are queued.

2. **Performance Bottlenecks**:
- On a Raspberry Pi, especially older models like the Pi 3B+ or Pi 4, the CPU and memory may struggle to handle multiple tasks, such as decoding P25 signals, running the web server, and processing HTTP requests.
- If you’re running multiple instances of `multi_rx.py` or monitoring multiple streams, this can exacerbate the issue.

3. **Waitress Server Behavior**:
- Waitress is a lightweight WSGI server used by OP25 to serve the web interface. It logs task queue depth warnings when it cannot immediately process all incoming requests, which is common under load.
- For example, errors like `WARNING:waitress.queue:Task queue depth is 1` have been reported in logs alongside other issues, such as HTTP 404 errors for missing plot files or exceptions when serving streams.[](https://forums.radioreference.com/threads/op25-new-release-channel-0-errors.431687/)[](https://forums.radioreference.com/threads/new-release-other-warnings.431847/)

4. **Bookworm-Specific Issues**:
- Some users have speculated that the issue might be specific to Raspberry Pi OS Bookworm due to changes in the OS or dependencies (e.g., Python 3.11 or GNU Radio versions). However, users running OP25 on other Linux distributions (e.g., Ubuntu with GNU Radio 3.8 or 3.10) report fewer or no such messages, suggesting a possible compatibility or configuration issue with Bookworm.[](https://forums.radioreference.com/threads/what-is-task-queue-depth.488131/)

### How to Address Task Queue Depth Warnings
Here are some steps to reduce or eliminate these warnings:

1. **Reduce Verbosity**:
- Lower the verbosity level by using `-v 1` or `-v 0` instead of `-v 2` or `-v 5`. This reduces the amount of logging and may suppress task queue depth warnings unless they indicate a serious issue.
- Command example: `./multi_rx.py -c config.json -v 1 -U -l http:0.0.0.0:8080 2> stderr.2`

2. **Optimize System Resources**:
- **Check CPU/memory usage**: Use `top` or `htop` to monitor resource usage on your Raspberry Pi. If the system is overloaded, consider reducing the number of `multi_rx.py` instances or streams.
- **Upgrade hardware**: If feasible, use a more powerful device (e.g., a Pi 5 or a PC) to run OP25, as low-spec hardware can contribute to queuing issues.[](https://github.com/boatbod/op25/issues/28)
- **Close unnecessary processes**: Ensure no other heavy processes are running alongside OP25.

3. **Limit Web Interface Usage**:
- Reduce the frequency of web interface refreshes or plot requests (e.g., constellation plots). These can generate significant load on the Waitress server.
- If you don’t need the web interface, disable it by omitting the `-l http:0.0.0.0:8080` option in your command line.

4. **Check for Errors in Logs**:
- Review the full `stderr.2` log for additional context. Look for errors like `404` (missing files), `IOError`, or `SystemExit`, which may indicate issues with the web server or file paths.[](https://forums.radioreference.com/threads/new-release-other-warnings.431847/)
- Share a snippet of the log (as suggested by forum users) to confirm the exact text and context of the task queue depth messages.[](https://forums.radioreference.com/threads/what-is-task-queue-depth.488131/)

5. **Update OP25 and Dependencies**:
- Ensure you’re running the latest version of boatbod’s OP25. Update the repository using:
```bash
cd ~/op25
git pull
./rebuild.sh
```
- Check for compatibility issues with GNU Radio (e.g., 3.8 or 3.10) and Python versions on Bookworm. If using GNU Radio 3.10, ensure you’re on the `gr310` branch: `git checkout gr310`.[](https://hagensieker.com/2023/03/31/op25-revisited/)

6. **Tune Waitress Configuration**:
- Waitress can be configured to handle more simultaneous connections or adjust its thread pool. This requires modifying the OP25 source code (e.g., `http_server.py` in `op25/gr-op25_repeater/apps`).
- Example: Increase the number of threads by adding `--threads 10` to the Waitress server initialization (requires code modification).
- Alternatively, investigate if Waitress is misconfigured or if a newer version resolves the issue.[](https://stackoverflow.com/questions/55857058/how-to-find-the-cause-of-task-queue-depth-warnings-from-waitress)

7. **Test on a Different OS**:
- If the issue persists, test OP25 on a different Linux distribution (e.g., Ubuntu or an older Raspberry Pi OS like Bullseye) to determine if the problem is Bookworm-specific.
- Users have reported fewer issues on non-Bookworm systems, though this may require reinstalling OP25.[](https://forums.radioreference.com/threads/what-is-task-queue-depth.488131/)

### Are These Messages a Problem?
- **Minor Issue**: A task queue depth of 1 or 2 is typically not critical and may simply reflect normal operation under load, especially with verbose logging enabled. It’s more of a warning than an error.
- **Potential Concern**: If the queue depth grows significantly (e.g., 10 or higher) or is accompanied by crashes, audio dropouts, or web interface failures, it could indicate a deeper issue with system performance or configuration.
- **Context Matters**: If OP25 is otherwise decoding audio correctly and the web interface is responsive, these warnings can likely be ignored or mitigated by reducing verbosity.

### Additional Notes
- **Boatbod’s OP25**: This fork is optimized for low-power hardware like Raspberry Pi and supports features like TDMA control channels and multi-stream setups. However, its web interface and Waitress server may not handle high loads as gracefully as the Osmocom fork, which has a more polished GUI but different trade-offs.[](https://forums.radioreference.com/threads/op25-boatbod-update.430476/)[](https://forums.radioreference.com/threads/op25-boatbod-web-gui.468867/)
- **Community Support**: The RadioReference forums and GitHub issues for boatbod’s OP25 are active. If the issue persists, consider posting on RadioReference with a detailed log snippet or opening an issue on the boatbod/op25 GitHub page, referencing the task queue depth warnings.[](https://forums.radioreference.com/threads/what-is-task-queue-depth.488131/)[](https://github.com/boatbod/op25/issues/28)
- **Further Diagnosis**: To diagnose the root cause, you could:
- Enable more detailed Waitress logging (modify `http_server.py` to increase `log.level`).
- Use a tool like `strace` to trace system calls and identify bottlenecks.
- Monitor network traffic to the web interface using `tcpdump` or `wireshark`.

If you provide a specific log snippet or additional details about your setup (e.g., hardware, command line, or other errors), I can tailor the advice further. Let me know if you need help with any of the above steps!
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,500
Location
Talbot Co, MD
If you feel adventurous, you might try editing http_server.py line 147 and add a threads=10 after port=my_port
I don't know if that will help, but the default is 4 threads.
Code:
        try:
            self.server = create_server(application, host=host, port=my_port, threads=10)
 

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
1,100
Location
NE Wisconsin
Another suggestion... Unless you're specifically using a Raspberry Pi-5 that requires Raspbian Bookworm for hardware support, just reflash it with Raspbian Bullseye and be done with it! In fact, the 'Lite' version would be desirable if you're dedicating the Pi as a P25 TRS scanner
that will largely be run headless. Doing so will avoid having to deal with Pulse Audio or Pipe Wire sound subsystems too boot.
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,500
Location
Talbot Co, MD
Coincidentally I started a second instance of multi_rx on my development machine tonight and started seeing multiple task queue depth messages. Inserting "threads=6" (in the manner suggested above) made them stop, so I pushed that as general update. Ideally I guess this should be a configurable parameter, but lets see how things work out.
 

k7dq

Member
Premium Subscriber
Joined
Dec 22, 2016
Messages
19
Location
Clinton, Ut
I modified http_server.py on rpi4 to threads=10 as suggested in a previous note. I am no longer seeing the Task queue depth messages. After seeing the new note of threads=6, I too changed and I am also not seeing the messages.
Thanks for all the suggestions.
 
Top