Skip to content

ci: limit the slowest modules with awk, not head, so sort does not fail the build - #27169

Merged
davsclaus merged 1 commit into
mainfrom
ci-issue/reactor-timing-sigpipe
Oct 1, 2026
Merged

davsclaus merged 1 commit into
mainfrom
ci-issue/reactor-timing-sigpipe

Conversation

@davsclaus

Copy link
Copy Markdown
Contributor

Claude Code on behalf of davsclaus

Related: CAMEL-24777 (assigned to gnodet; this PR does not take the ticket over, see the root-cause comment).

PR builds have been failing after Maven finished successfully:

Maven build completed with exit code: 0
sort: write error
##[error]Process completed with exit code 2.

e.g. 27150, 27147.

render_top_slowest_modules in reactor_timing.sh (added in #26147) pipes sort into head -n "$limit". incremental-build.sh ignores SIGPIPE (trap '' PIPE, #26528), so once head has its lines and closes the pipe, sort gets EPIPE, prints write error and exits 2; with pipefail and set -e that fails the step. Without the trap sort is killed by SIGPIPE instead (exit 141), which fails the same way, so reverting #26528 would not help.

The limit is now taken with awk -v n="$limit" 'NR <= n', which reads all of its input.

Tests

reactor_timing_test.sh gets a case that runs a 50000-module reactor through the function with SIGPIPE ignored. With LC_ALL=C: 26 passed with the fix; with head restored the new case fails (2 failures). (Without LC_ALL=C three existing duration tests fail on a comma-decimal locale, on main as well.)

🤖 Generated with Claude Code

…il the build

render_top_slowest_modules piped sort into head -n. incremental-build.sh
ignores SIGPIPE (trap '' PIPE, CAMEL-24777), so once head stops reading,
sort gets EPIPE, prints "sort: write error" and exits 2; under pipefail
that fails the job after a successful Maven build. awk reads all of its
input, so the pipeline completes. A test runs a large reactor through the
function with SIGPIPE ignored.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Solid fix. Replacing head -n with awk 'NR <= n' correctly eliminates the SIGPIPE/EPIPE race: awk consumes all of sort's output so the pipe never breaks, regardless of the trap '' PIPE in the parent script. Edge cases (limit=0, limit > input, empty input) are fine. The 50k-module test covers the exact failure mode.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@davsclaus davsclaus added this to the 4.23.0 milestone Oct 1, 2026
@davsclaus davsclaus self-assigned this Oct 1, 2026
@davsclaus davsclaus added the task label Oct 1, 2026
@davsclaus
davsclaus merged commit 7bf59e7 into main Oct 1, 2026
4 checks passed
@github-actions
github-actions Bot deleted the ci-issue/reactor-timing-sigpipe branch October 1, 2026 05:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants