Avatar for the PrefectHQ user
PrefectHQ
prefect
BlogDocsChangelog

Performance History

Latest Results

Add bounded queue for QueueService to prevent OOM during server outages When the Prefect API server is unreachable for extended periods, the in-memory event queue in EventsWorker grows without bound, eventually causing OOM kills in long-running worker processes. This change adds: 1. A `_max_queue_size` class variable on `_QueueServiceBase` (default 0, meaning unbounded) that subclasses can override to set a queue bound. 2. A `try/except queue.Full` in `QueueService.send()` that drops items with a warning log instead of blocking or crashing. 3. A new `PREFECT_EVENTS_WORKER_QUEUE_MAX_SIZE` setting (default 10000) in a new `EventsSettings` model, which `EventsWorker` reads to configure its queue bound. 4. The `reset_for_fork()` method preserves the maxsize when recreating the queue in child processes. The change is fully backward-compatible: existing QueueService subclasses keep `_max_queue_size=0` (unbounded), and users can set the env var to 0 to restore the previous unbounded behavior. Closes #21031
zionts:fix/bounded-events-queue
18 minutes ago

Active Branches

Add bounded queue support to QueueService to prevent OOM during server outages
last run
25 minutes ago
#21033
CodSpeed Performance Gauge
0%
#21028
CodSpeed Performance Gauge
0%
© 2026 CodSpeed Technology
Home Terms Privacy Docs