Add XIOErrorHandler and make poll() robust against X11 disconnection - #43
Open
jEsuSdA wants to merge 1 commit into
Open
Add XIOErrorHandler and make poll() robust against X11 disconnection#43jEsuSdA wants to merge 1 commit into
jEsuSdA wants to merge 1 commit into
Conversation
Currently, when the X11 connection is lost (e.g. screen lock, VT switch, suspend/resume, or X server crash), fastcompmgr exits silently without any indication of what happened. The poll() loop also does not handle errors gracefully. Changes: - Add an XIOErrorHandler that prints a clear "X11 connection lost" message to stderr before Xlib exits. This makes debugging much easier when the compositor disappears unexpectedly. - Make the poll() loop robust: check for POLLHUP/POLLERR/POLLNVAL on the X11 connection fd and log which condition triggered. Handle EINTR from poll() correctly (continue the loop instead of breaking). Log other poll errors with perror(). This is a stability/reliability improvement with no functional changes to the compositing logic.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an XIOErrorHandler and makes the poll() loop robust against X11 connection errors, fixing silent exits when the X server disconnects.
Problem
Currently, when the X11 connection is lost (e.g. screen lock, VT switch, suspend/resume, or X server crash), fastcompmgr exits silently without any indication of what happened. This makes debugging very difficult — users just see the compositor "disappear".
Additionally, the poll() loop does not handle errors gracefully:
POLLHUP/POLLERR/POLLNVALon the X11 connection fd are ignoredEINTRfrom poll() is not handled, causing the loop to break on signalsSolution
XIOErrorHandler
xioerror_handler()that prints a clear "X11 connection lost (XIOError)" message to stderr before Xlib exitsXSetIOErrorHandler()inmain()right afterXSetErrorHandler()poll() robustness
ufd.reventsforPOLLHUP/POLLERR/POLLNVALand log which condition triggered with a clear fatal messageEINTRfrompoll()correctly:continuethe loop instead of breakingpoll()errors are logged withperror()Scope
fastcompmgr.cis touchedmake clean && makeproduces zero warnings, zero errorsImpact
Stability/reliability improvement with no functional changes to the compositing logic. Makes diagnosing X11 disconnection issues much easier.