helix-editor / helix

A post-modern modal text editor.
https://helix-editor.com
Mozilla Public License 2.0
33.26k stars 2.47k forks source link

Helix fails to start in WSL with DISPLAY set, but no xorg server running #3655

Open prscoelho opened 2 years ago

prscoelho commented 2 years ago

Summary

Environment: Wsl running debian 11 (windows 10). Installed hx from source, 22.08 tag.

I have DISPLAY set so I can run frontend e2e tests, but the xorg server in windows (vcxsrv) isn't always running, I only turn it on to run the tests. I'm sure it's incorrect to have DISPLAY set while xorg server is not running, and I'll probably comment this from my settings from now on, but it still seems wrong that helix would fail to start, and I've had this env set for months without running into any other issues.

image

The cause of the problem seems to be xsel, xsel -o -b hangs with the exact same behavior as hx.

Maybe the answer here is just don't have DISPLAY set if xserver isn't running, and if so feel free to close.

Reproduction Steps

Set DISPLAY to the IP in resolv.conf nameserver :0 , but have vcxsrv not running. I tried this: 1. `hx` I expected this to happen: Helix to start Instead, this happened: Nothing happens. `xsel -o -b` hangs just like hx. Unsetting display or turning vcxsrv on fixes the problem. ### Helix log
~/.cache/helix/helix.log ``` please provide a copy of `~/.cache/helix/helix.log` here if possible, you may need to redact some of the lines ```
There is nothing in the logs, except lines from runs with DISPLAY unset. ### Platform Linux (WSL debian 11) DISPLAY=IP:0 ### Terminal Emulator windows terminal, alacritty, * ### Helix Version helix 22.08 (ec28b2b5)
christianfosli commented 2 years ago

I noticed this too (see #3083). Helix did start eventually, but it took ~2mins before xsel timed out.

prscoelho commented 2 years ago

Oh shoot, I searched in issues but not discussions :(

What do you think about running these clipboard commands with timeout, would it be a proper solution?

the-mikedavis commented 2 years ago

Giving up after a reasonable amount of time in helix_view::clipboard::provider::command::is_exit_success would be a good solution to this. I don't think we should shell out to timeout though. Handling this within that function in Rust would be better.

prscoelho commented 2 years ago

It looks like this isn't exactly trivial, how do you feel about adding a dependency on wait-timeout?

the-mikedavis commented 2 years ago

We shouldn't need any new crates for this: we already have tokio which is capable of spawning futures with timeouts.