Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions backend/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,15 @@ async def cleanup_chrome_by_pid(chrome_process, user_data_dir="/tmp", time_at_st
proc.kill() # SIGKILL immediately - no waiting
except (psutil.NoSuchProcess, psutil.AccessDenied):
pass
# Reap the main chrome process to prevent zombies
try:
loop = asyncio.get_event_loop()
await asyncio.wait_for(
loop.run_in_executor(None, chrome_process.wait),
timeout=5.0
)
except (asyncio.TimeoutError, Exception) as e:
logger.warning(f"WebSocket ID: {websocket.id} - Error reaping Chrome process: {str(e)}")

logger.debug(f"WebSocket ID: {websocket.id} - Chrome PID {chrome_process.pid} cleanup signaled")
except (psutil.NoSuchProcess, psutil.AccessDenied, OSError):
Expand Down