Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpcclient/WS: do not deadlock on connection loss #3535

Merged
merged 1 commit into from
Jul 29, 2024

Conversation

carpawell
Copy link
Member

makeWsRequest creates a channel for response and waits for it. If between creating the channel and starting the reading select connection is lost (writerDone channel is closed), nothing reads from the channel and a deadlock appears. Looking at "done" channels when transferring RPC data solves the issue. Closes #3530.

`makeWsRequest` creates a channel for response and waits for it. If between
creating the channel and starting the reading `select` connection is lost
(`writerDone` channel is closed), nothing reads from the channel and a
deadlock appears. Looking at "done" channels when transferring RPC data
solves the issue. Closes #3530.

Signed-off-by: Pavel Karpy <[email protected]>
@carpawell carpawell self-assigned this Jul 29, 2024
Copy link

codecov bot commented Jul 29, 2024

Codecov Report

Attention: Patch coverage is 33.33333% with 4 lines in your changes missing coverage. Please review.

Project coverage is 86.06%. Comparing base (8d4e8b6) to head (9fadfef).

Files Patch % Lines
pkg/rpcclient/wsclient.go 33.33% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3535      +/-   ##
==========================================
- Coverage   86.11%   86.06%   -0.05%     
==========================================
  Files         330      330              
  Lines       38673    38678       +5     
==========================================
- Hits        33305    33290      -15     
- Misses       3829     3846      +17     
- Partials     1539     1542       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@roman-khimov roman-khimov merged commit c2a1c4a into master Jul 29, 2024
19 of 21 checks passed
@roman-khimov roman-khimov deleted the fix/possible-WS-deadlock-on-connection-loss branch July 29, 2024 14:56
Copy link
Member

@AnnaShaleva AnnaShaleva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks legit.

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.

wsReader gets blocked in rpcclient
3 participants