"vllm/vscode:/vscode.git/clone" did not exist on "acb54ca8e11a72592de963cf2f7477635349d526"
Unverified Commit fa4ce46c authored by KrishnanPrash's avatar KrishnanPrash Committed by GitHub
Browse files

fix: Improve Error Messaging for port/address already in use error (#3587)


Signed-off-by: default avatarKrishnan Prashanth <kprashanth@nvidia.com>
parent b5e762b2
......@@ -267,9 +267,27 @@ impl HttpService {
}
}
} else {
let listener = tokio::net::TcpListener::bind(addr)
.await
.unwrap_or_else(|_| panic!("could not bind to address: {address}"));
let listener = tokio::net::TcpListener::bind(addr).await.map_err(|e| {
tracing::error!(
protocol = %protocol,
address = %address,
error = %e,
"Failed to bind server to address"
);
match e.kind() {
std::io::ErrorKind::AddrInUse => anyhow::anyhow!(
"Failed to start {} server: port {} already in use. Use --http-port to specify a different port.",
protocol,
self.port
),
_ => anyhow::anyhow!(
"Failed to start {} server on {}: {}",
protocol,
address,
e
),
}
})?;
axum::serve(listener, router)
.with_graceful_shutdown(observer.cancelled_owned())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment