From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Build User Date: Mon, 1 Jun 2026 00:51:00 -0500 Subject: [PATCH] Add timeout to keyring subprocess to prevent hanging on AIX The keyring subprocess provider can hang indefinitely on AIX when the keyring command doesn't respond. This patch adds a 30-second timeout to prevent tests from hanging forever. --- crates/uv-auth/src/keyring.rs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/crates/uv-auth/src/keyring.rs b/crates/uv-auth/src/keyring.rs index 1111111..2222222 100644 --- a/crates/uv-auth/src/keyring.rs +++ b/crates/uv-auth/src/keyring.rs @@ -1,4 +1,5 @@ use std::{io::Write, process::Stdio}; +use std::time::Duration; use tokio::process::Command; use tracing::{debug, instrument, trace, warn}; use uv_redacted::DisplaySafeUrl; @@ -289,9 +290,22 @@ impl KeyringProvider { .inspect_err(|err| warn!("Failure running `keyring` command: {err}")) .ok()?; - let output = child - .wait_with_output() - .await + // Add a timeout to prevent hanging indefinitely on AIX + let timeout_duration = Duration::from_secs(30); + let output = match tokio::time::timeout(timeout_duration, child.wait_with_output()).await { + Ok(result) => result, + Err(_) => { + warn!( + "Timeout waiting for `keyring` command after {} seconds. \ + This may indicate the keyring backend is not responding on this system. \ + Consider using a different keyring provider or providing credentials directly.", + timeout_duration.as_secs() + ); + return None; + } + }; + + let output = output .inspect_err(|err| warn!("Failed to wait for `keyring` output: {err}")) .ok()?; -- 2.43.0