{"record":{"id":"36d741220736a804","repo":"clockworklabs/SpacetimeDB","slug":"failed-to-install-ctrl-c-handler","errorCode":null,"errorMessage":"failed to install Ctrl+C handler","messagePattern":"failed to install Ctrl\\+C handler","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/standalone/src/subcommands/start.rs","lineNumber":289,"sourceCode":"        ))?;\n\n        let notify = Arc::new(tokio::sync::Notify::new());\n        let shutdown_notify = notify.clone();\n        tokio::select! {\n            _ = pg_server::start_pg(notify.clone(), ctx, tcp_pg) => {},\n            _ = axum::serve(tcp, service).with_graceful_shutdown(async move  {\n                shutdown_notify.notified().await;\n            }) => {},\n            _ = tokio::signal::ctrl_c() => {\n                println!(\"Shutting down servers...\");\n                notify.notify_waiters(); // Notify all tasks\n            }\n        }\n    } else {\n        log::info!(\"PostgreSQL wire protocol server disabled\");\n        axum::serve(tcp, service)\n            .with_graceful_shutdown(async {\n                tokio::signal::ctrl_c().await.expect(\"failed to install Ctrl+C handler\");\n                log::info!(\"Shutting down server...\");\n            })\n            .await?;\n    }\n\n    Ok(())\n}\n\n/// Check if a port is available on the requested host for both IPv4 and IPv6.\n///\n/// On macOS (and some other systems), `localhost` can resolve to both IPv4 (127.0.0.1)\n/// and IPv6 (::1). If SpacetimeDB binds only to IPv4 but another service is using the\n/// same port on IPv6, browsers may connect to the wrong service depending on which\n/// address they try first.\n///\n/// This function checks both the requested IPv4 address and its IPv6 equivalent:\n/// - 127.0.0.1 -> also checks ::1\n/// - 0.0.0.0 -> also checks ::","sourceCodeStart":271,"sourceCodeEnd":307,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/9e0d92412ff2248f401a8ad12d535f2b5ac30912/crates/standalone/src/subcommands/start.rs#L271-L307","documentation":"Error \"failed to install Ctrl+C handler\" thrown in clockworklabs/SpacetimeDB.","triggerScenarios":"Thrown at crates/standalone/src/subcommands/start.rs:288 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9e0d92412ff2248f401a8ad12d535f2b5ac30912","analyzedAt":"2026-08-30T19:52:08.972Z","contentChangedAt":"2026-08-30T19:52:08.972Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}