Skip to content

fix(modbus): backoff mute reconnects for single-session dongles - #585

Closed
frahlg wants to merge 1 commit into
masterfrom
fix/modbus-mute-reconnect-backoff
Closed

frahlg wants to merge 1 commit into
masterfrom
fix/modbus-mute-reconnect-backoff

Conversation

@frahlg

@frahlg frahlg commented Jul 18, 2026

Copy link
Copy Markdown
Member

Summary

  • Count consecutive Modbus TCP transport/mute failures and apply exponential reconnect backoff (2s…60s) after the first redial
  • Keep existing 15s TCP keepalive; first failure still reconnects immediately (Sungrow/CTEK path)
  • Document GoodWe single-session ghost-session behavior and tighten MyUplink invalid_request troubleshooting (callback URL)

Fixes the rapid modbus reconnected loop on GoodWe WiFi/LAN dongles after a hard controller reboot (#522). Immediate reconnects never give the dongle time to drop a ghost session; backoff does.

Test plan

  • go test ./internal/modbus/ (schedule + sleep injection tests)
  • pre-commit make verify
  • pre-push make verify-all (cross-compile)
  • Field: power-cycle FTW host (not clean stop) against a GoodWe dongle and confirm telemetry returns without dongle power cycle

Closes #522

GoodWe WiFi/LAN dongles can accept a new TCP connection while Modbus is
still bound to a ghost session left by a hard controller reboot. Immediate
reconnect loops never recover without power-cycling the inverter.

Keep the 15s TCP keepalive path, count consecutive transport failures, and
apply exponential reconnect backoff (2s…60s) after the first mute failure.
Document the GoodWe single-session limit and tighten MyUplink invalid_request
troubleshooting (callback URL mismatch).

frahlg commented Jul 22, 2026

Copy link
Copy Markdown
Member Author

Superseded by merged PR #622 (3985c82). Current master now has the same transport-timeout handling, TCP keepalive, a non-blocking 2–60 s reconnect cooldown, mute-socket cleanup, and regression tests, while also fitting the newer driver host. The MyUplink docs change belongs with #509. Closing this stale, conflicting PR; #522 stays open for the original GoodWe hard-reboot field check.

@frahlg frahlg closed this Jul 22, 2026
@frahlg
frahlg deleted the fix/modbus-mute-reconnect-backoff branch November 11, 2026 09:20
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.

GoodWe Modbus TCP stale socket after controller reboot

1 participant