exwm icon indicating copy to clipboard operation
exwm copied to clipboard

A floating window closing can crash the whole X session unpredictably

Open NinKenDo64 opened this issue 4 years ago • 9 comments

Hey guys. I've been having this issue a while, but unsure when it started to be honest. The issue is on the face of it pretty simple. Sometimes, when a floating window for an X program closes, my entire EXWM crashes. This ONLY happens with floating windows.

The way that it crashes is that all X windows will go blank, revealing the blank windows behind them, and then I will be thrown back to the console.

This happens totally unpredictably and I haven't noticed any pattern at all. Any program can cause the problem but it happens rarely enough that I can sit opening and closing floating windows for minutes and not have anything happen, but then I can have it happen 30 seconds into a new XSession multip-le times in a row. It became so bad that I created a hook to make sure that everything is toggled off floating mode, but it seems some things come and go so quickly that the hook can't even toggle the window to tiling quickly enough to prevent a crash.

Please let me know what additional information will be useful for diagnosing the cause. I can tell you I'm on Arch, with Nvidia proprietary drivers and picom.

Please help as I LOVE EXWM, it's the WM I always dreamed of and that StumpWM failed to be. But this one issue is making StumpWM seem workable now.

NinKenDo64 avatar May 10 '21 12:05 NinKenDo64

Did you turn on exwm-debug mode? (The FAQ in the wiki has some hints about debugging)

timor avatar May 10 '21 14:05 timor

Awesome, I did turn on debug-on-error (it isn't able to catch it) but I didn't know about the other two settings. I will switch those on now too.

NinKenDo64 avatar May 10 '21 23:05 NinKenDo64

None of these settings catch EXWM and halt the failure. Could someone tell me how to have XELB-DEBUG written to a file so that there might be some hope of catching its output.

NinKenDo64 avatar May 22 '21 15:05 NinKenDo64

I can confirm the same problem, and also with the problem related to XELB-DEBUG not being written to file making log checking difficult.

It is really erratic, and I have seen no error messages or anything that would hint at something wrong when I have logs visible before EXWM crashes.

@NinKenDo64 - do you have any exwm extensions installed, like exwm-float.el?

mtekman avatar May 22 '21 19:05 mtekman

Unsure if related, however today I received some debug when a floating window closed, but my XSession didn't crash. I've copied it below.

(error ":eval deleted the frame being displayed" :eval (emojify--emojified-mode-line '("%e" mode-line-front-space mode-line-mule-info mode-line-client mode-line-modified mode-line-remote mode-line-frame-identification mode-line-buffer-identification " " mode-line-position (vc-mode vc-mode) " " mode-line-modes mode-line-misc-info mode-line-end-spaces))) redisplay_internal\ \(C\ function\)()

NinKenDo64 avatar Jul 11 '21 01:07 NinKenDo64

Which emacs version are you using? Also, you can re-define this function to print XELB Debug messages to stderr.

(defun xcb-debug:message (format-string &rest objects)
  "Print a message to `xcb-debug:buffer'.

The FORMAT-STRING argument follows the speficies how to print each of
the passed OBJECTS.  See `format' for details."
  (let ((str (apply #'format format-string objects)))
    (xcb-debug:-with-debug-buffer
     (insert str))
    (print str 'external-debugging-output)))

timor avatar Jul 12 '21 14:07 timor

Hey @timor sorry for the slow update, thanks to your code plus watching one of daviwil's streams recently I was able to get some debug output finally saved. In answer to your question this has happened through a few major versions of Emacs now, so I don't think it's got anything to do with that, it's at least been an issue since I started using EXWM. At the moment I'm on 27.2.

[10:20:46] exwm-layout--refresh: frame=#<frame Firefox — Extension: (NoScript) - NoScript Blocked Objects 0x55d1e1b2ed00>

[10:20:46] exwm-layout--refresh-floating: Refresh floating #<frame Firefox — Extension: (NoScript) - NoScript Blocked Objects 0x55d1e1b2ed00>

[10:20:46] exwm-layout--refresh-floating: Refresh floating window #x180610b

[10:20:46] exwm-layout--show: Show #x180610b in #<window 144 on Firefox — Extension: (NoScript) - NoScript Blocked Objects >

[10:20:46] exwm--set-geometry: Setting #x120003f to 500x341+nil+nil

[10:20:46] exwm--set-geometry: Setting #x180610b to 500x317+2242+1421

[10:20:46] exwm-layout--set-state: id=#x180610b

[10:20:46] exwm-layout--refresh: frame=#<frame Firefox — Extension: (NoScript) - NoScript Blocked Objects 0x55d1e1b2ed00>

[10:20:46] exwm-layout--refresh-floating: Refresh floating #<frame Firefox — Extension: (NoScript) - NoScript Blocked Objects 0x55d1e1b2ed00>

[10:20:46] exwm-layout--refresh-floating: Refresh floating window #x180610b

[10:20:46] exwm-layout--show: Show #x180610b in #<window 144 on Firefox — Extension: (NoScript) - NoScript Blocked Objects >

[10:20:46] exwm--set-geometry: Setting #x120003f to 500x341+nil+nil

[10:20:46] exwm--set-geometry: Setting #x180610b to 500x317+2242+1421

[10:20:46] exwm-layout--set-state: id=#x180610b

[10:20:46] exwm-input--on-echo-area-dirty:

[10:20:46] exwm-input--on-echo-area-dirty:

[10:20:46] exwm-randr--on-ConfigureNotify:

[10:20:46] exwm-randr--on-ConfigureNotify:

[10:20:46] exwm--on-PropertyNotify: atom=WM_STATE(314)

[10:20:46] exwm--on-PropertyNotify: Unhandled: WM_STATE(314)

[10:20:46] exwm-input--on-PropertyNotify:

[10:20:46] exwm--on-PropertyNotify: atom=_NET_WM_STATE(336)

[10:20:46] exwm--on-PropertyNotify: Unhandled: _NET_WM_STATE(336)

[10:20:46] exwm-input--on-PropertyNotify:

[10:20:46] exwm--on-PropertyNotify: atom=WM_STATE(314)

[10:20:46] exwm--on-PropertyNotify: Unhandled: WM_STATE(314)

[10:20:46] exwm-input--on-PropertyNotify:

[10:20:46] exwm--on-PropertyNotify: atom=_NET_WM_STATE(336)

[10:20:46] exwm--on-PropertyNotify: Unhandled: _NET_WM_STATE(336)

[10:20:46] exwm-input--on-PropertyNotify:

[10:20:46] exwm--on-PropertyNotify: atom=WM_HINTS(35)

[10:20:46] exwm--update-hints: #x180610b

[10:20:46] exwm-input--on-PropertyNotify:

[10:20:47] exwm--on-PropertyNotify: atom=_NET_WM_OPAQUE_REGION(405)

[10:20:47] exwm--on-PropertyNotify: Unhandled: _NET_WM_OPAQUE_REGION(405)

[10:20:47] exwm-input--on-PropertyNotify:

[10:20:47] exwm--on-PropertyNotify: atom=_NET_WM_OPAQUE_REGION(405)

[10:20:47] exwm--on-PropertyNotify: Unhandled: _NET_WM_OPAQUE_REGION(405)

[10:20:47] exwm-input--on-PropertyNotify:

[10:20:47] exwm-input--on-ButtonPress: major-mode=exwm-mode buffer=Firefox — Extension: (NoScript) - NoScript Blocked Objects

[10:20:47] exwm-input--mimic-read-event:

[10:20:47] exwm-input--on-ButtonPress-line-mode: down-mouse-1

[10:20:47] exwm--on-PropertyNotify: atom=_NET_WM_USER_TIME(364)

[10:20:47] exwm-input--on-PropertyNotify:

[10:20:47] exwm-manage--on-UnmapNotify: id=#x180610b

[10:20:47] exwm-manage--unmanage-window: Unmanage #x180610b (buffer: Firefox — Extension: (NoScript) - NoScript Blocked Objects , widthdraw: t)

[10:20:47] exwm-manage--set-client-list:

[10:20:47] exwm-workspace--on-delete-frame: Frame #<frame Firefox — Extension: (NoScript) - NoScript Blocked Objects 0x55d1e1b2ed00>' is not a workspace

[10:20:47] exwm-manage--remove-frame: frame=#<frame Firefox — Extension: (NoScript) - NoScript Blocked Objects 0x55d1e1b2ed00>

Here's the last couple seconds of output after a crash. As you can see I'm opening the NoScript extension in Firefox, and it causes a crash, however there's nothing special about this window, or at least nothing unique, I haven't found any program that can't cause a crash.

NinKenDo64 avatar Sep 23 '21 12:09 NinKenDo64

These two lines:

[10:20:47] exwm-workspace--on-delete-frame: Frame #<frame Firefox — Extension: (NoScript) - NoScript Blocked Objects 0x55d1e1b2ed00>' is not a workspace

[10:20:47] exwm-manage--remove-frame: frame=#<frame Firefox — Extension: (NoScript) - NoScript Blocked Objects 0x55d1e1b2ed00>

makes me wonder if the mechanism is that some kind of frame deletion routine gets out of hand and deletes all the frames, not just the frame for the floating window. It might make sense since floating windows are one of the only frequent times when frames are deleted. Perhaps it's not just floating windows, but frame deletion that's the underlying issue, and floating windows is just the most common situation a frame is deleted. Alternatively, maybe there's something particular to the way floating frames work in EXWM that causes that cascade?

NinKenDo64 avatar Sep 23 '21 12:09 NinKenDo64

I haven't found any program that can't cause a crash.

Actually not necessarily true. Although Wine floating windows have the same outcome as any other floating window when decorated by EXWM, if in winecfg I tell it not to let the Window Manager decorate the window, I have not et seen one of those undecorated floating windows cause a crash.

NinKenDo64 avatar Sep 23 '21 12:09 NinKenDo64