Repository navigation
Conversation
When hosts are merged via the web, the old host record becomes a "zombie" (userid=0) whose rpc_seqno field holds the ID of the host it was merged into. authenticate_user() follows these links until it finds a non-zombie host, but never checks for cycles. If two zombies point at each other (or one points at itself), the scheduler loops until the CGI times out, issuing a DB lookup on every iteration. Track visited host IDs up to MAX_ZOMBIE_HOST_LINKS (16), stop immediately when a self-link, cycle, non-positive target ID, or hop limit is reached, log the broken chain, and fall through to the existing "broken zombie chain" handling which creates a new host record. Refs: BOINC#2433 Assisted-by: Antigravity:Gemini-4-Argon
Contributor
|
Way too complex for something that never happens. |
Contributor
Author
|
Thanks for the feedback! Replaced with a simple 10-iteration counter in #7422. |
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
authenticate_user()insched/handle_request.cppcould loop indefinitely if zombie host records form a cycle. This change detects cycles and bounds the number of links followed.Root cause
When hosts are merged on the web (
merge_hosts()inhtml/inc/host.inc), the old host becomes a "zombie": itsuseridis set to 0 andrpc_seqnoholds the ID of the host it was merged into. When a client sends a zombie's host ID, the scheduler follows these links:If two zombie host records cross-reference each other (or one references itself), the scheduler loops until CGI timeout while issuing a DB lookup on every iteration.
Fix
MAX_ZOMBIE_HOST_LINKS(16).host.rpc_seqno <= 0, if the next ID matches the current host or any previously visited host in the chain, or ifMAX_ZOMBIE_HOST_LINKSis reached.MSG_CRITICALdiagnostic when an invalid target (rpc_seqno <= 0), cycle, or excessive chain length is detected, setretval = ERR_DB_NOT_FOUND, resetg_reply->hostid = 0, and fall through to the existing broken zombie chain handling (which creates a new host record).TODOcomment.Fixes #2433
Summary by cubic
Fixes scheduler stalls when zombie host records form cycles.
authenticate_user()follows links from merged host records (userid=0,rpc_seqno→ target host), but a self-reference or a cross-reference between two zombies made it loop indefinitely, issuing a DB lookup on every iteration until the CGI timed out.MAX_ZOMBIE_HOST_LINKS(16); stops on self-links, cycles, non-positive target IDs, or the hop limit.MSG_CRITICALdiagnostic for broken chains and falls through to the existing handling that creates a new host record.Fixes #2433.
Written for commit c4e1bc7. Summary will update on new commits.