From 49d3c8fe29aad9cf540ce85694cdfad6523e00b4 Mon Sep 17 00:00:00 2001 From: Mike Mueller Date: Wed, 6 May 2026 23:40:28 +0200 Subject: [PATCH] more breadcrumbs --- src/common.rs | 22 ++++++++++++++++++++++ src/rendezvous_mediator.rs | 5 +++++ 2 files changed, 27 insertions(+) diff --git a/src/common.rs b/src/common.rs index 321d5105b..2a0c38ee4 100644 --- a/src/common.rs +++ b/src/common.rs @@ -123,6 +123,7 @@ impl Drop for SimpleCallOnReturn { pub fn global_init() -> bool { install_panic_hook(); + install_heartbeat(); #[cfg(target_os = "linux")] { if !crate::platform::linux::is_x11() { @@ -132,6 +133,27 @@ pub fn global_init() -> bool { true } +/// Background thread that logs a heartbeat every second. Used purely to pin +/// down silent process exits — if the heartbeat stops, the process died at +/// that timestamp, and we can correlate with what other threads were doing. +/// Uses a counter so we can also tell if logging itself is wedged (counter +/// keeps incrementing) vs the whole process is gone (no more lines). +fn install_heartbeat() { + use std::sync::Once; + static INIT: Once = Once::new(); + INIT.call_once(|| { + std::thread::spawn(|| { + let pid = std::process::id(); + let mut tick: u64 = 0; + loop { + tick += 1; + log::info!("heartbeat: pid={pid} tick={tick}"); + std::thread::sleep(std::time::Duration::from_secs(1)); + } + }); + }); +} + /// Capture Rust panics so they survive the windows-subsystem build. /// /// In release we have `panic = 'abort'` and `windows_subsystem = "windows"`, diff --git a/src/rendezvous_mediator.rs b/src/rendezvous_mediator.rs index 9d9a7ce57..4fa751d7b 100644 --- a/src/rendezvous_mediator.rs +++ b/src/rendezvous_mediator.rs @@ -219,10 +219,14 @@ impl RendezvousMediator { }; select! { n = socket.next() => { + log::info!("breadcrumb: udp socket.next() returned"); match n { Some(Ok((bytes, _))) => { + log::info!("breadcrumb: udp packet received, {} bytes", bytes.len()); if let Ok(msg) = Message::parse_from_bytes(&bytes) { + log::info!("breadcrumb: before handle_resp"); rz.handle_resp(msg.union, Sink::Framed(&mut socket, &addr), &server, &mut update_latency).await?; + log::info!("breadcrumb: after handle_resp"); } else { log::debug!("Non-protobuf message bytes received: {:?}", bytes); } @@ -234,6 +238,7 @@ impl RendezvousMediator { } }, _ = timer.tick() => { + log::info!("breadcrumb: udp timer.tick()"); if SHOULD_EXIT.load(Ordering::SeqCst) { break; }