Skip to content

fix: [sc-83534] Auto updater fails to restart service#35

Merged
mlataza merged 1 commit intomainfrom
bug/sc-83534/auto-updater-fails-to-restart-service
Mar 16, 2026
Merged

fix: [sc-83534] Auto updater fails to restart service#35
mlataza merged 1 commit intomainfrom
bug/sc-83534/auto-updater-fails-to-restart-service

Conversation

@mlataza
Copy link
Copy Markdown
Collaborator

@mlataza mlataza commented Mar 16, 2026

Summary

Story details: https://app.shortcut.com/rewst/story/83534

  • Fixed a deadlock in the auto-updater where the service process blocks indefinitely on exec.Command(...).Run() waiting for the updater child process to exit, while the updater child is waiting for the service to stop — creating a circular dependency
  • Changed .Run() to .Start() in cmd/agent_smith/service.go so the updater process is launched in the background, allowing the service to respond to the stop signal when the updater issues it

Root Cause

The auto-updater flow:

  1. Service process (parent) calls exec.Command(path, args...).Run() which blocks until the child exits
  2. Updater process (child) runs --update, which calls svc.Stop() to stop the parent service
  3. The parent can't stop because it's blocked waiting for the child — deadlock

Fix

Using .Start() instead of .Run() fires the updater process without waiting for it to complete. The updater independently handles stopping the service, copying the new binary, and restarting the service.

@mlataza mlataza self-assigned this Mar 16, 2026
@mlataza mlataza added the bug Something isn't working label Mar 16, 2026
@mlataza mlataza merged commit 2bbd2c1 into main Mar 16, 2026
18 checks passed
@mlataza mlataza deleted the bug/sc-83534/auto-updater-fails-to-restart-service branch March 16, 2026 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant