From 0cf17885ac46f26387c3030df6d146658175dfd5 Mon Sep 17 00:00:00 2001 From: Alexis Oblet Date: Mon, 26 Jan 2026 13:17:52 +0100 Subject: [PATCH 1/2] rust rqd: fix start_time format sent to dispatcher Expected format is in microsecond, rust is generating timestamp in second. We conform before sending to the dispatcher --- rust/crates/rqd/src/frame/running_frame.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/crates/rqd/src/frame/running_frame.rs b/rust/crates/rqd/src/frame/running_frame.rs index 779552bd1..f1949de6e 100644 --- a/rust/crates/rqd/src/frame/running_frame.rs +++ b/rust/crates/rqd/src/frame/running_frame.rs @@ -1263,7 +1263,7 @@ Render Frame Completed frame_name: self.request.frame_name.clone(), layer_id: self.request.layer_id.clone(), num_cores: self.request.num_cores, - start_time: start_time as i64, + start_time: (start_time * 1000) as i64, max_rss: (stats.max_rss / KIB) as i64, rss: (stats.rss / KIB) as i64, max_pss: (stats.max_pss / KIB) as i64, From 103274b7e7317a7dbfe30f75c7f816d72e142f15 Mon Sep 17 00:00:00 2001 From: Alexis Oblet Date: Mon, 26 Jan 2026 13:21:03 +0100 Subject: [PATCH 2/2] rust rqd: fix fetch processes information Depending on multiple criterias proc/status might not contain NSSid field, they can be: - OS and version - Kernel version - SELinux state - App Armor - OS So instead of parsing proc/status file we revert back to python rqd implementation using proc/stat. --- rust/crates/rqd/src/system/linux.rs | 38 +++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/rust/crates/rqd/src/system/linux.rs b/rust/crates/rqd/src/system/linux.rs index 3cd428531..f055dcae0 100644 --- a/rust/crates/rqd/src/system/linux.rs +++ b/rust/crates/rqd/src/system/linux.rs @@ -544,6 +544,13 @@ impl LinuxSystem { } } } + + // Find session_id from stat file instead of status + // Depending on the OS, Kernel version or SELinux state, status might not contain NSSid + if session_id.is_none() { + session_id = self.read_session_id_from_stat(pid); + } + match (session_id, tgid, state) { (Some(session_id), Some(tgid), Some(state)) => { // Only store valid states @@ -577,6 +584,37 @@ impl LinuxSystem { Ok(()) } + + // Read stats from /proc/{pid}/stat file and return session_id + // NSsid might be is missing from /proc/{pid}/status + // In this case we fallback if not found and and then use stat instead + fn read_session_id_from_stat(&self, pid: u32) -> Option { + let stat_path = format!("/proc/{}/stat", pid); + let stat = match std::fs::read_to_string(stat_path).into_diagnostic() { + Ok(s) => s, + Err(_) => return None, // Skip procs which status is not available + }; + + // Stats file can star with these formats: + // - 105 name ... + // - 105 (name) ... + // - 105 (name with space) ... + // - 105 (name with) (space and parenthesis) ... + + let end = stat.rfind(')'); + + match end { + Some(end) => { + let fields: Vec<&str> = stat[end+2..].split_whitespace().collect(); + return fields[3].parse::().ok() + }, + None => { + let fields: Vec<&str> = stat.split_whitespace().collect(); + return fields[5].parse::().ok() + } + } + } + /// Reads PSS (Proportional Set Size) from /proc/[pid]/smaps_rollup /// /// PSS divides shared memory proportionally among processes using it,