You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We hadn't seen this error for a while but it has just popped up in our CI. I don't think it's related to the new cross-feature testing.
thread 'main' panicked at florestad/src/json_rpc/server.rs:672:17:
Could not start HTTP JSON-RPC server at 127.0.0.1:38969: Address already in use (os error 98)
Error explanation
In floresta-cli tests, we temporarily bind to an available port, release it, and pass it to florestad. This way we know on the client side which port to use for the JSON-RPC client:
let port = get_available_port();let fld = Command::new(&florestad_path)// ...// Pass the port to florestad.args(["--rpc-address",&format!("127.0.0.1:{}", port)])// ...// Use the fetched port for clientlet client = Client::new(format!("http://127.0.0.1:{port}"));
To ensure the port is released by the OS before florestad re-binds to it, I added a 100ms delay in get_available_port.
This has worked so far, but it's not robust: there's a brief window between floresta-cli's initial binding and florestad's re-binding where another process could claim the port.
I think the best solution is for florestad to bind directly to an available port and output this port via stdout, allowing floresta-cli to know which port to use as a client.
The text was updated successfully, but these errors were encountered:
I think the best solution is for florestad to bind directly to an available port and output this port via stdout, allowing floresta-cli to know which port to use as a client.
Sounds like something doable, you just have to change the logic of how we log the port used and find this on stdout before using floresta-cli right? Sounds like the only annoying part would be to find the port and use it in the rest of the script.
We hadn't seen this error for a while but it has just popped up in our CI. I don't think it's related to the new cross-feature testing.
Error explanation
In
floresta-cli
tests, we temporarily bind to an available port, release it, and pass it toflorestad
. This way we know on the client side which port to use for the JSON-RPC client:To ensure the port is released by the OS before
florestad
re-binds to it, I added a 100ms delay inget_available_port
.This has worked so far, but it's not robust: there's a brief window between
floresta-cli
's initial binding andflorestad
's re-binding where another process could claim the port.I think the best solution is for
florestad
to bind directly to an available port and output this port viastdout
, allowingfloresta-cli
to know which port to use as a client.The text was updated successfully, but these errors were encountered: