Skip to content

chore: camel-core - RouteStopCutOffLog tests must not run in parallel with each other - #29193

Merged
davsclaus merged 1 commit into
mainfrom
chore/route-stop-cutoff-log-resource-lock
Nov 5, 2026
Merged

davsclaus merged 1 commit into
mainfrom
chore/route-stop-cutoff-log-resource-lock

Conversation

@davsclaus

Copy link
Copy Markdown
Contributor

RouteStopCutOffLogTest and RouteStopCutOffLogNestedTest both capture the DefaultErrorHandler logger with ConsumingAppender.newAppender(). That call removes the logger config and installs a new one, and each class's @AfterEach removes the config as well. camel-core runs test classes concurrently, so when the two classes overlap they wipe out each other's appender and capture no WARN line. Filtering on thread name only separates events, so it cannot help once the appender is gone.

The race appeared when #28147 added the second class. It failed the camel-core build of #29190 three times in a row:

  • RouteStopCutOffLogTest.theCutOffIsOneWarnLine:90 » ConditionTimeout (no message within 5 seconds)
  • RouteStopCutOffLogNestedTest.multicastSplitCutOffIsOneWarnLine:183 expected: <1> but was: <0>

The fix puts @ResourceLock("DefaultErrorHandlerLogger") on both classes, so they never run at the same time but still run in parallel with the rest of the module.

Test: both classes pass locally (-Dtest='RouteStopCutOffLog*Test').

Claude Code on behalf of davsclaus

🤖 Generated with Claude Code

… with each other

RouteStopCutOffLogTest and RouteStopCutOffLogNestedTest both capture the
DefaultErrorHandler logger with ConsumingAppender, which replaces the logger
config, and both remove it after each test. When the two classes run at the
same time they wipe out each other's appender and see no WARN line.

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

github-actions Bot commented Nov 4, 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.

@github-actions github-actions Bot added the core label Nov 4, 2026

@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.

LGTM. Both test classes correctly use @ResourceLock("DefaultErrorHandlerLogger") to serialize access to the shared Log4j2 appender, preventing the race condition between parallel test executions. The fix is minimal, targeted, and follows established JUnit 5 patterns.

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

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • core/camel-core

🔁 2 tests passed only after a retry on JDK 21 (2 retried attempts)

Recovered flaky tests on JDK 21 (2)
Module Test Failed attempts First failure
core/camel-core FileConsumerFailureHandledTest.testParis 1 mock://valid Body of message: 0. Expected: <Hello Paris> but was: <Hello >
core/camel-core FileProducerNoForcedWritesTest.testNoForcedWrites 1 mock://result Received message count. Expected: <1> but was: <2>

ℹ️ These tests did not fail the build. Surefire retried them and they passed.
Retries are enabled project-wide by surefire.rerunFailingTestsCount in parent/pom.xml.


🔬 Scalpel shadow comparison — Scalpel: 25 of 713 tested, 0 compile-only — current: 0 all tested

Maveniverse Scalpel detected 25 affected modules (current approach: 0).

Skip-tests mode would test 25 modules (1 direct + 24 downstream), skip tests for 0 (generated code, meta-modules)

⚠️ Modules only in Scalpel (25)
  • camel-console
  • camel-core
  • camel-datasonnet
  • camel-groovy
  • camel-hl7
  • camel-jactl
  • camel-javascript
  • camel-joor
  • camel-jq
  • camel-jsonpath
  • camel-main
  • camel-management
  • camel-mvel
  • camel-ognl
  • camel-platform-http-jolokia
  • camel-python
  • camel-python3
  • camel-quickjs
  • camel-saxon
  • camel-spring-xml
  • camel-stax
  • camel-xml-io-dsl
  • camel-xml-jaxb-dsl
  • camel-xml-jaxb-dsl-test-definition
  • camel-xml-jaxb-dsl-test-spring
Modules Scalpel would test (25)
  • camel-console ← downstream of org.apache.camel:camel-core
  • camel-core ← core/camel-core/src/test/java/org/apache/camel/processor/errorhandler/RouteStopCutOffLogNestedTest.java, core/camel-core/src/test/java/org/apache/camel/processor/errorhandler/RouteStopCutOffLogTest.java
  • camel-datasonnet ← downstream of org.apache.camel:camel-core
  • camel-groovy ← downstream of org.apache.camel:camel-core
  • camel-hl7 ← downstream of org.apache.camel:camel-core
  • camel-jactl ← downstream of org.apache.camel:camel-core
  • camel-javascript ← downstream of org.apache.camel:camel-core
  • camel-joor ← downstream of org.apache.camel:camel-core
  • camel-jq ← downstream of org.apache.camel:camel-core
  • camel-jsonpath ← downstream of org.apache.camel:camel-core
  • camel-main ← downstream of org.apache.camel:camel-core
  • camel-management ← downstream of org.apache.camel:camel-core
  • camel-mvel ← downstream of org.apache.camel:camel-core
  • camel-ognl ← downstream of org.apache.camel:camel-core
  • camel-platform-http-jolokia ← downstream of org.apache.camel:camel-core
  • camel-python ← downstream of org.apache.camel:camel-core
  • camel-python3 ← downstream of org.apache.camel:camel-core
  • camel-quickjs ← downstream of org.apache.camel:camel-core
  • camel-saxon ← downstream of org.apache.camel:camel-core
  • camel-spring-xml ← downstream of org.apache.camel:camel-core
  • camel-stax ← downstream of org.apache.camel:camel-core
  • camel-xml-io-dsl ← downstream of org.apache.camel:camel-core
  • camel-xml-jaxb-dsl ← downstream of org.apache.camel:camel-core
  • camel-xml-jaxb-dsl-test-definition ← downstream of org.apache.camel:camel-core
  • camel-xml-jaxb-dsl-test-spring ← downstream of org.apache.camel:camel-core

