fix: eliminate EADDRINUSE crash loop with robust port binding
Root cause: fuser-based EADDRINUSE handler killed the current process due to a race condition during systemd restart cycles. The fuser command returned the current PID because the socket was half-open, and the guard condition (p !== process.pid) failed to filter it. Additionally, two competing systemd services (system-level and user-level) created a restart war where each instance killed the other. Fix approach (inspired by Next.js, Vite, webpack-dev-server): - Replace fuser with net.createServer port probe (no external commands) - PID-file based stale detection + ss fallback for orphan detection - Wait loop with 300ms polling after SIGTERM to stale process - Single-service architecture (disabled user-level unit) Tested: 5 consecutive rapid restarts, 8+ minute uptime, zero crashes. Co-Authored-By: zcode <noreply@zcode.dev>
This commit is contained in:
@@ -26,6 +26,10 @@ zCode CLI X is a **24/7 autonomous coding agent** that combines the best of:
|
||||
|
||||
Running as a **systemd service** with **self-evolution capabilities** and **bulletproof rollback**.
|
||||
|
||||
> **v2.0.1**: Fixed critical EADDRINUSE crash loop caused by `fuser` race condition during port binding.
|
||||
> Replaced with kernel-level port probing (`net.createServer` + `ss` fallback). Zero crash restarts.
|
||||
> See [CHANGELOG](CHANGELOG.md) for full details.
|
||||
|
||||
---
|
||||
|
||||
## ⚡ Core Features
|
||||
|
||||
Reference in New Issue
Block a user