Skip to content

client: read pending data before handling POLLHUP#27

Merged
vaxerski merged 1 commit into
hyprwm:mainfrom
carlo711:fix/drain-pollin
May 10, 2026
Merged

client: read pending data before handling POLLHUP#27
vaxerski merged 1 commit into
hyprwm:mainfrom
carlo711:fix/drain-pollin

Conversation

@carlo711
Copy link
Copy Markdown
Contributor

@carlo711 carlo711 commented May 10, 2026

When the server sends a fatal protocol error and immediately closes the
connection, poll(2) can return with both POLLHUP and POLLIN set
simultaneously. Previously POLLHUP was checked first, causing the client
to return early without reading the pending data off the socket.

This was observed as a flaky autopkgtest failure on slower architectures
(ppc64el) where the server's fatal error message and connection close
arrive in the same poll cycle, while on faster hardware (amd64) they
typically arrive in separate cycles masking the bug.

good: https://ci.debian.net/packages/h/hyprwire/testing/amd64/70722966/
bad: https://ci.debian.net/packages/h/hyprwire/testing/ppc64el/70910866/

checking POLLHUP only when POLLIN is not set, ensuring any pending data
is always drained before treating the connection as closed.
Copy link
Copy Markdown
Member

@vaxerski vaxerski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@vaxerski vaxerski merged commit 85148a8 into hyprwm:main May 10, 2026
2 checks passed
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.

2 participants