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

[Merged by Bors] - fetch: requests got lost when there are no peers #4849

Closed

Conversation

countvonzero
Copy link
Contributor

Motivation

requests are not restored back to the queue when there were no peers to dispatch to.

Changes

  • restore requests when there are no peers
  • push mesh to still make progress even when there are missing blocks
  • increase frequency of state sync

testing

i manually test against mainnet, artificially causing GetPeers() to return zero peers.
mesh was making very slow progress because it aborts as soon as it finds a missing block, not executing the next block even when it's available.

updates: rlayers(
rlayer(start, rblock(idg("1"), fixture.Valid(), fixture.Data())),
rlayer(start+1, rblock(idg("2"), fixture.Valid(), fixture.Data())),
rlayer(start+2, rblock(idg("3"), fixture.Valid())),
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe extend it with one more block with data? and one more call that both got applied

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

fetch/fetch.go Outdated
log.Stringer("hash", msg.Hash),
log.String("hint", string(msg.Hint)),
)
f.unprocessed[msg.Hash] = req
Copy link
Contributor

Choose a reason for hiding this comment

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

so GetBlocks will not return immediately with error if no peers, but instead we will do the request when peers are available?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes. essentially put those requests back to the queue

Copy link
Contributor Author

Choose a reason for hiding this comment

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

do you prefer to fail all in that case?

Copy link
Contributor

Choose a reason for hiding this comment

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

this approach is fine for me too, hard to tell what is better

Copy link
Contributor Author

Choose a reason for hiding this comment

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

actually i prefer returning error right away. it's easier for debugging (and avoiding future bug)

@codecov
Copy link

codecov bot commented Aug 15, 2023

Codecov Report

Merging #4849 (ccf3e0b) into develop (e0575cb) will decrease coverage by 0.1%.
Report is 1 commits behind head on develop.
The diff coverage is 65.3%.

@@            Coverage Diff            @@
##           develop   #4849     +/-   ##
=========================================
- Coverage     76.9%   76.8%   -0.1%     
=========================================
  Files          261     261             
  Lines        29689   29720     +31     
=========================================
+ Hits         22831   22850     +19     
- Misses        5406    5418     +12     
  Partials      1452    1452             
Files Changed Coverage Δ
fetch/fetch.go 78.1% <0.0%> (-2.4%) ⬇️
mesh/mesh.go 68.3% <93.9%> (+1.3%) ⬆️
syncer/syncer.go 92.6% <100.0%> (ø)

... and 3 files with indirect coverage changes

@countvonzero
Copy link
Contributor Author

bors try

bors bot added a commit that referenced this pull request Aug 15, 2023
@bors
Copy link

bors bot commented Aug 15, 2023

try

Build failed:

@countvonzero
Copy link
Contributor Author

bors merge

bors bot pushed a commit that referenced this pull request Aug 16, 2023
## Motivation
requests are not restored back to the queue when there were no peers to dispatch to.

## Changes
- restore requests when there are no peers
- push mesh to still make progress even when there are missing blocks
- increase frequency of state sync

## testing
i manually test against mainnet, artificially causing GetPeers() to return zero peers.
mesh was making very slow progress because it aborts as soon as it finds a missing block, not executing the next block even when it's available.
@bors
Copy link

bors bot commented Aug 16, 2023

Build failed:

@countvonzero
Copy link
Contributor Author

bors merge

bors bot pushed a commit that referenced this pull request Aug 16, 2023
## Motivation
requests are not restored back to the queue when there were no peers to dispatch to.

## Changes
- restore requests when there are no peers
- push mesh to still make progress even when there are missing blocks
- increase frequency of state sync

## testing
i manually test against mainnet, artificially causing GetPeers() to return zero peers.
mesh was making very slow progress because it aborts as soon as it finds a missing block, not executing the next block even when it's available.
@bors
Copy link

bors bot commented Aug 16, 2023

Pull request successfully merged into develop.

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot changed the title fetch: requests got lost when there are no peers [Merged by Bors] - fetch: requests got lost when there are no peers Aug 16, 2023
@bors bors bot closed this Aug 16, 2023
countvonzero added a commit that referenced this pull request Aug 16, 2023
requests are not restored back to the queue when there were no peers to dispatch to.

- restore requests when there are no peers
- push mesh to still make progress even when there are missing blocks
- increase frequency of state sync

i manually test against mainnet, artificially causing GetPeers() to return zero peers.
mesh was making very slow progress because it aborts as soon as it finds a missing block, not executing the next block even when it's available.
brunovale91 pushed a commit to swarmbit/go-spacemesh that referenced this pull request Aug 21, 2023
requests are not restored back to the queue when there were no peers to dispatch to.

- restore requests when there are no peers
- push mesh to still make progress even when there are missing blocks
- increase frequency of state sync

i manually test against mainnet, artificially causing GetPeers() to return zero peers.
mesh was making very slow progress because it aborts as soon as it finds a missing block, not executing the next block even when it's available.
brunovale91 pushed a commit to swarmbit/go-spacemesh that referenced this pull request Aug 21, 2023
requests are not restored back to the queue when there were no peers to dispatch to.

- restore requests when there are no peers
- push mesh to still make progress even when there are missing blocks
- increase frequency of state sync

i manually test against mainnet, artificially causing GetPeers() to return zero peers.
mesh was making very slow progress because it aborts as soon as it finds a missing block, not executing the next block even when it's available.
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.

None yet

2 participants