!2122 doesn't provide sufficient protection against apps not processing events.
Affected version
Debian Sid, Mutter 42 (also tested compiled version at main
). It was fine in version 41, before !1915 (merged) was merged.
Bug summary
I believe !2122 (merged) doesn't provide sufficient protection against apps not processing events when there are more then a single surface that listens for pointer events. This is the case eg. for SDL with libdecor. See https://github.com/libsdl-org/SDL/issues/5536#issuecomment-1100763807 for more details on the bug.
I can't find much justification for the MAX_QUEUED_EVENTS 400
. The pointer event size is 20B, with the size of ring buffer in libwayland
being hardcoded to 4KiB this allows for only 204 events queued there, so there is also dependency on the kernel buffer size to take some of the queue.
With the SDL+libdecor having 2 surfaces that receive pointer events + there is also a 8B frame event send with them, each pointer move generates 48B "records" and 400 limit is no longer enough.
Opinion: One can claim that it's really that application are broken, but there is a bit of a contract change on the behavior, games very often don't have it optimized in menus/when loading assets etc. and it might be entirely not feasible to fix it there. Additionally, with 1000HZ mouse polling, with SDL, it's enough to block window for only 200ms to trigger this, that's very little IMHO.
Relevant in libwayland
:
- https://gitlab.freedesktop.org/wayland/wayland/-/issues/159
- https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/188 <- I think this one might help fix it properly in mutter once merged?
Steps to reproduce
- Have a mouse with some higher polling rate, but can be probably reproduced with normal ones.
- Get some SDL app, eg. I've prepared a quick and dirty one https://gitlab.gnome.org/p2004a/sdl_wayland_event_test_app (Have SDL >= 2.0.20, needs libdecor enabled, not tested with lower)
- Run the app (with
SDL_VIDEODRIVER=wayland
), and press "pause" button to freeze it (freezes for 5s). - Move mouse over the window.
- Watch it crash when it unfreezes. Compositor will have error about wayland connection to the client.
What did you expect to happen
It should not crash, like other apps when there are frozen.