How a 0.6s Reboot Race Froze Monitoring for 5 Days—While Showing 'Running'
#Python#Threading#Observability#Logging
The Symptom
After a node reboot, monitoring dashboards stopped receiving metrics from that host for 5 consecutive days. Yet systemctl status cheerfully reported the collector daemon as active (running), and grepping the log files for errors turned up nothing useful.
Two Hidden Bugs Working Together
- 0.6-second boot race: On reboot, the monitoring daemon started slightly before the underlying cluster service was ready. Its two worker threads failed initialization within 0.6 seconds and exited permanently without any retry loop—leaving the main process alive as an empty shell.
- Product-wide blank exception logs: While tracing why no error text appeared in the logs, we uncovered a base custom exception class that forgot to call
super().__init__(message). As a result,str(exc)evaluated to an empty string across the entire product, silently stripping error details from every logged exception.
The Fix
- Added bounded retry backoff to collector initialization so transient startup ordering never kills worker threads permanently.
- Fixed the custom exception base class to properly invoke
super().__init__(), restoring readable error diagnostics product-wide. - Connected process health checks to verify live worker threads rather than just PID existence.
Enjoyed this note or seen a similar bug?
Feel free to drop a line—always glad to exchange ideas with fellow engineers.