go-ethereum/p2p
Marius G 6e33dbf96a
p2p: fix flaky test TestServerPortMapping (#30241)
The test specifies `ListenAddr: ":0"`, which means a random ephemeral
port will be chosen for the TCP listener by the OS. Additionally, since
no `DiscAddr` was specified, the same port that is chosen automatically
by the OS will also be used for the UDP listener in the discovery UDP
setup. This sometimes leads to test failures if the TCP listener picks a
free TCP port that is already taken for UDP. By specifying `DiscAddr:
":0"`, the UDP port will be chosen independently from the TCP port,
fixing the random failure.

See issue #29830.

Verified using
```
cd p2p
go test -c -race
stress ./p2p.test -test.run=TestServerPortMapping
...
5m0s: 4556 runs so far, 0 failures
```

The issue described above can technically lead to sporadic failures on
systems that specify a listen address via the `--port` flag of 0 while
not setting `--discovery.port`. Since the default is using port `30303`
and using a random ephemeral port is likely not used much to begin with,
not addressing the root cause might be acceptable.
2024-07-30 07:31:27 -06:00
..
discover p2p/discover: remove type encPubkey (#30172) 2024-07-18 11:09:02 +02:00
dnsdisc p2p/dnsdisc: using clear builtin func (#29418) 2024-04-04 12:19:48 +02:00
enode p2p: use netip.Addr where possible (#29891) 2024-06-05 19:31:04 +02:00
enr beacon/types, cmd/devp2p, p2p/enr: clean up uses of fmt.Errorf (#30182) 2024-07-25 00:32:58 +02:00
msgrate log: remove lazy, remove unused interfaces, unexport methods (#28622) 2023-12-05 11:54:44 +01:00
nat p2p/nat: return correct port for ExtIP NAT (#30234) 2024-07-27 10:18:05 +02:00
netutil p2p/netutil: fix comments (#29942) 2024-06-06 10:56:41 +03:00
rlpx p2p/rlpx: 2KB maximum size for handshake messages (#30029) 2024-06-20 14:08:54 +02:00
simulations p2p/simulations: update doc of HTTP endpoints (#29894) 2024-06-11 19:41:17 +02:00
tracker all: fix some typos (#25551) 2022-08-19 09:00:21 +03:00
dial_test.go p2p: initialize maps with known size (#27229) 2023-05-10 10:52:26 +02:00
dial.go p2p: use netip.Addr where possible (#29891) 2024-06-05 19:31:04 +02:00
message_test.go p2p: move rlpx into separate package (#21464) 2020-09-22 10:17:39 +02:00
message.go p2p: use atomic types (#27764) 2023-08-01 23:20:52 +02:00
metrics.go p2p: add inbound and outbound peers metric (#29424) 2024-04-02 21:18:28 +02:00
peer_error.go p2p: use errors.Is for error comparison (#24882) 2022-06-07 17:27:21 +02:00
peer_test.go p2p: move rlpx into separate package (#21464) 2020-09-22 10:17:39 +02:00
peer.go all: remove dependency on golang.org/exp (#29314) 2024-03-25 07:50:18 +01:00
protocol.go all: update golang/x/ext and fix slice sorting fallout (#27909) 2023-08-12 00:04:12 +02:00
server_nat_test.go p2p: fix flaky test TestServerPortMapping (#30241) 2024-07-30 07:31:27 -06:00
server_nat.go p2p: fix ip change log parameter (#30158) 2024-07-15 10:15:35 +02:00
server_test.go cmd/bootnode, p2p: support for alternate mapped ports (#26359) 2023-07-14 14:58:27 +02:00
server.go p2p: use package slices to sort in PeersInfo (#29957) 2024-06-09 22:50:22 +02:00
transport_test.go all: update license headers and AUTHORS from git history (#24947) 2022-05-24 20:39:40 +02:00
transport.go p2p, log, rpc: use errors.New to replace fmt.Errorf with no parameters (#29074) 2024-02-26 11:25:35 +02:00
util_test.go p2p: new dial scheduler (#20592) 2020-02-13 11:10:03 +01:00
util.go all: assign zero after resize in implementations of heap.Interface (#26296) 2022-12-05 13:49:54 +01:00