Skip to content

Commit

Permalink
Diagnostics for CI port conflict failures
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
teor2345 committed Feb 17, 2021
1 parent f670265 commit 79d45e7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions zebra-network/src/peer_set/initialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,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 {
Expand Down
4 changes: 2 additions & 2 deletions zebrad/src/components/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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: {:?}. \
Expand Down
8 changes: 4 additions & 4 deletions zebrad/src/components/tracing/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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. \
Expand All @@ -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);
}
Expand Down

0 comments on commit 79d45e7

Please sign in to comment.