mirror of
https://github.com/browser-use/browser-use.git
synced 2026-09-14 19:59:47 +08:00
c8242e7edd
The session server had a race condition where concurrent CLI calls could spawn multiple server processes. The old server would be orphaned when the new one overwrote the PID file and deleted its socket. Changes: - Add flock-based locking using portalocker (already a dependency) - Server acquires exclusive lock before writing PID file - CLI checks both is_server_running() AND is_session_locked() - Add kill_orphaned_server() to clean up servers with PID but no lock - Increase socket timeout from 0.1s to 0.5s for reliability - cleanup_session_files() now removes .lock and .meta files Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
7.5 KiB
7.5 KiB