Skip to content

client: Fix WebSocket read loop blocking.#3501

Merged
JoeGruffins merged 1 commit intodecred:masterfrom
JoeGruffins:thebigbug
Feb 6, 2026
Merged

client: Fix WebSocket read loop blocking.#3501
JoeGruffins merged 1 commit intodecred:masterfrom
JoeGruffins:thebigbug

Conversation

@JoeGruffins
Copy link
Copy Markdown
Member

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.

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.
@JoeGruffins JoeGruffins merged commit 7789513 into decred:master Feb 6, 2026
5 checks passed
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.

client: Preimage not seen until it's too late.

1 participant