From 5c5caf1ffe279256a43982af60c473b9bbfd858a Mon Sep 17 00:00:00 2001 From: smit <0xtimsb@gmail.com> Date: Fri, 14 Feb 2025 21:54:26 +0530 Subject: [PATCH] linux: Fix reload hangs for several minutes (#24882) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #22666 This PR fixes the long wait time to open Zed (2 mins in my case) after reloading on Linux. This bug fix is funny: 1. We were using TCP for Zed instances to talk to each other. Reload was broken here too due to TCP connections not being killed on time. 2. [#11488](https://github.com/zed-industries/zed/pull/11488) PR fixed the TCP connection issue by adding a wait until it gets killed. I suppose at that time, this wait time was small. 3. Later, we changed how Zed talks to each other in [#11585](https://github.com/zed-industries/zed/pull/11585) by using Datagram and removing TCP. The new approach simply uses a `.sock` file and a file descriptor to check if some program is listening to it. 4. TCP check is now unnecessary, and it still wait for a long time (I suppose, TIME_WAIT time, don't quote me on this), even though we don’t use TCP anymore for this. This PR just removes that unnecessary TCP wait. Release Notes: - Fixed issue where reload hangs for several minutes on Linux. --- crates/gpui/src/platform/linux/platform.rs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/crates/gpui/src/platform/linux/platform.rs b/crates/gpui/src/platform/linux/platform.rs index 2b79c3946aea32d3be9d20220f8d823ad302f36c..695e9798f278ef5bde8901dc3c9873a1a2d98c4d 100644 --- a/crates/gpui/src/platform/linux/platform.rs +++ b/crates/gpui/src/platform/linux/platform.rs @@ -181,19 +181,12 @@ impl Platform for P { log::info!("Restarting process, using app path: {:?}", app_path); // Script to wait for the current process to exit and then restart the app. - // We also wait for possibly open TCP sockets by the process to be closed, - // since on Linux it's not guaranteed that a process' resources have been - // cleaned up when `kill -0` returns. let script = format!( r#" while kill -0 {pid} 2>/dev/null; do sleep 0.1 done - while lsof -nP -iTCP -a -p {pid} 2>/dev/null; do - sleep 0.1 - done - {app_path} "#, pid = app_pid,