Repository navigation
fix(ocpp): a charger socket may stay silent for five heartbeats - #1790
Merged
Merged
Conversation
ocpp-go's server closes a socket that has sent nothing for PingWait, 60 s by default, and resets the timer only after a handled message or a WebSocket ping. An idle charger that sends only heartbeats every 60 s lands on that edge: the end-to-end simulator run on 21 October saw the socket closed 20 ms after the first heartbeat arrived, in 2 of 3 runs, followed by a reconnect and a few seconds of "≈" on Home use. Set PingWait to five heartbeat intervals (150 s with the default 30 s). The telemetry watchdog still decides when a quiet charger is offline. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The end-to-end simulator run before the beta (scenario s0, idle OCPP charger) saw FTW close the charger's socket 20 ms after the charger's first heartbeat arrived, 60 s after connecting, in 2 of 3 runs. The charger reconnected after 5 s, and Home use showed "≈" for those seconds.
Cause: ocpp-go v0.19.0's
ws.Serversets a read deadline ofPingWait, 60 s by default, and resets it only after a handled message or a WebSocket ping (ws/websocket.goreadPump). FTW never set it. An idle charger that sends nothing but heartbeats every 60 s, and no WebSocket pings, lands exactly on that edge. Before #1779 Core asked chargers for a 60 s heartbeat, so a compliant charger without pings raced the deadline on every heartbeat; #1779 asks for 30 s, which helps chargers that follow the interval but not those that keep their own 60 s.Change
newListenersetsPingWaitto five heartbeat intervals (150 s with the default 30 s; 300 s if a site configures 60 s). It applies to the 1.6 and 2.0.1 listeners. The socket timer only has to outlast a few missed heartbeats; FTW's telemetry watchdog still decides when a quiet charger is offline. No setting added.Test
TestSilentChargerSocketFollowsHeartbeat: with a 1 s heartbeat a silent charger's socket closes after 5.0 s. Without the change the socket stayed open for the test's whole 12 s (the 60 s default).make verify: 78 Go packages pass.Not run in the simulator rig yet; the final pre-beta run on the release commit includes s0.
🤖 Generated with Claude Code