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

fix(net): Avoid a rare panic when a connection is dropped #6566

Merged
merged 1 commit into from
Apr 26, 2023

Conversation

teor2345
Copy link
Contributor

@teor2345 teor2345 commented Apr 25, 2023

Motivation

Zebra sometimes panics when a Connection is dropped and there is no error response:

Message: ClientRequest oneshot sender must not be dropped before send: Canceled
Location: zebra-network/src/peer/client.rs:625
Metadata:
version: 1.0.0-rc.6

https://github.com/ZcashFoundation/zebra/actions/runs/4764031851/jobs/8495315588#step:8:543

This fixes a regression, the original ticket was #1471.

Complex Code or Requirements

This is a rare panic due to concurrency.

Solution

Replace the panic with returning a generic error.

Review

This is a low-priority security fix. It seems like it could be remotely triggerable, but I'm not sure.

Reviewer Checklist

  • Will the PR name make sense to users?
    • Does it need extra CHANGELOG info? (new features, breaking changes, large changes)
  • Are the PR labels correct?
  • Does the code do what the ticket and PR says?
    • Does it change concurrent code, unsafe code, or consensus rules?
  • How do you know it works? Does it have tests?

@teor2345 teor2345 added C-bug Category: This is a bug P-Low ❄️ C-security Category: Security issues I-panic Zebra panics with an internal error message A-network Area: Network protocol updates or fixes A-concurrency Area: Async code, needs extra work to make it work properly. I-remote-trigger Remote nodes can make Zebra do something bad labels Apr 25, 2023
@teor2345 teor2345 self-assigned this Apr 25, 2023
@teor2345 teor2345 requested a review from a team as a code owner April 25, 2023 20:10
@teor2345 teor2345 requested review from upbqdn and removed request for a team April 25, 2023 20:10
@teor2345 teor2345 changed the title Avoid a rare panic when a connection is dropped fix(net): Avoid a rare panic when a connection is dropped Apr 25, 2023
Copy link
Contributor

@dconnolly dconnolly left a comment

Choose a reason for hiding this comment

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

lgtm

@codecov
Copy link

codecov bot commented Apr 25, 2023

Codecov Report

Merging #6566 (710812f) into main (fb3fec0) will increase coverage by 0.14%.
The diff coverage is 83.33%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6566      +/-   ##
==========================================
+ Coverage   77.67%   77.81%   +0.14%     
==========================================
  Files         307      307              
  Lines       40283    40287       +4     
==========================================
+ Hits        31288    31348      +60     
+ Misses       8995     8939      -56     

mergify bot added a commit that referenced this pull request Apr 26, 2023
@mergify mergify bot merged commit a1b3246 into main Apr 26, 2023
@mergify mergify bot deleted the oneshot-sender-panic branch April 26, 2023 02:47
@oxarbitrage oxarbitrage mentioned this pull request May 9, 2023
38 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-concurrency Area: Async code, needs extra work to make it work properly. A-network Area: Network protocol updates or fixes C-bug Category: This is a bug C-security Category: Security issues I-panic Zebra panics with an internal error message I-remote-trigger Remote nodes can make Zebra do something bad
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants