fix(monitoring): break infinite loop on invalid UPID parsing
All checks were successful
Backend Tests / pytest (Python 3.12) (push) Successful in 47s
All checks were successful
Backend Tests / pytest (Python 3.12) (push) Successful in 47s
When Proxmox API returns 400 "unable to parse worker upid", the monitoring
worker was getting empty status {}, treating it as running, and retrying
forever every 5 seconds, causing 100% CPU and log spam.
Now when get_task_status() returns empty dict, we immediately mark the task
as failed with exit_status="Invalid UPID" and move on instead of looping.
Fixes production deployment hang.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -945,7 +945,20 @@ class MonitoringWorker:
|
||||
|
||||
# --- status -----------------------------------------------
|
||||
proxmox_status = client.get_task_status(task.node, task.upid)
|
||||
pve_status = proxmox_status.get("status", "running") if proxmox_status else "running"
|
||||
# If status is empty, it means Proxmox API rejected the UPID
|
||||
if not proxmox_status:
|
||||
logger.warning(f"[UPID SYNC] Cannot fetch status for task #{task.id} (UPID={task.upid[:30]}...) — marking as failed")
|
||||
task.status = "failed"
|
||||
task.exit_status = "Invalid UPID"
|
||||
task.completed_at = utcnow()
|
||||
db.commit()
|
||||
try:
|
||||
broadcast_task_update(task.user_id, "task_update", task.to_dict())
|
||||
except Exception:
|
||||
pass
|
||||
continue
|
||||
|
||||
pve_status = proxmox_status.get("status", "running")
|
||||
|
||||
# --- log --------------------------------------------------
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user