clockworklabs/SpacetimeDB · error
failed to install Ctrl+C handler
Error message
failed to install Ctrl+C handler
What it means
Error "failed to install Ctrl+C handler" thrown in clockworklabs/SpacetimeDB.
Solutions
- Check that the platform supports signal handlers; ctrlc handlers fail on some platforms or sandboxed environments (e.g., certain containers, services without a console).
- Run the standalone server in an environment where SIGINT can be delivered (interactive shell or properly signaled container).
- If running as a service, rely on the service manager's stop signal (SIGTERM) handling instead of the Ctrl+C handler.
- Update the ctrlc crate / OS environment if handler registration fails due to missing privileges or signal mask restrictions.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at crates/standalone/src/subcommands/start.rs:288 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of clockworklabs/SpacetimeDB@9e0d92412f (2026-08-30).
Data as JSON: /api/errors/36d741220736a804.
Report an issue: GitHub.
Appendix: source
Thrown at crates/standalone/src/subcommands/start.rs:289
))?;
let notify = Arc::new(tokio::sync::Notify::new());
let shutdown_notify = notify.clone();
tokio::select! {
_ = pg_server::start_pg(notify.clone(), ctx, tcp_pg) => {},
_ = axum::serve(tcp, service).with_graceful_shutdown(async move {
shutdown_notify.notified().await;
}) => {},
_ = tokio::signal::ctrl_c() => {
println!("Shutting down servers...");
notify.notify_waiters(); // Notify all tasks
}
}
} else {
log::info!("PostgreSQL wire protocol server disabled");
axum::serve(tcp, service)
.with_graceful_shutdown(async {
tokio::signal::ctrl_c().await.expect("failed to install Ctrl+C handler");
log::info!("Shutting down server...");
})
.await?;
}
Ok(())
}
/// Check if a port is available on the requested host for both IPv4 and IPv6.
///
/// On macOS (and some other systems), `localhost` can resolve to both IPv4 (127.0.0.1)
/// and IPv6 (::1). If SpacetimeDB binds only to IPv4 but another service is using the
/// same port on IPv6, browsers may connect to the wrong service depending on which
/// address they try first.
///
/// This function checks both the requested IPv4 address and its IPv6 equivalent:
/// - 127.0.0.1 -> also checks ::1
/// - 0.0.0.0 -> also checks ::View on GitHub (pinned to 9e0d92412f)