Skip to content

Fix multihost sync deadlock on mixed-architecture combinations#47

Open
prikryla wants to merge 2 commits into
masterfrom
fix-multihost-ipv6-sync-deadlock
Open

Fix multihost sync deadlock on mixed-architecture combinations#47
prikryla wants to merge 2 commits into
masterfrom
fix-multihost-ipv6-sync-deadlock

Conversation

@prikryla

@prikryla prikryla commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

The sync library's sync-get service (ncat -l) only listens on IPv4. When get_IP() resolved a hostname to an IPv6 address, sync-block tried to connect via IPv6, the connection silently failed every round, and the multihost test deadlocked until the 2-hour duration limit.

Prefer IPv4 in get_IP() via getent ahostsv4, falling back to getent hosts only when no IPv4 address exists. Also filter hostname -I output for MY_IP to avoid picking up an IPv6 address.

Summary by Sourcery

Ensure multihost clevis boot unlock tests consistently use IPv4 addresses to avoid sync deadlocks on hosts with IPv6.

Bug Fixes:

  • Prevent multihost sync deadlocks by preferring IPv4 resolution for hostnames used by the sync library.
  • Avoid selecting IPv6 addresses for the local host IP when assigning multihost test roles.

The sync library's sync-get service (ncat -l) only listens on IPv4.
When get_IP() resolved a hostname to an IPv6 address, sync-block tried
to connect via IPv6, the connection silently failed every round, and
the multihost test deadlocked until the 2-hour duration limit.

Prefer IPv4 in get_IP() via getent ahostsv4, falling back to getent
hosts only when no IPv4 address exists. Also filter hostname -I output
for MY_IP to avoid picking up an IPv6 address.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@prikryla prikryla self-assigned this Jun 19, 2026
@sourcery-ai

sourcery-ai Bot commented Jun 19, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adjusts IP address resolution in the multihost clevis boot unlock test to prefer IPv4 addresses and avoid IPv6-only resolutions that cause sync deadlocks, by updating get_IP() and MY_IP detection logic.

File-Level Changes

Change Details Files
Prefer IPv4 resolution for hostnames used by the sync library to avoid IPv6 connection deadlocks.
  • Update get_IP() to first try resolving hostnames via getent ahostsv4 and use the first IPv4 address if present
  • Fall back to the previous getent hosts lookup only when no IPv4 address is available
  • Document in comments that the sync-get service only listens on IPv4 and that IPv6 results cause silent failures and deadlocks
Other/clevis-boot-unlock-all-pins-multihost/runtest.sh
Ensure MY_IP is set to an IPv4 address even on mixed IPv4/IPv6 hosts.
  • Change MY_IP assignment to split hostname -I output into separate lines, filter only IPv4-looking addresses, and select the first one
  • Keep existing environment-variable override behavior so a pre-set MY_IP still takes precedence
Other/clevis-boot-unlock-all-pins-multihost/runtest.sh

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • In get_IP(), the fallback getent hosts path can still return an IPv6 address and reintroduce the deadlock behavior; consider filtering that output for IPv4 (e.g., awk '$1 ~ /^[0-9]+\./ { print $1; exit }') or failing fast when no IPv4 is available so the caller can handle it explicitly.
  • When deriving MY_IP from hostname -I, if no IPv4 address is present the new pipeline will leave MY_IP empty; you may want an explicit fallback or error path for that case to avoid confusing failures later in the test.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `get_IP()`, the fallback `getent hosts` path can still return an IPv6 address and reintroduce the deadlock behavior; consider filtering that output for IPv4 (e.g., `awk '$1 ~ /^[0-9]+\./ { print $1; exit }'`) or failing fast when no IPv4 is available so the caller can handle it explicitly.
- When deriving `MY_IP` from `hostname -I`, if no IPv4 address is present the new pipeline will leave `MY_IP` empty; you may want an explicit fallback or error path for that case to avoid confusing failures later in the test.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

- Filter getent hosts fallback with awk to only return IPv4 addresses,
  preventing the fallback path from reintroducing IPv6 deadlocks
- Add explicit rlFail when MY_IP has no IPv4 address instead of
  silently leaving it empty
- Clarify error message for CLEVIS_IP/TANG_IP resolution failure

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant