Skip to content

fix(registry): kill process tree on timeout to prevent zombie reg.exe#105

Merged
dbfx merged 2 commits intomainfrom
fix/registry-zombie-processes
Mar 29, 2026
Merged

fix(registry): kill process tree on timeout to prevent zombie reg.exe#105
dbfx merged 2 commits intomainfrom
fix/registry-zombie-processes

Conversation

@dbfx
Copy link
Copy Markdown
Contributor

@dbfx dbfx commented Mar 29, 2026

Summary

  • Process tree killing: execNativeUtf8 now tracks child processes and uses taskkill /T /F /PID to kill the entire tree (cmd.exe + reg.exe) on timeout or abort, preventing orphaned reg.exe instances that consumed 100% CPU
  • Cancellation support: Added AbortController to registry scan/fix operations with "Stop" buttons in the UI, plus killAllChildren() on app exit as a safety net
  • Error message cleanup: %__KAn% environment variable placeholders in error messages are replaced with actual argument values so users see meaningful commands

Fixes the issue where registry cleanup spawned 100+ zombie reg.exe processes that persisted after stopping Kudu, caused 100% CPU usage, and showed confusing errors like Command failed: cmd.exe /d /v:off /s /c chcp 65001 >/dev/null && reg "%__KA0%" "%__KA1%".

Test plan

  • Run registry scan on a Windows system with a large registry — verify no orphaned reg.exe processes after scan completes or times out
  • Click "Stop" during a registry scan — verify scan stops promptly and no reg.exe processes remain
  • Click "Stop" during a registry fix — verify fix stops and partial results are reported
  • Close Kudu during an active scan — verify all child processes are cleaned up
  • Verify error messages show actual registry paths instead of %__KA0% placeholders
  • Run npm test — all 1936 tests pass

🤖 Generated with Claude Code

When registry scan/fix operations timed out, Node.js killed only the
root cmd.exe process but left reg.exe children running as orphans. On
systems with large registries this caused 100+ zombie processes, 100%
CPU usage, and confusing errors showing raw %__KA0% placeholders.

Three root causes addressed:

1. Process tree killing: execNativeUtf8 now tracks child processes and
   uses taskkill /T /F /PID to kill the entire tree on timeout/abort,
   preventing orphaned reg.exe instances.

2. Cancellation support: Added AbortController to scan and fix
   operations with Stop buttons in the UI, so users can cancel
   long-running operations and all child processes are cleaned up.

3. Error message sanitization: %__KAn% env var placeholders in error
   messages are replaced with actual argument values.

Also calls killAllChildren() on app exit (before-quit) as a safety net.

Closes #XXX

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@dbfx dbfx merged commit 7ec25e7 into main Mar 29, 2026
3 checks passed
@dbfx dbfx deleted the fix/registry-zombie-processes branch March 29, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant