Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@davidfirst
Copy link
Member

Add parent process monitoring to detect when bit server becomes orphaned (PPID changes to 1). This can happen when the parent process crashes or is force-killed.

The server now shuts down gracefully instead of running indefinitely and exhausting FSEvents/file descriptors.

Add parent process monitoring to detect when bit server becomes orphaned
(PPID changes to 1). This can happen when the parent process crashes or is
force-killed. The server now shuts down gracefully in these cases instead
of running indefinitely and exhausting FSEvents/file descriptors.

Includes debug logging of parent process info for troubleshooting.
Copilot AI review requested due to automatic review settings December 31, 2025 21:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds automatic shutdown functionality for orphaned bit server processes by monitoring the parent process ID (PPID). When the parent process (typically VSCode) crashes or is force-killed, the server detects this and shuts down gracefully instead of running indefinitely and exhausting system resources.

Key Changes:

  • Added parent process monitoring that checks every 5 seconds if the PPID has changed to 1 (indicating orphan status on Unix-like systems)
  • Implemented cross-platform process info retrieval using execSync to log parent process details for debugging
  • Used unref() on the monitoring interval to prevent it from keeping the Node.js process alive unnecessarily

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Skip orphan detection on Windows (PPID doesn't change to 1)
- Replace deprecated WMIC with PowerShell Get-CimInstance
- Improve documentation to clarify platform limitations
@davidfirst davidfirst merged commit 7073ca3 into master Jan 2, 2026
12 checks passed
@davidfirst davidfirst deleted the fix/api-server-parent-process-monitor branch January 2, 2026 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants