Module diagnostics

Module diagnostics 

Source
Expand description

Runtime diagnostics for production debugging

Provides a SIGQUIT (kill -3) handler that dumps runtime statistics to stderr, similar to JVM thread dumps. This is useful for debugging production issues without stopping the process.

§Usage

Send SIGQUIT to a running Seq process:

kill -3 <pid>

The process will dump diagnostics to stderr and continue running.

§Signal Safety

Signal handlers can only safely call async-signal-safe functions. Our dump_diagnostics() does I/O and acquires locks, which is NOT safe to call directly from a signal handler. Instead, we spawn a dedicated thread that waits for signals using signal-hook’s iterator API, making all the I/O operations safe.

Functions§

dump_diagnostics
Dump runtime diagnostics to stderr
install_signal_handler
Install the SIGQUIT signal handler for diagnostics