Skip to content

Recycle the Modbus connection after consecutive TCP timeouts - #699

Open
N1c084 wants to merge 1 commit into
kellerza:mainfrom
N1c084:fix/tcp-dead-link-recycle
Open

N1c084 wants to merge 1 commit into
kellerza:mainfrom
N1c084:fix/tcp-dead-link-recycle

Conversation

@N1c084

@N1c084 N1c084 commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

A gateway can stop serving one TCP session while still accepting new ones: every request on the old socket then times out until the kernel gives up (tcp_retries2, ~16 min), or until the add-on is restarted.

Count consecutive read timeouts on non-serial links that have a ModbusConnection, and disconnect once Sunsynk.dead_link_timeouts is reached (default 6, 0 disables); the next read opens a new connection. Any successful read resets the count. Serial behaviour is unchanged.

A gateway can stop serving one TCP session while still accepting new
ones: every request on the old socket then times out until the kernel
gives up (tcp_retries2, ~16 min), or until the add-on is restarted.

Count consecutive read timeouts on non-serial links that have a
ModbusConnection, and disconnect once Sunsynk.dead_link_timeouts is
reached (default 6, 0 disables); the next read opens a new connection.
Any successful read resets the count. Serial behaviour is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kellerza

Copy link
Copy Markdown
Owner

This seems very specific to the connection handling. Maybe this rather belongs in modbus connection?

@N1c084

N1c084 commented Oct 11, 2026 via email

Copy link
Copy Markdown
Contributor Author

This branch has not been deployed

No deployments
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.

2 participants