Watchdog
Overview
ProxySQL's Watchdog is a monitoring mechanism introduced in version 1.4.4 that supervises critical MySQL worker and auxiliary threads for system stability. It is enabled by default.
Key Functionality
The watchdog detects when threads miss heartbeats, indicating potential blocking or system hangs. If the watchdog detects that any of these threads are missing heartbeats for an extended period, it assumes they are blocked and automatically asserts.
Default Behaviour
- Enabled by default
- Checks heartbeats every
mysql-poll_timeout+ 1000 milliseconds (approximately 3 seconds) - Triggers when
restart_on_missing_heartbeatsthreshold is reached (default: 10 missed heartbeats)
Recovery Mechanism
When the watchdog detects a hang, ProxySQL crashes intentionally with a core dump. The parent process (which does not serve traffic) automatically restarts the child process responsible for handling traffic.
Configuration
| Setting | Description | Default |
|---|---|---|
restart_on_missing_heartbeats | Number of missed heartbeats before asserting. Set to 0 to log without restarting. | 10 |
Configured in the global configuration file section.
Error Log
When triggered:
Watchdog: reached %u missed heartbeats. Aborting!
GDB Compatibility
The watchdog will not assert if ProxySQL is intentionally paused via signals like SIGSTOP or
SIGINT in gdb.
Disabling Daemon Mode
Run with -f to prevent forking, which also prevents the parent process from restarting the child:
proxysql -f -c /etc/proxysql.cnf