Diagnostics for CI port conflict failures (#1766)

Log a "Trying..." message before each listener opens, to see if the
delay is inside Zebra, or in the test harness or OS.

Also report the configured and actual ports where possible, for better
diagnostics.
This commit is contained in:
teor 2021-02-19 01:15:09 +10:00 committed by GitHub
parent 5424e1d8ba
commit e61b5e50a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 6 deletions

View File

@ -227,6 +227,7 @@ where
S: Service<(TcpStream, SocketAddr), Response = peer::Client, Error = BoxError> + Clone,
S::Future: Send + 'static,
{
info!("Trying to open Zcash protocol endpoint at {}...", addr);
let listener_result = TcpListener::bind(addr).await;
let listener = match listener_result {

View File

@ -12,13 +12,13 @@ impl MetricsEndpoint {
/// Create the component.
pub fn new(config: &ZebradConfig) -> Result<Self, FrameworkError> {
if let Some(addr) = config.metrics.endpoint_addr {
info!("Trying to open metrics endpoint at {}...", addr);
let endpoint_result = metrics_exporter_prometheus::PrometheusBuilder::new()
.listen_address(addr)
.install();
match endpoint_result {
Ok(endpoint) => {
Ok(()) => {
info!("Opened metrics endpoint at {}", addr);
endpoint
}
Err(e) => panic!(
"Opening metrics endpoint listener {:?} failed: {:?}. \

View File

@ -45,6 +45,7 @@ impl TracingEndpoint {
let service =
make_service_fn(|_| async { Ok::<_, hyper::Error>(service_fn(request_handler)) });
info!("Trying to open tracing endpoint at {}...", addr);
tokio_component
.rt
.as_ref()
@ -53,10 +54,7 @@ impl TracingEndpoint {
// try_bind uses the tokio runtime, so we
// need to construct it inside the task.
let server = match Server::try_bind(&addr) {
Ok(s) => {
info!("Opened tracing endpoint at {}", addr);
s
}
Ok(s) => s,
Err(e) => panic!(
"Opening tracing endpoint listener {:?} failed: {:?}. \
Hint: Check if another zebrad or zcashd process is running. \
@ -66,6 +64,8 @@ impl TracingEndpoint {
}
.serve(service);
info!("Opened tracing endpoint at {}", server.local_addr());
if let Err(e) = server.await {
error!("Server error: {}", e);
}