G0.3: watchdog giu 15s khi attach-in-flight (SHM flag) + RAII guard trong attach job (fix kill nham khi GUI mo)

This commit is contained in:
2026-08-15 19:00:32 +07:00
parent 2f7861820e
commit 5313d85926
6 changed files with 41 additions and 3 deletions
+16 -1
View File
@@ -383,6 +383,21 @@ pub fn run() {
false
}
});
// G0.3: an openGUI attach job (reload/attachView on the
// bridge worker) can legitimately outlast the 3s stall
// deadline if it blocks the audio loop's message pump —
// do not kill the bridge for that. Real stalls are still
// caught: attach never takes > 15s; a dead bridge leaves
// the flag stuck and is restarted after the longer wait.
let attach_deadline = guard
.as_ref()
.map(|s| s.attach_in_flight())
.unwrap_or(false);
let stall_deadline = if attach_deadline {
std::time::Duration::from_secs(15)
} else {
std::time::Duration::from_secs(3)
};
if advanced == Some(true) {
last_change = std::time::Instant::now();
down_emitted = false;
@@ -394,7 +409,7 @@ pub fn run() {
"bridge-audio",
AudioFrame { l: l.to_vec(), r: r.to_vec() },
);
} else if last_change.elapsed() >= std::time::Duration::from_secs(3) && !down_emitted {
} else if last_change.elapsed() >= stall_deadline && !down_emitted {
// Check lai truoc khi respawn — Destroyed co the vua set flag.
if SHUTTING_DOWN.load(Ordering::Relaxed) {
break;