Skip to content

hwcomposer: Report the Wayland disconnect reason; raise RLIMIT_NOFILE - #78

Open
MichaelMKenny wants to merge 2 commits into
waydroid:lineage-20from
MichaelMKenny:pr/crash-diagnostics
Open

hwcomposer: Report the Wayland disconnect reason; raise RLIMIT_NOFILE#78
MichaelMKenny wants to merge 2 commits into
waydroid:lineage-20from
MichaelMKenny:pr/crash-diagnostics

Conversation

@MichaelMKenny

@MichaelMKenny MichaelMKenny commented Jul 31, 2026

Copy link
Copy Markdown

See comment at the top of #77

Summary

Two small robustness changes that came out of debugging a session-killing
composer crash (see the fence-leak PR):

  1. Report why the Wayland connection died before aborting. The dispatch
    loop's abort path logged strerror(-1) (ret is the dispatch return
    value, not an errno), discarding the actual cause. Now it captures
    wl_display_get_error() — including the protocol error's interface,
    object id and code when the compositor rejected a request — logs it, and
    appends it to /data/waydroid_hwc_wayland_error.txt, which on waydroid
    is bind-mounted from the host, so the reason survives the container for
    post-mortem debugging. In the field this immediately identified an
    EMFILE fd-exhaustion crash that a bare abort backtrace could not
    explain.

  2. Raise RLIMIT_NOFILE to the hard limit. Graphics buffers cross the
    Wayland socket as fd-carrying messages and every frame consumes several
    fds transiently, so fd pressure in the composer process translates
    directly into a fatal disconnect that takes the whole session down.
    Running at the soft default (1024) leaves most of the kernel-allowed
    headroom unused.

Testing

Verified on lineage-20 x86_64: the error file is written on session
teardown and on real crashes (EMFILE case captured in the field);
/proc/<pid>/limits confirms the raised limit.

The dispatch loop's abort path logged strerror(-1), discarding the
actual cause of the disconnect. Capture wl_display_get_error -
including the protocol error's interface, object and code when the
compositor rejected a request - log it, and append it to
/data/waydroid_hwc_wayland_error.txt (bind-mounted from the host on
waydroid) so the reason survives the container for post-mortem
debugging. This identified an EMFILE fd-exhaustion crash in the field
that a bare abort backtrace could not explain.
Graphics buffers cross the Wayland socket as fd-carrying messages and
every frame consumes several fds transiently, so fd pressure in the
composer process translates directly into a fatal disconnect (EMFILE)
that takes the whole session down. Run with the hard limit instead of
the soft default to give the process the headroom the kernel already
allows it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant