mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-18 05:18:30 +00:00
Prevent port re-use in HTTP API tests (#4745)
## Issue Addressed
CI is plagued by `AddrAlreadyInUse` failures, which are caused by race conditions in allocating free ports.
This PR removes all usages of the `unused_port` crate for Lighthouse's HTTP API, in favour of passing `:0` as the listen address. As a result, the listen address isn't known ahead of time and must be read from the listening socket after it binds. This requires tying some self-referential knots, which is a little disruptive, but hopefully doesn't clash too much with Deneb 🤞
There are still a few usages of `unused_tcp4_port` left in cases where we start external processes, like the `watch` Postgres DB, Anvil, Geth, Nethermind, etc. Removing these usages is non-trivial because it's hard to read the port back from an external process after starting it with `--port 0`. We might be able to do something on Linux where we read from `/proc/`, but I'll leave that for future work.
This commit is contained in:
5
Cargo.lock
generated
5
Cargo.lock
generated
@@ -601,7 +601,6 @@ dependencies = [
|
||||
"tree_hash",
|
||||
"tree_hash_derive",
|
||||
"types",
|
||||
"unused_port",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2583,7 +2582,9 @@ dependencies = [
|
||||
name = "execution_layer"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"arc-swap",
|
||||
"async-trait",
|
||||
"axum",
|
||||
"builder_client",
|
||||
"bytes",
|
||||
"environment",
|
||||
@@ -2598,6 +2599,7 @@ dependencies = [
|
||||
"hash-db",
|
||||
"hash256-std-hasher",
|
||||
"hex",
|
||||
"hyper",
|
||||
"jsonwebtoken",
|
||||
"keccak-hash",
|
||||
"lazy_static",
|
||||
@@ -3381,7 +3383,6 @@ dependencies = [
|
||||
"tokio-stream",
|
||||
"tree_hash",
|
||||
"types",
|
||||
"unused_port",
|
||||
"warp",
|
||||
"warp_utils",
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user