Repository navigation
remote_server: Use CreateProcess to spawn daemon on Windows - #55292
reflectronic merged 2 commits into
Conversation
|
We require contributors to sign our Contributor License Agreement, and we don't have @sergio-u on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'. |
|
@cla-bot check |
|
The cla-bot has been summoned, and re-checked this pull request! |
d8a2df0 to
be7983b
Compare
be7983b to
8ab94eb
Compare
4a5a33d to
6c69327
Compare
|
Just confirming this fix is still needed and very much wanted. On the current stable (Zed v1.15.0, macOS client → Windows host), the old COM/ This blocks macOS/Linux → Windows remote development entirely until merged. Any chance of getting this reviewed and in? Happy to test a preview build with this change. 👍 |
|
I'm running into this bug on my new development setup as well. Establishing an RDP session first works around it, but it's not exactly ideal... I'd love to see this PR merged. @reflectronic, is there anything I can do to help move it forward? I checked the merge conflicts locally, and it looks like Cargo.lock is the only conflicting file. Happy to help resolve that or test the changes on fresh Windows 11 box. |
When connecting to a Windows host over SSH, the proxy fails to start the daemon and the user sees "failed to spawn server." **Root cause** `spawn_server_windows` invokes the daemon via `shell_execute_from_explorer`, which goes through COM `ShellWindows` / `IShellDispatch2::ShellExecute`. That path requires both: - `explorer.exe` running in the caller's session, and - an interactive desktop / window station. Neither is available when `zed-remote-server proxy` is launched by sshd: sshd-spawned processes live in a non-interactive window station with no Explorer. The COM call fails, the `run` daemon never starts, the proxy's 10s socket-existence poll times out, and the connection fails. **Fix** Replace the COM path with a direct `Command::spawn`, matching the non-Windows branch. Use `DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP` creation flags so the daemon has no inherited console and is not killed by Ctrl+C/Break broadcast to the parent's group when the proxy exits. Bypass `util::new_command` because it presets `CREATE_NO_WINDOW`, which Win32 disallows combining with `DETACHED_PROCESS`. Drop one layer to `smol::process::Command` directly to keep the disallowed-methods lint happy. Also drop the now-unused `shell_execute_from_explorer` module and the `windows` crate dependency it pulled in. Release Notes: - Fixed remote server failing to start when connecting to a Windows host over SSH Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6c69327 to
6320baf
Compare
|
Hell yes, super stoked to see this merged. I'm running a patched build of Zed server on my Windows boxes and it works really well. Thanks everyone for your work on Zed! |
|
Awesome! Thank you for getting this merged |
…stries#55292) When connecting to a Windows host over SSH, the proxy fails to start the daemon and the user sees "failed to spawn server." **Root cause** `spawn_server_windows` invokes the daemon via `shell_execute_from_explorer`, which goes through COM `ShellWindows` / `IShellDispatch2::ShellExecute`. That path requires both: - `explorer.exe` running in the caller's session, and - an interactive desktop / window station. Neither is available when `zed-remote-server proxy` is launched by sshd: sshd-spawned processes live in a non-interactive window station with no Explorer. The COM call fails, the `run` daemon never starts, the proxy's 10s socket-existence poll times out, and the connection fails. A commenter on zed-industries#48966 reports the connection succeeds after first logging in via RDP, which is consistent with this diagnosis: RDP login populates the session with `explorer.exe` and an interactive window station. **Fix** Replace the COM path with a direct `Command::spawn`, matching the non-Windows branch. Use `DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP` creation flags so the daemon has no inherited console and is not killed by Ctrl+C/Break broadcast to the parent's group when the proxy exits. Bypass `util::new_command` because it presets `CREATE_NO_WINDOW`, which Win32 disallows combining with `DETACHED_PROCESS`. Drop one layer to `smol::process::Command` directly to keep the disallowed-methods lint happy. Also drop the now-unused `shell_execute_from_explorer` module and the `windows` crate dependency it pulled in. No automated test is included: exercising this path requires a headless OpenSSH-Server-on-Windows host with a non-interactive window station, which CI doesn't currently provide. Verified manually that macOS client -> Windows host over SSH establishes the connection successfully where it previously timed out. Closes zed-industries#48966 Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [ ] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - Fixed remote server failing to start when connecting to a Windows host over SSH --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: John Tur <john-tur@outlook.com>
When connecting to a Windows host over SSH, the proxy fails to start the daemon and the user sees "failed to spawn server."
Root cause
spawn_server_windowsinvokes the daemon viashell_execute_from_explorer, which goes through COMShellWindows/IShellDispatch2::ShellExecute. That path requires both:explorer.exerunning in the caller's session, andNeither is available when
zed-remote-server proxyis launched by sshd: sshd-spawned processes live in a non-interactive window station with no Explorer. The COM call fails, therundaemon never starts, the proxy's 10s socket-existence poll times out, and the connection fails.A commenter on #48966 reports the connection succeeds after first logging in via RDP, which is consistent with this diagnosis: RDP login populates the session with
explorer.exeand an interactive window station.Fix
Replace the COM path with a direct
Command::spawn, matching the non-Windows branch. UseDETACHED_PROCESS | CREATE_NEW_PROCESS_GROUPcreation flags so the daemon has no inherited console and is not killed by Ctrl+C/Break broadcast to the parent's group when the proxy exits.Bypass
util::new_commandbecause it presetsCREATE_NO_WINDOW, which Win32 disallows combining withDETACHED_PROCESS. Drop one layer tosmol::process::Commanddirectly to keep the disallowed-methods lint happy.Also drop the now-unused
shell_execute_from_explorermodule and thewindowscrate dependency it pulled in.No automated test is included: exercising this path requires a headless OpenSSH-Server-on-Windows host with a non-interactive window station, which CI doesn't currently provide. Verified manually that macOS client -> Windows host over SSH establishes the connection successfully where it previously timed out.
Closes #48966
Self-Review Checklist:
Release Notes: