macro_rules! halt { ($($arg:expr),* $(,)?) => { ... }; }
tracing_
only.Expand description
Halts the process.
halt
forwards the provided arguments to the tracing::warn
macro, then
terminates the process with exit code 2.
Halting a process is a middle ground between a graceful shutdown and a panic. Use halts for errors that are severe enough to require shutting down the process, but not severe enough to be considered a crash. Halts are not intended to be reported to error tracking tools (e.g., Sentry).
There are two common classes of errors that trigger a halt:
-
An error that indicates a new process has taken over (e.g., an error indicating that the process’s leader epoch has expired).
-
A retriable error where granular retry logic would be tricky enough to write that it has not yet been worth it. Since restarting from a fresh process must always be correct, forcing a restart is an easy way to tap into the existing whole-process retry logic. Use halt judiciously in these cases, as restarting a process can be inefficient (e.g., mandatory restart backoff, rehydrating expensive state).