Skip to content

wayland-server: Try harder to catch up before disconnecting clients

John Lindgren requested to merge jlindgren90/wayland:read-fully into main
  • Try to read and process up to the full 4 KB read buffer when handling WL_EVENT_READABLE. This fixes the issue described in [1] where Weston continues to send new mouse events to XWayland but does not keep up with the resulting stream of data coming back.

  • As a result of trying to read more data, it's now much more likely that we fill the 4 KB read buffer. When this happens, we don't want to immediately disconnect XWayland, as that generally kills XWayland along with all its clients, causing potentially catastrophic user data loss. Instead, process the data we have and continue trying to catch up. It's far better for the desktop to appear a bit laggy than for all the applications to suddenly disappear.

  • We still disconnect a client (including XWayland) if the connection gets "stuck", i.e. the read buffer is already full when handling a new WL_EVENT_READABLE. This probably indicates that a single message (presumably invalid) was too large to be read in one 4 KB chunk.

  1. weston#589

Merge request reports