ℹ️ Shadow mode — Scalpel observes but does not affect test execution. Learn more

⚠️ Some tests are disabled on GitHub Actions (@DisabledIfSystemProperty(named = "ci.env.name")) and require manual verification:

  • core/camel-core: 4 test(s) disabled on GitHub Actions
All tested modules (25 modules, 7m 39s total)

Total reactor time: 7m 39s

Module Duration Status
Camel :: jOOR 51.6s SUCCESS
Camel :: QuickJS 51.3s SUCCESS
Camel :: DataSonnet 50.9s SUCCESS
Camel :: Main 41.7s SUCCESS
Camel :: Console 39.2s SUCCESS
Camel :: Python 3 31.5s SUCCESS
Camel :: HL7 29.3s SUCCESS
Camel :: Groovy 23.9s SUCCESS
Camel :: XML DSL with camel-xml-io 17.1s SUCCESS
Camel :: Saxon 17.1s SUCCESS
Camel :: JSon Path 17.0s SUCCESS
Camel :: XML DSL with camel-xml-jaxb 15.5s SUCCESS
Camel :: StAX 15.4s SUCCESS
Camel :: Python 9.5s SUCCESS
Camel :: JQ 8.7s SUCCESS
Camel :: XML DSL Jaxb :: Test :: Definition 7.3s SUCCESS
Camel :: JavaScript 7.3s SUCCESS
Camel :: XML DSL Jaxb :: Test :: Spring 6.7s SUCCESS
Camel :: Platform HTTP :: Jolokia 5.9s SUCCESS
Camel :: Jactl 4.8s SUCCESS
Camel :: OGNL (deprecated) 4.2s SUCCESS
Camel :: MVEL 3.2s SUCCESS
Camel :: Core n/a
Camel :: Management n/a
Camel :: Spring XML n/a

Top 20 slowest modules:

  • Camel :: jOOR (51.6s)
  • Camel :: QuickJS (51.3s)
  • Camel :: DataSonnet (50.9s)
  • Camel :: Main (41.7s)
  • Camel :: Console (39.2s)
  • Camel :: Python 3 (31.5s)
  • Camel :: HL7 (29.3s)
  • Camel :: Groovy (23.9s)
  • Camel :: XML DSL with camel-xml-io (17.1s)
  • Camel :: Saxon (17.1s)
  • Camel :: JSon Path (17.0s)
  • Camel :: XML DSL with camel-xml-jaxb (15.5s)
  • Camel :: StAX (15.4s)
  • Camel :: Python (9.5s)
  • Camel :: JQ (8.7s)
  • Camel :: XML DSL Jaxb :: Test :: Definition (7.3s)
  • Camel :: JavaScript (7.3s)
  • Camel :: XML DSL Jaxb :: Test :: Spring (6.7s)
  • Camel :: Platform HTTP :: Jolokia (5.9s)
  • Camel :: Jactl (4.8s)

⚙️ View full build and test results

@oscerd oscerd 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.

Correct and minimal. Both RouteStopCutOffLog tests swap and restore the DefaultErrorHandler logger's appender to count warn lines, so running them concurrently let one test's appender changes bleed into the other, which is the expected: <1> but was: <0> and the appender ConditionTimeout failures seen on recent core runs. @ResourceLock("DefaultErrorHandlerLogger") with a shared key serialises just those two against each other, which is more targeted than @Isolated would be. LGTM.

Claude Code on behalf of oscerd

@davsclaus davsclaus added this to the 4.24.0 milestone Nov 5, 2026
@davsclaus davsclaus added the test label Nov 5, 2026
@davsclaus davsclaus self-assigned this Nov 5, 2026
@davsclaus
davsclaus merged commit e461103 into main Nov 5, 2026
6 checks passed
@davsclaus
davsclaus deleted the chore/route-stop-cutoff-log-resource-lock branch November 5, 2026 06:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants