ch11ng / exwm

Emacs X Window Manager
2.85k stars 134 forks source link

[EXWM] EXWM fails to start (error: ([XELB] Connection timeout)) #778

Open mentalisttraceur opened 4 years ago

mentalisttraceur commented 4 years ago

Sometimes when I start EXWM, I get a [EXWM] EXWM fails to start (error: ([XELB] Connection timeout)) error message in a separate buffer that pops up.

It seems to be pretty random and unlikely - every time it happens, I just immediately exit Emacs and run startx again, and it tends to not recur the second time.

nbarrientos commented 1 year ago

In case somebody comes here dragged by a search engine, setting xcb:connection-timeout to a higher value than default (3 seconds) before EXWM is initialised could help in this case. Something like:

(setq xcb:connection-timeout 10)
(exwm-enable)
mentalisttraceur commented 1 year ago

In case somebody comes here dragged by a search engine

Also I still exist, and this is still a useful answer for me. Thanks!

nbarrientos commented 1 year ago

Great :smiley_cat:

mentalisttraceur commented 1 year ago

Okay, so, as far as resolving this issue, I think:

  1. If EXWM isn't going to change anything, then there should be some documentation added about this error and workaround. For example:

    If you see error: ([XELB] Connection timeout), it means EXWM couldn't connect to X. If you're starting X with xinit, startx, or similar, EXWM might just be starting a little faster than X - you can try increasing how long EXWM will wait for X by customizing the variable xcb:connection-timeout. You can also have Emacs re-try starting EXWM by invoking M-x {{ what goes here ??? }}.

    Or whatever the right nuances to say are.

  2. But since it's a timeout issue, and it actually happens in the wild when having xinit/startx launch EXWM (at least back when I was last seriously using EXWM), and EXWM becomes literally useless at its job if it simply gives up at this point (especially if it gets into an invalid/inconsistent state that's not trivial for a user or calling elisp to recover from), I would suggest that the best play is to either extend the timeout by default, or add some sort of retry (could even be a user-affirmation-requiring retry - if I got the same exact error message but it had a "Retry? y or n" at the end I would've been a much happier EXWM user, because I wouldn't have to exit Emacs+X and re-run).

    (Of course, you could reasonably argue that more robust behavior when the connection to X is racing with X starting should be implemented outside of EXWM - either by the user in a way that's specific to their needs, or in XELB. But personally, I'd aim for a more universally sensible and pleasant-to-use default than just a configurable timeout.)