|
Download audit/backend.md from SolutionChallenge/solution_challenge_backend: direct link, hf CLI and curl.
- Browser
- Download file 1.74 kB
-
https://huggingface.co/spaces/SolutionChallenge/solution_challenge_backend/resolve/main/audit/backend.md
- Command line
-
hf download hf://spaces/SolutionChallenge/solution_challenge_backend/audit/backend.md
-
curl -L -o backend.md https://huggingface.co/spaces/SolutionChallenge/solution_challenge_backend/resolve/main/audit/backend.md
1.74 kB
Backend Audit Report
Concurrency Issues
- ConnectionManager Broadcast Modification: The WebSocket
ConnectionManager.broadcastandbroadcast_to_agentsmethods were iterating directly overself.active_connectionsandself.agent_connections. If an asynchronous operation yielded and a client disconnected, the list size would change during iteration, leading to skipped clients or iteration errors. - Global Locks:
store_locks.sos_lockis used appropriately when appending tosos_events. However, lists likedetections_historydo not have an explicit async lock around them. Since_upsert_detection_sightingis mostly synchronous except when awaited inside other async handlers, it may not immediately corrupt but can cause interleaved updates.
Memory Issues
- Detections History Unbounded Growth: Most memory lists (like
alerts_db,sos_events,agentic_plans) are bounded using_trim_memory_listto prevent memory leaks in the long-running process. However,detections_historycurrently grows unbounded. When new faces are detected (or unique names generated),detections_history.append(entry)is called without trimming, leading to a slow memory leak over days/weeks of continuous operation.
Exception Handling
- Heartbeat Silence: The
_ws_send_heartbeatbackground task contains atry...except Exception: passblock. Ifsend_personal_messageencounters an error, the heartbeat task exits silently, meaning the proxy might drop idle connections because heartbeats cease without warning. - Agent Stream Errors: In
agents_ws,agent_stepexceptions are caught, butmanager.send_personal_messageduring an error state might itself fail if the websocket has disconnected.