client: Fix WebSocket read loop blocking.#3501
Merged
JoeGruffins merged 1 commit intodecred:masterfrom Feb 6, 2026
Merged
Conversation
The WebSocket read loop in wsconn.go could block indefinitely on conn.readCh when the 128-message buffer was full. This prevented ReadJSON from being called, which is where ping handling occurs. When blocked, pings weren't processed, causing the server to disconnect due to ping timeout. Fix by using an overflow buffer with non-blocking sends. Messages are buffered locally when the channel is full, allowing the read loop to continue and handle pings. A warning is logged when backpressure occurs to help diagnose slow consumers. Additionally, sendRedeemAsync was generating ERROR-level notifications for transient connection errors that would be automatically retried by resendPendingRequests. This caused unnecessary fatal errors in clients like loadbot. Now transient errors (connection down, timeout) log a warning instead, while permanent errors still generate ERROR notifications.
bb15775 to
11da601
Compare
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.
closes #3184
The WebSocket read loop in wsconn.go could block indefinitely on conn.readCh when the 128-message buffer was full. This prevented ReadJSON from being called, which is where ping handling occurs. When blocked, pings weren't processed, causing the server to disconnect due to ping timeout.
Fix by using an overflow buffer with non-blocking sends. Messages are buffered locally when the channel is full, allowing the read loop to continue and handle pings. A warning is logged when backpressure occurs to help diagnose slow consumers.
Additionally, sendRedeemAsync was generating ERROR-level notifications for transient connection errors that would be automatically retried by resendPendingRequests. This caused unnecessary fatal errors in clients like loadbot. Now transient errors (connection down, timeout) log a warning instead, while permanent errors still generate ERROR notifications.