Skip to content

Fix developer-cli run command leaving worker processes alive on Linux/macOS#862

Merged
tjementum merged 1 commit intomainfrom
pp-1076-fix-developer-cli-leaving-worker-processes-alive
Mar 20, 2026
Merged

Fix developer-cli run command leaving worker processes alive on Linux/macOS#862
tjementum merged 1 commit intomainfrom
pp-1076-fix-developer-cli-leaving-worker-processes-alive

Conversation

@tjementum
Copy link
Member

@tjementum tjementum commented Mar 20, 2026

Summary & Motivation

Fix run --stop failing to terminate worker processes (Account.Workers, BackOffice.Workers, Main.Workers) on Linux/macOS. After stopping, these processes remained listening on their ports indefinitely.

The previous stop logic used a two-loop approach that had two compounding bugs:

  • The first loop only scanned ports at multiples of 100 (9100, 9200, 9300) to discover process names, but workers listen on different ports (e.g., 9199, 9299, 9399) — so the known-names set was always empty when workers were the only survivors
  • The second loop used ps -o comm= which truncates binary names on Linux (e.g., BackOffice.Work instead of BackOffice.Workers), causing substring checks like "PlatformP" to miss them
  • The pkill -9 -f aspire and pkill -9 -f dcp fallback calls killed ALL Aspire/dcp processes system-wide, which is unsafe when running multiple Aspire projects

Replace the entire approach with a single loop that uses ps -o args= (full command line) and matches against Configuration.SourceCodeFolder. This reliably catches all application processes regardless of binary name or port, while being safe for multi-project setups since each project has a unique source folder path.

Checklist

  • I have added tests, or done manual regression tests
  • I have updated the documentation, if necessary

@linear
Copy link

linear bot commented Mar 20, 2026

@tjementum tjementum added the Bug Something isn't working label Mar 20, 2026
@tjementum tjementum self-assigned this Mar 20, 2026
@tjementum tjementum changed the title Fix developer-cli run --stop leaving worker processes alive on Linux/macOS Fix developer-cli run command leaving worker processes alive on Linux/macOS Mar 20, 2026
@tjementum tjementum moved this to 🏗 In Progress in Kanban board Mar 20, 2026
@tjementum tjementum merged commit fdd1154 into main Mar 20, 2026
4 of 5 checks passed
@tjementum tjementum deleted the pp-1076-fix-developer-cli-leaving-worker-processes-alive branch March 20, 2026 15:28
@github-project-automation github-project-automation bot moved this from 🏗 In Progress to ✅ Done in Kanban board Mar 20, 2026
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

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

1 participant