quickwit-oss/quickwit · error

registering a signal handler for SIGHUP should not fail

Error message

registering a signal handler for SIGHUP should not fail

What it means

listen_sighup registers a SIGHUP handler used to hot-reload TLS certificates. signal::unix::signal(SignalKind::hangup()) registration is expected to always succeed; the expect panics otherwise, since losing SIGHUP support would mean TLS certs can no longer be reloaded without a restart.

Source

Thrown at quickwit/quickwit-cli/src/service.rs:86

        println!(
            "{} Quickwit was forcefully shut down. Some data might not have been indexed.",
            "✘".color(RED_COLOR)
        );
        std::process::exit(1);
    });
}

async fn listen_sigterm() {
    signal::unix::signal(signal::unix::SignalKind::terminate())
        .expect("registering a signal handler for SIGTERM should not fail")
        .recv()
        .await;
    info!("SIGTERM received");
}

async fn listen_sighup() {
    let mut sighup = signal::unix::signal(signal::unix::SignalKind::hangup())
        .expect("registering a signal handler for SIGHUP should not fail");

    while sighup.recv().await.is_some() {
        info!("SIGHUP received");
        reload_tls_cert();
    }
}

impl RunCliCommand {
    pub fn parse_cli_args(mut matches: ArgMatches) -> anyhow::Result<Self> {
        let config_uri = matches
            .remove_one::<String>("config")
            .map(|uri_str| Uri::from_str(&uri_str))
            .expect("`config` should be a required arg.")?;
        let services = matches
            .remove_many::<String>("service")
            .map(|values| {
                let services: Result<HashSet<_>, _> = values
                    .into_iter()

View on GitHub (pinned to a39730c5cd)

Solutions

  1. Run in an environment that permits SIGHUP registration (standard Docker/K8s/systemd do).
  2. Fix container syscall allow-lists to include rt_sigaction.
  3. Handle the Err explicitly: log a warning that TLS hot-reload is disabled and skip the reload loop.

Example fix

// before
let mut sighup = signal::unix::signal(signal::unix::SignalKind::hangup())
    .expect("registering a signal handler for SIGHUP should not fail");
// after
let Ok(mut sighup) = signal::unix::signal(signal::unix::SignalKind::hangup()) else {
    error!("failed to register SIGHUP handler; TLS hot-reload disabled");
    return;
};
Defensive patterns

Strategy: try-catch

Try / catch

let Ok(mut sighup) = signal::unix::signal(signal::unix::SignalKind::hangup()) else {
    error!("SIGHUP handler unavailable; TLS hot-reload disabled");
    return;
};

Prevention

When it happens

Trigger: Executing the quickwit serve command on Unix when registering the SIGHUP handler fails — signal number registration rejected by the OS or runtime constraints.

Common situations: Same sandbox causes as SIGTERM: seccomp-restricted containers, blocked signals inherited from a supervisor, minimal libc environments.

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.

Related errors


AI-assisted analysis of quickwit-oss/quickwit@a39730c5cd (2026-09-08). Data as JSON: /api/errors/b2d80db4cd07a196. Report an issue: GitHub.