Skip to content

fix(registry): prevent orphaned reg.exe/powershell processes on timeout#117

Merged
dbfx merged 1 commit intomainfrom
fix/registry-orphaned-processes
Apr 5, 2026
Merged

fix(registry): prevent orphaned reg.exe/powershell processes on timeout#117
dbfx merged 1 commit intomainfrom
fix/registry-orphaned-processes

Conversation

@dbfx
Copy link
Copy Markdown
Contributor

@dbfx dbfx commented Apr 5, 2026

Summary

  • Fixed timeout race condition in execNativeUtf8 where Node's built-in execFile timeout killed only the parent cmd.exe, orphaning reg.exe children. Now only trackChild handles timeouts using taskkill /T /F to kill the full process tree.
  • Fixed untracked PowerShell processes for task fix operations (disable-task, delete-task) by replacing raw execFileAsync with a new execTracked() helper that provides tree-kill tracking and abort signal support.
  • Fixed task path regex rejecting GUID-containing task names (e.g. GoogleUpdateTaskMachineUA{...}) by adding {} and , to SAFE_TASK_PATH_RE.

Test plan

  • Run registry scan + fix with entries that include Windows Installer folder references and third-party update tasks (GoogleUpdate)
  • Verify no orphaned reg.exe or powershell.exe processes remain in Task Manager after fixes complete or time out
  • Verify cancelling a fix operation kills all spawned processes
  • Verify closing the app during a fix kills all spawned processes

🤖 Generated with Claude Code

Three bugs caused child processes to accumulate in Task Manager:

1. execNativeUtf8 passed `timeout` to both Node's execFile (which kills
   only the parent cmd.exe) and trackChild (which kills the full tree).
   Node's timeout won the race, orphaning reg.exe children. Fixed by
   removing `timeout` from execFile options so only trackChild handles
   it via taskkill /T /F.

2. Task fix operations (disable-task, delete-task) used raw execFileAsync
   with no process tracking — hung PowerShell processes were never killed.
   Replaced with new execTracked() helper and wired up abort signal.

3. SAFE_TASK_PATH_RE rejected task names containing curly braces (e.g.
   GoogleUpdateTaskMachineUA{GUID}), causing "Invalid task path" errors.
   Added {} and , to the allowed character class.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dbfx dbfx merged commit 870bad3 into main Apr 5, 2026
11 of 12 checks passed
@dbfx dbfx deleted the fix/registry-orphaned-processes branch April 5, 2026 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant