PrefectHQ
prefect
BlogDocsChangelog

Fix deployment concurrency slot starvation bug

#19824Closed
Comparing
fix/deployment-concurrency-slot-starvation
(
a88dcb7
) with
main
(
3d56c1a
)
CodSpeed Performance Gauge
0%
Untouched
2
Ignored
6

Benchmarks

Passed

bench_task_decorator
benches/bench_tasks.py
CodSpeed Performance Gauge
0%
464.1 µs463.1 µs
bench_import_prefect_flow
benches/bench_import.py
CodSpeed Performance Gauge
0%
1.4 s1.4 s

Ignored

bench_flow_call[options0]
benches/bench_flows.py
Ignored
CodSpeed Performance Gauge
+3%
170.2 ms165.9 ms
bench_flow_call[options1]
benches/bench_flows.py
Ignored
CodSpeed Performance Gauge
+1%
107.7 ms107.2 ms
bench_task_call
benches/bench_tasks.py
Ignored
CodSpeed Performance Gauge
+2%
32.5 ms32 ms
bench_import_prefect
benches/bench_import.py
Ignored
CodSpeed Performance Gauge
0%
1.1 s1.1 s
bench_flow_decorator
benches/bench_flows.py
Ignored
CodSpeed Performance Gauge
-10%
5.1 ms5.6 ms
bench_task_submit
benches/bench_tasks.py
Ignored
CodSpeed Performance Gauge
-40%
8.5 ms14.2 ms

Commits

Click on a commit to change the comparison range
Base
main
3d56c1a
+0.12%
Fix deployment concurrency slot starvation bug When a flow run is rejected to AwaitingConcurrencySlot state, its scheduled_time was set to now + 30 seconds (concurrency_slot_wait_seconds default). However, workers poll for runs with scheduled_before = now + 10 seconds (prefetch_seconds default). This mismatch caused runs to be invisible to workers for 20+ seconds, and if the slot was still unavailable when finally polled, they'd be rescheduled another 30 seconds out - creating indefinite starvation. Fix: Reduce concurrency_slot_wait_seconds default from 30s to 5s, ensuring runs become visible within the worker's prefetch window. Adds regression tests: - test_enqueued_runs_acquire_slots_after_release - test_enqueued_runs_visible_in_worker_polling_query - test_awaiting_concurrency_slot_visible_within_worker_prefetch_window 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
a88dcb7
17 hours ago
by zzstoatzz
© 2025 CodSpeed Technology
Home Terms Privacy Docs