block/buzz · info · anyhow::Error
pool initialization cancelled by shutdown
Error message
pool initialization cancelled by shutdown
What it means
During agent-pool startup each agent gets a 60-second initialize window, raced via a biased tokio::select! against the shutdown signal. If shutdown fires first, the harness cleanly shuts that agent down, releases the pool slots, and returns this error instead of an initialize timeout. It is the designed cancellation path for SIGTERM during startup, not a defect.
Source
Thrown at crates/buzz-acp/src/lib.rs:5485
for i in 0..startup.agents as usize {
let spawn_result = AcpClient::spawn(
&startup.command,
&startup.args,
&startup.extra_env,
startup.has_generated_codex_config,
)
.await;
match spawn_result {
Ok(mut acp) => {
acp.set_observer(startup.observer.clone(), i);
let initialize = tokio::time::timeout(Duration::from_secs(60), acp.initialize());
let initialize_result = match shutdown.as_mut() {
Some(shutdown) => tokio::select! {
biased;
_ = shutdown.changed() => {
acp.shutdown().await;
shutdown_agent_slots(&mut agent_slots).await;
return Err(anyhow::anyhow!("pool initialization cancelled by shutdown"));
}
result = initialize => result,
},
None => initialize.await,
};
match initialize_result {
Ok(Ok(init_result)) => {
tracing::info!(agent = i, "agent initialized: {init_result}");
let protocol_version =
init_result["protocolVersion"].as_u64().unwrap_or(1) as u32;
tracing::info!(
agent = i,
name = init_result
.get("agentInfo")
.or_else(|| init_result.get("serverInfo"))
.and_then(|info| info.get("name"))
.and_then(|v| v.as_str())
.unwrap_or("unknown"),View on GitHub (pinned to 6c35e82bd5)
Solutions
- If the shutdown was intentional, no fix is needed — this is a clean cancellation
- If the signal is spurious: find the sender (container probe timeouts, supervisor policy) and lengthen the grace period past agent init time
- If agents initialize slowly, investigate why they approach the 60s window (binary cold start, model downloads)
Defensive patterns
Strategy: retry
Try / catch
// Distinguish intentional shutdown from a crashed supervisor when wrapping the harness
let result = run_harness(cfg).await;
if let Err(e) = &result {
if e.to_string().contains("cancelled by shutdown") && !shutdown_was_requested() {
tracing::error!("shutdown signal arrived unexpectedly — investigate supervisor/probes");
}
} Prevention
- Size container termination grace periods larger than worst-case agent init time (the 60s window)
- Don't set liveness probes so tight that they kill pods mid-initialization
- Log the shutdown source alongside this error so operators can tell SIGTERM from a probe kill
When it happens
Trigger: ctrl-C, SIGTERM, SIGQUIT, or a supervisor stop signal arrives while agents are still inside their 60s initialize() window; the biased select favors shutdown.changed() and aborts pool init.
Common situations: Kubernetes/container runtime killing the pod during a slow agent startup (aggressive liveness probe or short grace period); systemd restart loops; the operator interrupting a stuck startup manually.
Related errors
- Shutdown task failed: {e}
- install SIGTERM handler
- all {} agents failed to start — cannot continue
- upload cancelled
- Media fetch cancelled
AI-assisted analysis of block/buzz@6c35e82bd5 (2026-08-20).
Data as JSON: /api/errors/0f94a7af6e372b4d.
Report an issue: GitHub.