Home / Background task tracking vulnerability - memory le

Background task tracking vulnerability - memory leaks and lost tasks

created medium manu supervisor 2026-04-01 21:01

Next step: Evaluate this item to determine if it's worth fixing. Or approve directly if you already know what needs to be done.

Location

src/supervisor/web/routes.py:160

Description

In routes.py (lines 160, 184) and dashboard.py (lines 308, 325), background tasks are created with asyncio.create_task() but never tracked or awaited. This causes: (1) No way to know if discovery/health-check actually succeeded, (2) Exceptions are silently swallowed, (3) Tasks can be garbage collected mid-execution if no references exist, (4) No graceful shutdown - tasks will be abruptly cancelled. The API returns 204 No Content immediately, making users think the operation succeeded when it might fail silently. Should use request.app.state to track tasks or use BackgroundTasks from FastAPI.

Evaluation

Click "Evaluate with Claude Code" to have an agent analyze this item.

Actions