GUACAMOLE-2239: guac_wait_for_fd() does not correctly retry on EINTR.#644
Closed
bbennett-ks wants to merge 1 commit intoapache:staging/1.6.1from
Closed
GUACAMOLE-2239: guac_wait_for_fd() does not correctly retry on EINTR.#644bbennett-ks wants to merge 1 commit intoapache:staging/1.6.1from
bbennett-ks wants to merge 1 commit intoapache:staging/1.6.1from
Conversation
necouchman
approved these changes
Mar 6, 2026
Contributor
necouchman
left a comment
There was a problem hiding this comment.
Also good with this one, but will wait for @mike-jumper comments, as well.
4eec449 to
68d070b
Compare
Contributor
Author
|
Moving forward with GUACAMOLE-2238. |
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
This PR hardens guac_wait_for_fd() against signal interruption (EINTR). This is a subset of GUACAMOLE-2238.
When a signal is delivered (e.g. when a child process exits), some blocking syscalls can return early with -1 with errno = EINTR . This is not a hard failure: the syscall should be retried.
This PR adds EINTR retry loops around blocking calls in various guacamole-server. Equivalent handling for the Windows equivalent was also added.
Without retry, signal (async) delivery can cause guac_wait_for_fd() to intermittently fail.
select Handling
int select(int nfds, fd_set *_Nullable restrict readfds, fd_set *_Nullable restrict writefds, fd_set *_Nullable restrict exceptfds, struct timeval *_Nullable restrict timeout);Special care has been taken with the select system call, as it has parameters which are modified by the system: how these parameters are handled on retry must be considered. Based on the Linux man page:
On error, -1 is returned, and is set to indicate the error; the file descriptor sets are unmodified, and timeout becomes undefined.select retry is based on this.