exwm
exwm copied to clipboard
(exwm-xim-mode) freezes Emacs
Hi!
I'm a user of exwm-xim-mode, but after the latest update enabling the mode freezes my Emacs, USR2 doesn't help.
Here's the end of the strace showing that the Emacs process (pid 2536) blocks at poll:
[pid 2536] recvmsg(4, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
[pid 2536] poll([{fd=4, events=POLLIN}], 1, -1) = 1 ([{fd=4, revents=POLLIN}])
[pid 2536] --- SIGIO {si_signo=SIGIO, si_code=SI_KERNEL} ---
[pid 2536] rt_sigreturn({mask=[]}) = 1
[pid 2536] recvmsg(4, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\34\0\5G\276\4\0\0\220\0\0\0\210C\17\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 32
[pid 2536] recvmsg(4, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
[pid 2536] poll([{fd=4, events=POLLIN}], 1, -1
Emacs 30.1, Exwm 0.33 (I don't really know which update caused it as I updated both simultaneously)
Same here, I've created same issue for xelb: https://github.com/emacs-exwm/xelb/issues/29
Okay, I found a workaround.
It seems that root cause is a deadlock when Emacs tries to connect to itself.
Not sure how it works for Emacs 29 but Emacs 30 freeze makes sense: exwm-xim starts the XIM and Emacs immediately tries to connect to it even before the initialization is complete.
My "solution" is to add export XMODIFIERS= to my .xinitrc and then (setenv "XMODIFIERS" "@im=exwm-xim") to my init.el after the exwm-xim is initialized. This way the XIM works in child windows but doesn't freeze Emacs.
Can suggest that Emacs 30 changed something in the initialization process, need to check the C part.
And I'm not sure if this is a exwm-xim bug at all.
I see. This is a common reason for Emacs dead locks. When Emacs tries to create a frame itself (or tries to connect in some way to X11 or the window manager), then Emacs will hang. That's why EXWM advices the exwm-blocking-subrs and runs them indirectly via an Emacs server. I am not aware of changes on the EXWM side.