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): Fix off-by-one error in DNS seed peer retries, and clarify logs #6460

Merged
merged 2 commits into from Apr 4, 2023

Conversation

teor2345
Copy link
Contributor

@teor2345 teor2345 commented Apr 3, 2023

Motivation

Zebra's DNS seed peer retries aren't documented or named correctly: the number of DNS attempts implied by the name doesn't match the implementation.

Closes #6393

Complex Code or Requirements

This is concurrent async code, but this PR doesn't change the number of retries.

Solution

  • Change the value of the constant and the implementation of the loop to actually implement retries, not attempts
  • Don't wait for the next retry if we're not actually going to retry
  • Rename the constant to clarify what it does
  • Split the log messages to clarify what is happening

Review

This is a routine audit fix.

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-Medium ⚡ A-network Area: Network protocol updates or fixes A-concurrency Area: Async code, needs extra work to make it work properly. C-audit Category: Issues arising from audit findings labels Apr 3, 2023
@teor2345 teor2345 self-assigned this Apr 3, 2023
@teor2345 teor2345 requested a review from a team as a code owner April 3, 2023 22:14
@teor2345 teor2345 requested review from oxarbitrage and arya2 and removed request for a team and oxarbitrage April 3, 2023 22:14
zebra-network/src/config.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@arya2 arya2 left a comment

Choose a reason for hiding this comment

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

Looks good!

zebra-network/src/config.rs Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Apr 3, 2023

Codecov Report

Merging #6460 (8b40495) into main (a049e20) will decrease coverage by 0.14%.
The diff coverage is 22.22%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6460      +/-   ##
==========================================
- Coverage   77.92%   77.78%   -0.14%     
==========================================
  Files         304      304              
  Lines       39639    39651      +12     
==========================================
- Hits        30887    30844      -43     
- Misses       8752     8807      +55     

mergify bot added a commit that referenced this pull request Apr 4, 2023
@mergify mergify bot merged commit 47e3311 into main Apr 4, 2023
225 checks passed
@mergify mergify bot deleted the dns-retries-off-by-one branch April 4, 2023 02:29
@mpguerra mpguerra mentioned this pull request Apr 11, 2023
36 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-audit Category: Issues arising from audit findings C-bug Category: This is a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[NCC-E005955-VM7] zebra-network: Off-by-One Error in zebra-network Retry Parameter
2 participants