Skip to content

v1.2.1 — Stability & Reliability Patch (Production Hardening)

Choose a tag to compare

@pphothidaen pphothidaen released this 01 Dec 09:06
· 14 commits to main since this release

Critical Fixes (Production Stability)

  • Signal Handling: Added signal-hook crate for graceful SIGTERM/SIGHUP/SIGINT handling in Rust daemon — prevents mid-operation termination during do_update/apply_hosts
  • PID File Liveness Check: acquire_lock() now verifies PID liveness via kill -0 before blocking; atomic write (.tmp + rename) prevents stale lock corruption
  • File Descriptor Limit: Daemon sets RLIMIT_NOFILE=65536 at startup via nix::sys::resource — eliminates "Too many open files" during concurrent do_update operations
  • Memory Pressure Guard: Pre-flight /proc/meminfo MemAvailable check before large allocation in do_update — aborts if < 20 MB free, prevents OOM kill mid-write
  • Firewall Race Reduction: Reduced firewall_tick_stride from 6→2 (30s→10s) in Supervisor; event-driven dnsmasq detection for faster iptables rule restoration
  • Resource Hygiene: All file opens use O_CLOEXEC; watchdog.sh adds trap 'wait' CHLD to reap zombie children

Observability Improvements

  • Graceful shutdown logging with reason (signal received, error, normal)
  • Lock acquisition telemetry (PID, liveness check result, wait time)
  • Memory pressure check result logged before each do_update

Compatibility

  • ✅ ARMv7 musl cross-compile verified (signal-hook, nix work on musl)
  • ✅ Zero-wear Flash delta check preserved (no additional Flash writes)
  • ✅ ZTE cspd self-healing (WAN reconnect host restore) unchanged
  • ✅ BusyBox ash compatible (no new shell dependencies)

Testing Checklist (Pre-Release)

  • ✅ Unit tests: cargo test --manifest-path rust/Cargo.toml --workspace (67/67 pass)
  • ✅ Python tests: python3 -m pytest tests/ -v (65/65 pass)
  • ✅ Integration: Deploy to 192.168.1.1, verify ROUTER_AUTONOMY: FULLY_AUTONOMOUS
  • ✅ Stress: Trigger do_update 10x rapidly — verify no FD exhaustion, no stale lock
  • ✅ Signal: Send SIGTERM/SIGHUP to running daemon — verify graceful shutdown + lock cleanup
  • ✅ Memory: Simulate low memory (MemAvailable < 20MB) — verify do_update aborts cleanly
  • ✅ Firewall: Restart dnsmasq — verify iptables rules restored within 10s
  • ✅ Zombie: Run watchdog.sh for 1 hour — verify no defunct processes accumulate
  • ✅ Regression: Full test suite + router deploy + internet connectivity (DNS/HTTPS/Ping)

Artifacts

  • ARMv7 binary: homeshield-daemon (527 KB static, musl)
  • SHA256: Available from CI artifact homeshield-daemon-armv7