fix(linux): reap xrandr child process in change_resolution_directly (#17213)

* fix(linux): wait for xrandr in change_resolution_directly to prevent zombie processes

* test(linux): add xrandr end-to-end and zombie-reaping tests

* fix(linux): run change_resolution via spawn_blocking and simplify xrandr test

* fix(linux): reap xrandr on a separate thread

Wait for xrandr on a dedicated thread in change_resolution_directly, and log a failed exit with throttled_log. Callers no longer wait for xrandr, so the async worker and restore_resolutions do not block.

Restore src/server/connection.rs to its state on master. The Windows and macOS paths do not change.

Replace the regression test with one that needs no X server.

* fix(linux): create xrandr reaper thread fallibly before spawning xrandr

* fix(linux): reap xrandr through the existing CHILD_PROCESS list

Push the xrandr child to CHILD_PROCESS, which check_zombie() already polls in the server process. This removes the waiter thread, the channel, and the second wait path that earlier commits added.

* test(linux): drop the xrandr reaping test

The test skips itself when xrandr is missing, and the CI Linux job does
not install it, so it gives no reliable coverage there. The real-session
results are the evidence for this fix.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkig1bcC5Xrr1uwX47b

---------

Co-authored-by: RustDesk <71636191+rustdesk@users.noreply.github.com>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
authored and GitHub committed 2026-11-30 12:01:58 +08:00
1 parent 459b4141ee
commit 6380d8c7a3
1 file changed
+2 -1
+2 -1
View File
@@ -2364,7 +2364,7 @@ DP-0 disconnected (normal left inverted right x axis y axis)
}
pub fn change_resolution_directly(name: &str, width: usize, height: usize) -> ResultType<()> {
Command::new("xrandr")
let child = Command::new("xrandr")
.args(vec![
"--output",
name,
@@ -2372,6 +2372,7 @@ pub fn change_resolution_directly(name: &str, width: usize, height: usize) -> Re
&format!("{}x{}", width, height),
])
.spawn()?;
crate::server::CHILD_PROCESS.lock().unwrap().push(child);
Ok(())
}