client: add support for multiple same-type messages over devp2p - #2940
Merged
Conversation
Codecov Report
Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more. |
Member
Author
|
Will block this one since I just realized we have (untested) deadlock situations. In ANY case that the request somehow gets handled (timeout, error, whatever) the lock should be destroyed otherwise we have forever hanging requests. |
jochem-brouwer
marked this pull request as ready for review
August 5, 2023 18:15
jochem-brouwer
force-pushed
the
multiple-devp2p-msgs
branch
from
August 5, 2023 18:21
baacbff to
95a3eb7
Compare
acolytec3
approved these changes
Aug 5, 2023
acolytec3
left a comment
Contributor
There was a problem hiding this comment.
LGTM! a good half step forward
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes a hive test (on top of #2935 which fixes another related timeout problem) where this happens:
There are two clients. These both gets fed messages and it is necessary that upon creating new blocks the peers have exchanged all messages. The block builder client (1) has a race condition without this PR. Here is what happens:
Client (1) gets multiple
NewPooledTransactionHashes(5 in total, over 5 messages). Therefore, client (1) requests 5GetPooledTransactions. However, at some point client (1) is already requesting a pooled tx without getting a response, and then queries a newGetPooledTransactions. Prior to this PR this is not possible because there is only ONE request possible per devp2p message type. This PR has a temporary fix: we now create a Lock for every message which now ensures that if the message is already used, we wait until it is freed and then query this message.This is not ideal: since devp2p now supports Request IDs it is much easier to match up replies to whatever message was sent first. Just check the message type, check the request ID, find in a map the Promise which awaits this request (if available) and then resolve it. However, this temporarily fixes this.
This also fixes (on top of #2935) this hive test:
./hive --sim ethereum/engine --client ethereumjs --sim.limit "engine-blobs/Blob Transaction Ordering, Multiple Clients"