Reconnect tuning: 1 min idle timeout + 5 min periodic autoreconnect (v0.21.3) #46

Merged
kamilkrzywda merged 1 commits from fix/reconnect-tuning into main 2026-09-26 11:37:41 +02:00
Owner

The bridge/radio side keeps killing inbound RX within ~20 min of a fresh sync, repeatedly. The v0.21.2 frame-based watchdog caught today's incident (fired after 628 s of silence, reconnect delivered queued packets), but the owner wants faster detection and a periodic hammer:

  • MESH_IDLE_TIMEOUT_MS default 600000 → 60000 (1 min) — zombie inbound detected within ~1 min instead of 10
  • New MESH_RECONNECT_INTERVAL_MS (default 300000 = 5 min): unconditional periodic autoreconnect — a timer destroys the socket every interval so the existing close→reconnect loop re-establishes with a fresh sync; caps worst-case zombie lifetime at ~5 min even if detection ever fails again

Tests 171 → 172 (periodic reconnect end-to-end: short interval via env, fake bridge disconnect + re-establish observed). Build clean, oxlint clean. Lockfile untouched.

The bridge/radio side keeps killing inbound RX within ~20 min of a fresh sync, repeatedly. The v0.21.2 frame-based watchdog caught today's incident (fired after 628 s of silence, reconnect delivered queued packets), but the owner wants faster detection and a periodic hammer: - MESH_IDLE_TIMEOUT_MS default 600000 → **60000** (1 min) — zombie inbound detected within ~1 min instead of 10 - New **MESH_RECONNECT_INTERVAL_MS** (default **300000** = 5 min): unconditional periodic autoreconnect — a timer destroys the socket every interval so the existing close→reconnect loop re-establishes with a fresh sync; caps worst-case zombie lifetime at ~5 min even if detection ever fails again Tests 171 → 172 (periodic reconnect end-to-end: short interval via env, fake bridge disconnect + re-establish observed). Build clean, oxlint clean. Lockfile untouched.
kamilkrzywda added 1 commit 2026-09-26 11:37:35 +02:00
The v0.21.2 frame-based watchdog works in production (it fired today: 'no
decoded bridge frames for 628474 ms — forcing reconnect', and the reconnect
delivered queued packets), but the bridge/radio side at 192.168.1.4 keeps
killing inbound RX within ~20 min of a fresh sync, repeatedly. Two tuning
changes requested by the owner:

- MESH_IDLE_TIMEOUT_MS default lowered from 600000 (10 min) to 60000 (1 min).
- New lazy periodic autoreconnect: MESH_RECONNECT_INTERVAL_MS (new env,
  default 300000 = 5 min, read at construction like the others). An interval
  started in onModuleInit unconditionally logs and destroys the socket so the
  existing close -> scheduleReconnect loop re-establishes with a fresh sync on
  schedule; cleared in onModuleDestroy. When not connected at tick time,
  destroy is a no-op and the retry loop owns recovery — no special-casing.

Tests: 171 -> 172 — periodic reconnect observed end-to-end with an overridden
short interval (fake bridge disconnect + re-establish); existing watchdog tests
pass unchanged, comments updated to the new 60 s default.
kamilkrzywda merged commit 0722c82359 into main 2026-09-26 11:37:41 +02:00
kamilkrzywda deleted branch fix/reconnect-tuning 2026-09-26 11:37:42 +02:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: OpenCode/MeshBot#46