Skip to content

fix(gateway): conservative zombie cleanup on windows#249

Merged
1186258278 merged 1 commit intomainfrom
fix/p0-windows-zombie
Apr 24, 2026
Merged

fix(gateway): conservative zombie cleanup on windows#249
1186258278 merged 1 commit intomainfrom
fix/p0-windows-zombie

Conversation

@1186258278
Copy link
Copy Markdown
Contributor

Problem

On Windows, when Gateway reaches ready but is still initializing, a single /health probe can time out — cleanup_zombie_gateway_processes then kills the healthy Gateway, and start_service_impl Hidden-starts a new one. Loop continues.

Users reported this as Gateway 已成功 ready,但 ClawPanel 又 Hidden-start 了一个新的 in #244.

Fix

New helper is_gateway_port_responsive_with_retry(port, retries, interval) — 3 attempts with 800ms gap (up to 2.4s tolerance window). Used in cleanup_zombie_gateway_processes.

  • Genuinely zombie processes still killed (all 3 attempts fail)
  • Healthy Gateway in warm-up phase survives

Verification

  • cargo check passes
  • cargo fmt --check passes
  • cargo clippy -D warnings passes
  • Manual test on Windows pending

Refs #244 (Hidden-start loop — warm-up window respected)

Fix for #244 Hidden-start repeat loop:

cleanup_zombie_gateway_processes used a single /health probe to
decide whether a port-listening process is a zombie. When Gateway
reaches 'ready' but is still initializing (loading plugins, connecting
channels, warming up networks), a single probe can time out -> the
healthy Gateway gets killed -> start_service_impl Hidden-starts a new
one -> loop.

Add is_gateway_port_responsive_with_retry: 3 attempts with 800ms
interval before classifying as zombie. Maximum wait 2.4s for a
process that's genuinely healthy to show up as such.

Effect: healthy Gateway no longer misidentified during warm-up,
Hidden-start no longer triggered on an already-ready Gateway.

Refs #244
@1186258278 1186258278 merged commit da5adc5 into main Apr 24, 2026
3 checks passed
@1186258278 1186258278 deleted the fix/p0-windows-zombie branch April 24, 2026 11:36
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.

1 participant