more logs, timeouts and general duct taping

This commit is contained in:
Jędrzej Stuczyński
2026-05-25 11:38:51 +01:00
parent b5a8b9d283
commit dc0835f1f3
11 changed files with 67 additions and 28 deletions
Generated
+2 -2
View File
@@ -7747,7 +7747,7 @@ dependencies = [
[[package]]
name = "nym-node-status-agent"
version = "2.0.1-rc2"
version = "2.0.1-rc3"
dependencies = [
"anyhow",
"clap",
@@ -7768,7 +7768,7 @@ dependencies = [
[[package]]
name = "nym-node-status-api"
version = "4.6.2-rc4"
version = "4.6.2-rc5"
dependencies = [
"ammonia",
"anyhow",
+7 -7
View File
@@ -330,7 +330,7 @@ func pingTwoHop(req TwoHopNetstackRequest) (NetstackResponse, error) {
// Ping hosts (DNS resolution test)
for _, host := range req.PingHosts {
consecutiveFailures := 0
maxConsecutiveFailures := 3
maxConsecutiveFailures := 2
for i := uint8(0); i < req.NumPing; i++ {
log.Printf("Pinging %s seq=%d (via two-hop)", host, i)
@@ -355,7 +355,7 @@ func pingTwoHop(req TwoHopNetstackRequest) (NetstackResponse, error) {
// Ping IPs (direct connectivity test)
for _, ip := range req.PingIps {
consecutiveFailures := 0
maxConsecutiveFailures := 3
maxConsecutiveFailures := 2
for i := uint8(0); i < req.NumPing; i++ {
log.Printf("Pinging %s seq=%d (via two-hop)", ip, i)
@@ -375,7 +375,7 @@ func pingTwoHop(req TwoHopNetstackRequest) (NetstackResponse, error) {
}
if i < req.NumPing-1 {
time.Sleep(5 * time.Second)
time.Sleep(1 * time.Second)
}
}
}
@@ -481,7 +481,7 @@ func ping(req NetstackRequestGo) (NetstackResponse, error) {
for _, host := range req.PingHosts {
consecutiveFailures := 0
maxConsecutiveFailures := 3
maxConsecutiveFailures := 2
for i := uint8(0); i < req.NumPing; i++ {
log.Printf("Pinging %s seq=%d", host, i)
@@ -509,7 +509,7 @@ func ping(req NetstackRequestGo) (NetstackResponse, error) {
for _, ip := range req.PingIps {
consecutiveFailures := 0
maxConsecutiveFailures := 3
maxConsecutiveFailures := 2
for i := uint8(0); i < req.NumPing; i++ {
log.Printf("Pinging %s seq=%d", ip, i)
@@ -533,7 +533,7 @@ func ping(req NetstackRequestGo) (NetstackResponse, error) {
// Sleep between ping attempts (except for the last one)
if i < req.NumPing-1 {
time.Sleep(5 * time.Second)
time.Sleep(1 * time.Second)
}
}
}
@@ -689,7 +689,7 @@ func downloadFileWithRetry(urls []string, timeoutSecs uint64, tnet *netstack.Net
maxRetries := 3
baseDelay := 1 * time.Second
consecutiveFailures := 0
maxConsecutiveFailures := 3
maxConsecutiveFailures := 2
for attempt := 0; attempt < maxRetries; attempt++ {
// Shuffle URLs for each attempt to try different ones
+18 -7
View File
@@ -26,7 +26,7 @@ use nym_credentials_interface::{CredentialSpendingData, TicketType};
use nym_ip_packet_client::IprClientConnect;
use nym_ip_packet_requests::{IpPair, codec::MultiIpPacketCodec};
use nym_lp::peer::DHKeyPair;
use nym_registration_client::LpRegistrationClient;
use nym_registration_client::{LpClientError, LpRegistrationClient};
use nym_sdk::NymNetworkDetails;
use nym_sdk::mixnet::{MixnetClient, MixnetClientBuilder, NodeIdentity, Recipient, Socks5};
use nym_topology::HardcodedTopologyProvider;
@@ -186,7 +186,11 @@ pub async fn lp_registration_probe(
// LpRegistrationClient uses packet-per-connection model - connect() is gone,
// connection is established during handshake and registration automatically.
info!("Performing LP handshake at {lp_address}...");
match client.perform_handshake().await {
let handshake_result =
tokio::time::timeout(Duration::from_secs(15), client.perform_handshake())
.await
.unwrap_or_else(|_| Err(LpClientError::HandshakeTimeout));
match handshake_result {
Ok(_) => {
info!("LP handshake completed successfully");
lp_outcome.can_connect = true; // Connection succeeded if handshake succeeded
@@ -209,16 +213,23 @@ pub async fn lp_registration_probe(
// Register using the new packet-per-connection API (returns GatewayData directly)
let ticket_type = TicketType::V1WireguardEntry;
let gateway_data = match client
.register_dvpn(
let register_result = tokio::time::timeout(
Duration::from_secs(15),
client.register_dvpn(
&mut rng09,
&wg_keypair,
&gateway_identity,
bandwidth_controller,
ticket_type,
)
.await
{
),
)
.await
.unwrap_or_else(|_| {
Err(LpClientError::Other(
"LP registration timed out after 15s".to_string(),
))
});
let gateway_data = match register_result {
Ok(data) => data,
Err(e) => {
let error_msg = format!("LP registration failed: {}", e);
+1 -1
View File
@@ -43,7 +43,7 @@ impl Default for NetstackArgs {
fn default() -> Self {
Self {
netstack_download_timeout_sec: 30,
metadata_timeout_sec: 30,
metadata_timeout_sec: 10,
netstack_v4_dns: String::from("1.1.1.1"),
netstack_v6_dns: String::from("2606:4700:4700::1111"),
netstack_num_ping: 5,
+2 -2
View File
@@ -38,9 +38,9 @@ impl Default for Socks5Args {
"https://cloudflare-eth.com".to_string(),
"https://ethereum-rpc.publicnode.com".to_string(),
],
mixnet_client_timeout_sec: 30,
mixnet_client_timeout_sec: 20,
test_count: 10,
failure_count_cutoff: 3,
failure_count_cutoff: 2,
}
}
}
+14 -1
View File
@@ -135,7 +135,20 @@ impl Probe {
// Mixnet client start
let mixnet_client = if self.config.test_mode.needs_mixnet() {
Some(disconnected_mixnet_client.connect_to_mixnet().await)
Some(
tokio::time::timeout(
std::time::Duration::from_secs(30),
disconnected_mixnet_client.connect_to_mixnet(),
)
.await
.unwrap_or_else(|_| {
Err(std::io::Error::new(
std::io::ErrorKind::TimedOut,
"mixnet connect timed out after 30s",
)
.into())
}),
)
} else {
// Make sure keys are generated, in case we don't start the mixnet client
let key_store = storage.key_store();
@@ -3,7 +3,7 @@
[package]
name = "nym-node-status-agent"
version = "2.0.1-rc2"
version = "2.0.1-rc3"
authors.workspace = true
edition.workspace = true
license.workspace = true
@@ -3,6 +3,8 @@ use clap::{Parser, Subcommand};
use nym_bin_common::bin_info;
use nym_crypto::asymmetric::ed25519::PrivateKey;
use std::{env, sync::OnceLock};
use tokio::time::Instant;
use tracing::info;
pub(crate) mod generate_keypair;
pub(crate) mod run_probe;
@@ -81,17 +83,21 @@ impl Args {
match parse_server_config(s) {
Ok(config) => servers.push(config),
Err(e) => {
tracing::error!("Invalid server config '{}': {}", s, e);
anyhow::bail!("Invalid server config '{}': {}", s, e);
tracing::error!("Invalid server config '{s}': {e}");
anyhow::bail!("Invalid server config '{s}': {e}");
}
}
}
run_probe::run_probe(&servers, args.probe_config, log_capture)
let start = Instant::now();
let res = run_probe::run_probe(&servers, args.probe_config, log_capture)
.await
.inspect_err(|err| {
tracing::error!("{err}");
})?
});
info!("Probe completed in {:.2}ms", start.elapsed().as_secs_f32());
let _ = res?;
}
Command::GenerateKeypair { path } => {
let path = path
@@ -3,7 +3,7 @@
[package]
name = "nym-node-status-api"
version = "4.6.2-rc4"
version = "4.6.2-rc5"
authors.workspace = true
edition.workspace = true
license.workspace = true
@@ -76,7 +76,7 @@ pub(crate) struct Cli {
#[clap(
long,
default_value = "300",
default_value = "450",
env = "NODE_STATUS_API_TESTRUN_REFRESH_INTERVAL"
)]
#[arg(value_parser = parse_duration_std)]
@@ -11,6 +11,7 @@ use crate::{
};
use axum::Json;
use axum::extract::DefaultBodyLimit;
use axum::extract::rejection::JsonRejection;
use axum::{
Router,
extract::{Path, State},
@@ -120,8 +121,16 @@ async fn request_testrun(
async fn submit_testrun(
Path(submitted_testrun_id): Path<i32>,
State(state): State<AppState>,
Json(submitted_result): Json<submit_results::SubmitResults>,
submitted_result: Result<Json<submit_results::SubmitResults>, JsonRejection>,
) -> HttpResult<StatusCode> {
let submitted_result = match submitted_result {
Ok(json) => json.0,
Err(err) => {
tracing::error!("json got rejected: {err}");
return Err(HttpError::invalid_input(err));
}
};
state.authenticate_agent_submission(&submitted_result)?;
debug!("attempting to submit testrun {submitted_testrun_id} from an authenticated agent");