fix(windows): handle stale PID locks and TUI console input#790
Merged
qin-ctx merged 1 commit intovolcengine:mainfrom Mar 20, 2026
Merged
fix(windows): handle stale PID locks and TUI console input#790qin-ctx merged 1 commit intovolcengine:mainfrom
qin-ctx merged 1 commit intovolcengine:mainfrom
Conversation
This was referenced Mar 19, 2026
3 tasks
Fix two Windows-specific issues: 1. process_lock: os.kill(pid, 0) raises OSError (WinError 87) on Windows for stale/invalid PIDs instead of ProcessLookupError. This prevented the server from reclaiming stale lock files after a crash, blocking startup with no clear recovery path. (volcengine#650) 2. rust_cli: os.execv() on Windows does not replace the current process — CPython's MSVC implementation spawns a child instead. This breaks console handle inheritance, preventing the Rust TUI from receiving keyboard input. Replace with subprocess.call() on Windows to properly inherit console handles. (volcengine#587)
79d33c1 to
e9f285d
Compare
qin-ctx
approved these changes
Mar 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix two Windows-specific issues that prevent normal operation on Windows:
Stale PID lock recovery (
process_lock.py):os.kill(pid, 0)raisesOSError(WinError 87: "The parameter is incorrect") on Windows for stale or invalid PIDs, instead ofProcessLookupErroras on Unix. This prevented the server from reclaiming lock files left by crashed processes, blocking startup with no recovery path other than manually deleting the.openviking.pidfile. Fixes [Feature]: Stale RocksDB LOCK detection for local-mode multi-session safety (Windows) #650.TUI console input (
rust_cli.py):os.execv()on Windows does not truly replace the current process — CPython's MSVC implementation spawns a child process instead. This breaks console handle inheritance, which prevents the Rust TUI (crossterm) from receiving keyboard input. Replaced all threeos.execv()call sites with a helper that usessubprocess.call()on Windows to properly inherit console handles. Fixes [Bug]: ov tui cannot be used on Windows systems. #587.Changes
openviking/utils/process_lock.py: Addexcept OSErrorclause to_is_pid_alive()to handle Windows-specific error codes for stale PIDs.openviking_cli/rust_cli.py: Extract_exec_binary()helper that dispatches tosubprocess.call()on Windows andos.execv()on Unix.Testing
.openviking.pid, subsequent startup failed withOSError: [WinError 87]. After fix, stale lock is correctly reclaimed.os.execv()→subprocess.call()pattern is a well-known Windows workaround for console applications (CPython docs).ruff checkpasses on both files.