-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[blockchain] Riri processor-scheduler peer behaviour #3777
Comments
Hmmm...not sure. You would yield to the messages in a channel that may contain a lot of blocks from scheduler, requests from other fast-sync peers, etc....before you get to the peerError from the scheduler. Unless we add another channel for errors (this is what v0 and v1 have). At this point I am not sure anymore that we need to have the processor and scheduler routines. I will try to give a minimal explanation on how v0 and v1 got to having the two routines, added links to the issue and PR below. We used to have a single goroutine that was doing both the scheduling and the processing. The way it was written and given that we were running timers that triggered in separate goroutines the following was seen:
With the current approach (use of timestamps and not real timers) this wouldn't happen, right? |
Yes I think that could definitely be one solution. It could be done internal the the processRoutine because in the end, it's the processRoutine which is most concerned for missing a peerError.
The motivation for having separate routines in
If i understand you correctly, we are talking about thread saturation where an expensive process like block validation holds control of a thread for too long and doesn't check for errors or doesn't check the time and issues timeouts. In both cases it seems like the solution is to ensure that threads yields frequently enough to be responsive to external state changes (events). |
This has been resolved by using a priority queue routine which ensures peerErrors are higher priority than blocks. |
The new blockchain reactor design specified in #3753 introduces asynchronous message communication between the block processing logic and the request scheduling logic. This async communication introduces latency between the scheduler perceiving bad peer behaviour and informing the processor to remove block provided by that peer. A malicious peer could use this period to saturate the block processing thread and slowing down the FastSync'ing node.
This issue can be solved by yielding the block processing thread to peerErrors at a higher frequency to ensure few if any blocks from an errored peer are processed.
The text was updated successfully, but these errors were encountered: