Skip to content

Commit e213129

Browse files
RoyLinRoyLin
authored andcommitted
robustness: warn on heartbeat write failure (avoid silent liveness restart-loop)
1 parent fc77792 commit e213129

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
All notable changes to a3s-observer will be documented in this file.
44

5+
## [Unreleased]
6+
7+
### Changed
8+
9+
- The collector warns if the liveness heartbeat write fails — an unwritable
10+
`A3S_OBSERVER_HEARTBEAT` path would otherwise cause a silent livenessProbe restart-loop.
11+
512
## [0.6.0] — exec intervention + fileguard hot-reload
613

714
### Added / Changed

a3s-observer-collector/src/main.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,12 @@ async fn main() -> anyhow::Result<()> {
170170
// livenessProbe can detect a wedged collector (file goes stale → restart the pod).
171171
let heartbeat = std::env::var("A3S_OBSERVER_HEARTBEAT")
172172
.unwrap_or_else(|_| "/run/a3s-observer.alive".into());
173-
let _ = std::fs::write(&heartbeat, b"ok");
173+
if let Err(e) = std::fs::write(&heartbeat, b"ok") {
174+
// Warn loudly: a livenessProbe watching a never-written file would false-restart.
175+
tracing::warn!(path = %heartbeat, error = %e,
176+
"heartbeat write failed — set A3S_OBSERVER_HEARTBEAT to a writable path, or a \
177+
livenessProbe on it will restart-loop the pod");
178+
}
174179

175180
let mut sigint = tokio::signal::unix::signal(tokio::signal::unix::SignalKind::interrupt())?;
176181
let mut sigterm = tokio::signal::unix::signal(tokio::signal::unix::SignalKind::terminate())?;

0 commit comments

Comments
 (0)