{"record":{"id":"ea0e3d6b352c556c","repo":"vectordotdev/vector","slug":"failed-to-set-up-sigquit-handler","errorCode":null,"errorMessage":"Failed to set up SIGQUIT handler.","messagePattern":"Failed to set up SIGQUIT handler\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/signal.rs","lineNumber":199,"sourceCode":"    pub fn clear(&mut self) {\n        for shutdown_tx in self.shutdown_txs.drain(..) {\n            // An error just means the channel was already shut down; safe to ignore.\n            _ = shutdown_tx.send(());\n        }\n    }\n}\n\n/// Signals from OS/user.\n#[cfg(unix)]\nfn os_signals(runtime: &Runtime) -> impl Stream<Item = SignalTo> + use<> {\n    use tokio::signal::unix::{SignalKind, signal};\n\n    // The `signal` function must be run within the context of a Tokio runtime.\n    runtime.block_on(async {\n        let mut sigint = signal(SignalKind::interrupt()).expect(\"Failed to set up SIGINT handler.\");\n        let mut sigterm =\n            signal(SignalKind::terminate()).expect(\"Failed to set up SIGTERM handler.\");\n        let mut sigquit = signal(SignalKind::quit()).expect(\"Failed to set up SIGQUIT handler.\");\n        let mut sighup = signal(SignalKind::hangup()).expect(\"Failed to set up SIGHUP handler.\");\n\n        async_stream::stream! {\n            loop {\n                let signal = tokio::select! {\n                    _ = sigint.recv() => {\n                        info!(message = \"Signal received.\", signal = \"SIGINT\");\n                        SignalTo::Shutdown(None)\n                    },\n                    _ = sigterm.recv() => {\n                        info!(message = \"Signal received.\", signal = \"SIGTERM\");\n                        SignalTo::Shutdown(None)\n                    } ,\n                    _ = sigquit.recv() => {\n                        info!(message = \"Signal received.\", signal = \"SIGQUIT\");\n                        SignalTo::Quit\n                    },\n                    _ = sighup.recv() => {","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/src/signal.rs#L181-L217","documentation":"The Unix signal handler registers tokio's `signal` streams for SIGINT, SIGTERM, SIGQUIT, and SIGHUP inside a dedicated runtime. Each registration is asserted; failing to install the SIGQUIT handler panics with \"Failed to set up SIGQUIT handler.\". Registration fails when signal handling cannot be set up at the OS level.","triggerScenarios":"Calling the signal setup function outside a Tokio runtime context or where the runtime has been shut down, or when the OS refuses to install the handler (signal mask/rlimit issues, unsupported platform).","commonSituations":"Running vector in minimal containers where signal syscalls are blocked by seccomp profiles; calling the signal machinery from a non-async context; ephemeral runtimes torn down before registration.","solutions":["Ensure the signal setup is invoked from within an active Tokio runtime (the wrapper already uses block_on — do not call it from a torn-down runtime).","Check the container seccomp/apparmor profile permits `rt_sigaction`/signalfd syscalls.","Verify the platform supports tokio's signal driver (Unix only path) and that signal handlers aren't exhausted."],"exampleFix":"// before\ntokio::runtime::Runtime::new().unwrap().shutdown_timeout(Duration::from_secs(0));\nsignal_handler(); // panics: runtime gone\n// after\nlet rt = tokio::runtime::Runtime::new().unwrap();\nrt.block_on(signal_handler()); // register while runtime is live","handlingStrategy":"try-catch","validationCode":"// Ensure we are inside a runtime before installing handlers:\nassert!(tokio::runtime::Handle::try_current().is_ok(), \"signal setup requires an active tokio runtime\");","typeGuard":null,"tryCatchPattern":"match tokio::signal::unix::signal(tokio::signal::unix::SignalKind::quit()) {\n    Ok(rx) => { /* proceed */ }\n    Err(e) => { eprintln!(\"SIGQUIT handler unavailable: {e}; falling back to default termination\"); }\n}","preventionTips":["Only call signal setup from within a live Tokio runtime.","Check container seccomp profiles allow signalfd/rt_sigaction syscalls.","Test signal handling in the target runtime environment (Docker, systemd) before production rollout."],"tags":["signals","unix","runtime"],"backgroundTag":"signal-handler-setup-failed","analyzedSha":"bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013","analyzedAt":"2026-09-16T02:53:35.741Z","contentChangedAt":"2026-09-16T02:53:35.741Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}