Amith M
12/09/2025, 10:08 AMMarvin
12/09/2025, 10:09 AMMarvin
12/09/2025, 10:11 AMexport PREFECT_SERVER_SERVICES_CANCELLATION_CLEANUP_LOOP_SECONDS=60
Trade-off: cancellations cascade a bit more slowly.
- If you don’t rely on cancellation propagation, you can disable it:
export PREFECT_SERVER_SERVICES_CANCELLATION_CLEANUP_ENABLED=false
- Check DB performance:
- Ensure your Postgres has adequate CPU/IO and that autovacuum is running effectively
- Look for slow queries/locks around flow_run/task_run tables
- Advanced: consider additional indexes if you have very large tables and persistent slowness (coordinate with your DBA):
CREATE INDEX IF NOT EXISTS idx_flow_run_state_type_end_time
ON flow_run(state_type, end_time);
CREATE INDEX IF NOT EXISTS idx_flow_run_parent_task_run
ON flow_run(parent_task_run_id, state_type);
CREATE INDEX IF NOT EXISTS idx_task_run_flow_run_state
ON task_run(flow_run_id, state_type);
- Operational patterns:
- Avoid mass cancellation storms when possible
- Reduce extreme fan-out of subflows/tasks if you’re seeing sustained issues
Is it a problem?
- Occasional warnings are typically fine and the service will catch up.
- If the warning is frequent/continuous, it’s a signal to either increase the loop interval or look into database sizing/health.
References
- Service source: CancellationCleanup
- LoopService base and warning: LoopService warning code
- Settings reference:
- CancellationCleanup docs
- LoopService docs
- Server services settings
Quick questions to help us tailor advice:
- What database backend are you using (Postgres version and size), and where is it hosted relative to the API?
- Roughly how many flow runs are you cancelling or completing per hour?
- Is this warning occasional or persistent?Nate
12/09/2025, 5:12 PMThis is usually benignno. this usually means the db is overloaded somehow
Amith M
12/09/2025, 5:34 PM