Test Details Overview

Bind an ephemeral peering port without SO_REUSEADDR (#5283)

* Bind an ephemeral peering port without SO_REUSEADDR

On macOS and BSD, a port 0 wildcard bind with SO_REUSEADDR can be
handed a port another socket already listens on with a specific
address, such as [::1]. Connections to that address then reach the
other socket instead of the node. Test nodes advertise [::1]:port, so
a peer occasionally handshakes with an unrelated local server and
system::add_node times out.

An ephemeral port is never in TIME_WAIT, so it needs no SO_REUSEADDR.
The Windows exclusion moves from #ifndef _WIN32 to is_windows_build ().

* Rename the free test port helper to pick_free_port and drop SO_REUSEADDR

With SO_REUSEADDR, a port 0 bind on macOS and BSD can return a port
another socket already holds on a specific address, so the helper
could report a held port as free. It now binds the IPv6 wildcard, the
family the node listens on, and lets the acceptor close itself.

* Bind an ephemeral IPC TCP port without SO_REUSEADDR

The IPC acceptor came from asio's bind-and-listen constructor, which
sets SO_REUSEADDR before binding, so the set_option after it had no
effect. On macOS and BSD a port 0 wildcard bind with SO_REUSEADDR can
be handed a port another socket holds on [::1], and IPC clients that
connect to [::1] then reach that socket.

The constructor now gets SO_REUSEADDR only for a configured TCP port
and never on Windows, as the peering listener does. Domain sockets
have no port and no longer set it.

__________

Type: commit

Hash: 229e5a040a4a2c59ccc9d0d013fe8118e0c69ec4

Created: today

__________

gr0v1ty/nano-node:229e5a040a4a2c59ccc9d0d013fe8118e0c69ec4

Test Results

Test Case Status Duration Median Deviation Log Graph
5n4pr_conf_10k_bintree PASS 114 s 1.0 s GitHub job logs Show
5n4pr_conf_10k_change PASS 115 s -20.0 s GitHub job logs Show
5n4pr_conf_change_dependant PASS 137 s 22.0 s GitHub job logs -
5n4pr_conf_change_independant PASS 112 s 0.0 s GitHub job logs -
5n4pr_conf_send_dependant PASS 201 s 87.0 s GitHub job logs -
5n4pr_conf_send_independant PASS 111 s -2.0 s GitHub job logs -
5n4pr_rocks_10k_bintree PASS 98 s -15.0 s GitHub job logs -
5n4pr_rocks_10k_change PASS 156 s -4.0 s GitHub job logs -