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: correctly poll BasicBlockDownloader #11981

Merged
merged 1 commit into from
Oct 22, 2024
Merged

Conversation

klkvr
Copy link
Collaborator

@klkvr klkvr commented Oct 22, 2024

Right now if we schedule block download, on next poll of BasicBlockDownloader we'll return Poll:Ready with NewDownloadStarted event and never register waker with actual downloading future.

Found this to be an issue when writing e2e tests, not sure if can occur during normal node operation

@mattsse
Copy link
Collaborator

mattsse commented Oct 22, 2024

we'll return Poll:Ready with NewDownloadStarted event and never register waker with actual downloading future.

hmm, this is expected because a ready indicates that there can be more work and the caller is supposed to call it again

which I think we do:

// advance the downloader
if let Poll::Ready(DownloadOutcome::Blocks(blocks)) = self.downloader.poll(cx) {
// delegate the downloaded blocks to the handler
self.handler.on_event(FromEngine::DownloadedBlocks(blocks));
continue
}

Found this to be an issue when writing e2e tests, not sure if can occur during normal node operation
which issue did you encounter?

@klkvr
Copy link
Collaborator Author

klkvr commented Oct 22, 2024

ah, then I think the issue is in this line:

if let Poll::Ready(DownloadOutcome::Blocks(blocks)) = self.downloader.poll(cx) {

if we get Poll::Ready with any other DownloadOutcome variant we won't poll it again

@klkvr
Copy link
Collaborator Author

klkvr commented Oct 22, 2024

the issue I've seen is that block fetching future was not being polled

@klkvr klkvr force-pushed the klkvr/block-downloader-poller branch from 5532d34 to d10b16d Compare October 22, 2024 20:32
@klkvr
Copy link
Collaborator Author

klkvr commented Oct 22, 2024

Updated logic to instead make sure that we drain downloader events in EngineHandler

Comment on lines +116 to +117
if let Poll::Ready(outcome) = self.downloader.poll(cx) {
if let DownloadOutcome::Blocks(blocks) = outcome {
Copy link
Collaborator

Choose a reason for hiding this comment

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

ah, yes of course lol

initial I wanted to bubble up the newdownload started event, but came to the conclusion that this isn't very useful

@mattsse mattsse added this pull request to the merge queue Oct 22, 2024
Merged via the queue into main with commit 74eb375 Oct 22, 2024
38 checks passed
@mattsse mattsse deleted the klkvr/block-downloader-poller branch October 22, 2024 23:01
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.

2 participants