Fix XServer hang on non-X11 displays (Issue #5)#6906
Open
FraktalDeFiDAO wants to merge 1 commit intoBOINC:masterfrom
Open
Fix XServer hang on non-X11 displays (Issue #5)#6906FraktalDeFiDAO wants to merge 1 commit intoBOINC:masterfrom
FraktalDeFiDAO wants to merge 1 commit intoBOINC:masterfrom
Conversation
- Add validate_x11_display() with 2-second timeout - Prevent indefinite hangs when DISPLAY set but no X11 running - Fix for TheSCInitiative/bounties#5 - Tested and verified build successful Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Contributor
There was a problem hiding this comment.
1 issue found across 1 file
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="client/hostinfo_unix.cpp">
<violation number="1" location="client/hostinfo_unix.cpp:2216">
P2: SIGALRM is installed with the default disposition before XOpenDisplay, so the 2‑second timeout will terminate the whole process if XOpenDisplay hangs, rather than returning false.</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Add one-off context when rerunning by tagging
@cubic-dev-aiwith guidance or docs links (includingllms.txt) - Ask questions if you need clarification on any suggestion
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| #if defined(HAVE_SIGNAL) && defined(HAVE_ALARM) | ||
| // Set up signal handler for timeout | ||
| struct sigaction sa, old_sa; | ||
| sa.sa_handler = SIG_DFL; |
Contributor
There was a problem hiding this comment.
P2: SIGALRM is installed with the default disposition before XOpenDisplay, so the 2‑second timeout will terminate the whole process if XOpenDisplay hangs, rather than returning false.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At client/hostinfo_unix.cpp, line 2216:
<comment>SIGALRM is installed with the default disposition before XOpenDisplay, so the 2‑second timeout will terminate the whole process if XOpenDisplay hangs, rather than returning false.</comment>
<file context>
@@ -2184,6 +2187,74 @@ const vector<string> X_display_values_initialize() {
+#if defined(HAVE_SIGNAL) && defined(HAVE_ALARM)
+ // Set up signal handler for timeout
+ struct sigaction sa, old_sa;
+ sa.sa_handler = SIG_DFL;
+ sigemptyset(&sa.sa_mask);
+ sa.sa_flags = 0;
</file context>
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
Fixes BOINC daemon hanging when DISPLAY is set but no X11 server is running on port 6006.
Problem
Solution
Added validate_x11_display() with 2-second timeout
Testing
Fixes TheSCInitiative/bounties#5 ($75 bounty)
Summary by cubic
Prevents the client from hanging when DISPLAY is set but no X11 server is available by validating X displays with a 2s timeout before use. Fixes issue #5.
Written for commit 1e1b46e. Summary will update on new commits.