[PATCH] wayland-client: Treat EOF when reading the wayland socket as an error

Rob Bradford robert.bradford at intel.com
Tue Jul 9 07:58:17 PDT 2013


Hi Neil,

On 9 July 2013 14:10, Neil Roberts <neil at linux.intel.com> wrote:
> If EOF is encountered while reading from the Wayland socket,
> wl_display_read_events() will now return -1 so that it will be treated
> as an error. The documentation for this function states that it will
> set errno when there is an error so it additionally makes up an errno
> of EPIPE.
>
> If we don't do this then when the compositor quits the Wayland socket
> will be become ready for reading but wl_display_dispatch will do
> nothing which typically makes the application take up 100% CPU. In
> particular eglSwapBuffers will likely get stuck in an infinite busy
> loop because it repeatedly calls wl_display_dispatch_queue while it
> waits for the frame callback.

Good discovery - the only thing that confused me was the past tense
sentence: "If EOF is encountered while reading from the Wayland
socket, wl_display_read_events() will now return -1 so that it will be
treated as an error." It sound like you're reacting to some changed
behaviour rather than changing behaviour. I propose "If EOF is
encountered while reading from the Wayland socket, make
wl_display_read_events() -1 so that it will be treated as an error"

It does feel like a slight hack and instead we should some how
propagate the EOF/zero to read up rather than synthesizing an error.
However we'd have to change every client / toolkit and so using a
fatal display error is nicer since the toolkits should already be
handling that.

Rob


More information about the wayland-devel mailing list