#watchdog #deadlock #threading #service

vigil

Provides a liveness checking watchdog for detecting deadlocks/livelocks/starvation etc

3 unstable releases

0.2.1 Jan 19, 2023
0.2.0 May 11, 2018
0.1.0 May 11, 2018

#584 in Concurrency

Download history 158/week @ 2024-11-16 154/week @ 2024-11-23 213/week @ 2024-11-30 201/week @ 2024-12-07 104/week @ 2024-12-14 41/week @ 2024-12-21 59/week @ 2024-12-28 199/week @ 2025-01-04 80/week @ 2025-01-11 186/week @ 2025-01-18 225/week @ 2025-01-25 127/week @ 2025-02-01 105/week @ 2025-02-08 96/week @ 2025-02-15 163/week @ 2025-02-22 83/week @ 2025-03-01

456 downloads per month

Apache-2.0/MIT

11KB
171 lines

Vigil

Crates.io - Vigil Build Status License: MIT License: Apache-2.0

Software watchdog library for Rust services.

Documentation

https://docs.rs/vigil/

Usage

Install from crates.io by adding vigil to your Cargo.toml:

[dependencies]
vigil = "0.1"

Now you can create a Vigil instance which the watched code must notify every so often. If the watched code misses too many notification ticks, the pre-programmed callbacks will be fired to allow you to handle the situation (gather diagnostics, raise an alarm, cancel the stalled task, or even kill the whole process).

let vigil = Vigil::create(10_000,
                          Some(|| warn!("Watched code missed a watchdog check"),
                          Some(|| error!("Watched code missed multiple watchdog checks!"),
                          Some(|| { error!("Deadlock detected, exiting"); std::process::exit(101));

loop {
  do_work();
  vigil.notify();
}

Dependencies

~86KB