Skip to content

cmd/devp2p: fix ping/pong race in discv4 tests#23306

Merged
holiman merged 1 commit intoethereum:masterfrom
holiman:p2pfix
Aug 3, 2021
Merged

cmd/devp2p: fix ping/pong race in discv4 tests#23306
holiman merged 1 commit intoethereum:masterfrom
holiman:p2pfix

Conversation

@holiman
Copy link
Copy Markdown
Contributor

@holiman holiman commented Jul 30, 2021

Nethermind fails tests spuriously on Hive. They fail basic ping test, because they send a PING not a PONG back. This is most likely a data race. When they get a PING, they're supposed to send both a PONG and a PING. However, the test framework assumes that the PONG will be the first response packet to arrive.

This PR modifies the post-PING-send expectations to both be laxer and stricter: it doesn't care what order the packets arrive, but also verifies that exactly one PING and one PONG is returned.

Tested against my local node:

$ ./devp2p discv4 test --run Ping --remote "enode://cc44695159f742595bf2fd9a9da13535733836c71cd5ca1179d76c11b95565f37c8014db177e90c9d7907b3a17439b3f51949c2144adbe4fef0e615d11900ca8@127.0.0.1:30303?discport=0"
-- OK Ping/Basic (1ms)
-- OK Ping/WrongTo (700µs)
-- OK Ping/WrongFrom (800µs)
-- OK Ping/ExtraData (700µs)
-- OK Ping/ExtraDataWrongFrom (700µs)
-- OK Ping/PastExpiration (300.9ms)
-- OK Ping/WrongPacketType (302ms)
-- OK Ping/BondThenPingWithWrongFrom (5.1ms)
8/8 tests passed.

@holiman holiman requested a review from fjl August 2, 2021 13:41
@holiman holiman merged commit 4cd6a14 into ethereum:master Aug 3, 2021
@holiman holiman added this to the 1.10.7 milestone Aug 3, 2021
sidhujag pushed a commit to sidhujag/go-ethereum that referenced this pull request Aug 4, 2021
This PR modifies the post-PING-send expectations to both be laxer and stricter: it doesn't care what order the packets arrive, but also verifies that exactly one PING and one PONG is returned.
atif-konasl pushed a commit to frozeman/pandora-execution-engine that referenced this pull request Oct 15, 2021
This PR modifies the post-PING-send expectations to both be laxer and stricter: it doesn't care what order the packets arrive, but also verifies that exactly one PING and one PONG is returned.
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