Skip to content

Fix flaky --max-workers strace assertion on aarch64#1101

Merged
kkaarreell merged 2 commits into
mainfrom
ks_fix_flaky_workers
Jul 23, 2026
Merged

Fix flaky --max-workers strace assertion on aarch64#1101
kkaarreell merged 2 commits into
mainfrom
ks_fix_flaky_workers

Conversation

@kkaarreell

@kkaarreell kkaarreell commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Count only process forks (SIGCHLD) from the main keylime-policy PID instead of all clone/clone3 lines, filtering out non-deterministic thread creation in child processes. Also widen the gap by comparing --max-workers 1 vs 5 (difference of 4 forks) instead of 1 vs 3 (difference of 2).

Summary by Sourcery

Make the keylime-policy --max-workers functional test more robust by counting deterministic process forks and widening the worker count comparison gap.

Bug Fixes:

  • Prevent flaky strace-based assertions on aarch64 by ignoring non-deterministic thread creation in child processes.

Tests:

  • Adjust the --max-workers strace test to compare worker counts 1 vs 5 and only count SIGCHLD forks from the main keylime-policy process.

Count only process forks (SIGCHLD) from the main keylime-policy PID
instead of all clone/clone3 lines, filtering out non-deterministic
thread creation in child processes. Also widen the gap by comparing
--max-workers 1 vs 5 (difference of 4 forks) instead of 1 vs 3
(difference of 2).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@kkaarreell kkaarreell self-assigned this Jul 22, 2026
@sourcery-ai

sourcery-ai Bot commented Jul 22, 2026

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

Reviewer's Guide

Adjusts the strace-based --max-workers test to count only process forks (SIGCHLD) from the main keylime-policy PID and compares worker counts between 1 and 5 workers to reduce flakiness, instead of counting all clone/clone3 calls and comparing 1 vs 3 workers.

File-Level Changes

Change Details Files
Make the strace-based worker-count assertion deterministic by scoping clone counting to the main process and increasing the worker-count delta.
  • Change the second strace run to use --max-workers 5 and log to strace_5.log instead of --max-workers 3 and strace_3.log.
  • Extract the main keylime-policy PID from the first line of each strace log using awk.
  • Count clone events only for the main PID and only when they result in SIGCHLD, avoiding thread clones in child processes.
  • Update logging messages to reference --max-workers 5 and the CLONES_5 count.
  • Relax the assertion to compare CLONES_1 against CLONES_5 instead of CLONES_3, expecting fewer forks with 1 worker than with 5.
functional/keylime-policy-commands/test.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:

  • The logic assumes the main keylime-policy PID is always on the first line of the strace log; consider making this more robust (e.g., explicitly matching the execve of keylime-policy) to avoid brittle failures if strace output format changes.
  • The grep pattern now only matches clone with SIGCHLD and ignores clone3; if clone3 is used for process creation on some platforms, you may want to extend the pattern to include it so the worker count remains accurate.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The logic assumes the main keylime-policy PID is always on the first line of the strace log; consider making this more robust (e.g., explicitly matching the execve of keylime-policy) to avoid brittle failures if strace output format changes.
- The grep pattern now only matches `clone` with `SIGCHLD` and ignores `clone3`; if `clone3` is used for process creation on some platforms, you may want to extend the pattern to include it so the worker count remains accurate.

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.

…ting

The strace approach to verify --max-workers was architecture-dependent:
clone syscall output format differs between x86_64 and aarch64, causing
false negatives. Instead, use a stalling HTTP server that serves repodata
normally but holds RPM download connections open, then count established
TCP connections with ss to verify worker parallelism.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@kkaarreell
kkaarreell merged commit ab16359 into main Jul 23, 2026
7 of 9 checks passed
@kkaarreell
kkaarreell deleted the ks_fix_flaky_workers branch July 23, 2026 10:23
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