Skip to content

CAMEL-23299: propagate transacted flag in AggregateProcessor for synchronous executor#22512

Merged
Croway merged 1 commit intoapache:mainfrom
Croway:ci-issue-CAMEL-23299-main
Apr 9, 2026
Merged

CAMEL-23299: propagate transacted flag in AggregateProcessor for synchronous executor#22512
Croway merged 1 commit intoapache:mainfrom
Croway:ci-issue-CAMEL-23299-main

Conversation

@Croway
Copy link
Copy Markdown
Contributor

@Croway Croway commented Apr 9, 2026

Backport of #22511 to main.

Summary

  • Exchange.copy() does not preserve the transacted flag. When the aggregate uses SynchronousExecutorService, the completion runs on the caller thread and can legitimately be transactional
  • Propagate the flag on the correlated copy so Pipeline.process() uses scheduleQueue instead of scheduleMain, avoiding a queue-swap deadlock in the reactive executor's executeFromQueue loop
  • Mirrors the same pattern already used by the Splitter (line 216)

Test plan

  • SplitAggregateDirectRouteTransactedDeadlockTest — transacted split + aggregate routed to a separate direct: route (deadlocked before, passes now)
  • SplitAggregateInChoiceSynchronousExecutorTest — existing CAMEL-23281 tests still pass
  • SplitAggregateSynchronousExecutorStackOverflowIssueTestCAMEL-23030 regression guard still passes

@Croway Croway requested a review from davsclaus April 9, 2026 12:04
@github-actions github-actions bot added the core label Apr 9, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

🌟 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
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

🧪 CI tested the following changed modules:

  • core/camel-core-processor
  • core/camel-core

ℹ️ Dependent modules were not tested because the total number of affected modules exceeded the threshold (50). Use the test-dependents label to force testing all dependents.

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

  • core/camel-core: 18 test(s) disabled on GitHub Actions
Build reactor — dependencies compiled but only changed modules were tested (2 modules)
  • Camel :: Core
  • Camel :: Core Processor

⚙️ View full build and test results

Copy link
Copy Markdown
Contributor

@gnodet gnodet left a comment

Choose a reason for hiding this comment

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

Nice fix, Federico — clean and well-targeted. A couple of observations:

Missing TRANSACTION_CONTEXT_DATA propagation?

The Splitter (line 216–219), MulticastProcessor (line 980–983), and RecipientListProcessor (line 309–312) all follow a two-step pattern after createCorrelatedCopy:

copy.getExchangeExtension().setTransacted(exchange.isTransacted());
if (exchange.isTransacted() && copy.getProperty(Exchange.TRANSACTION_CONTEXT_DATA) == null) {
    copy.setProperty(Exchange.TRANSACTION_CONTEXT_DATA, ...);
}

This PR only does step 1 (setting the transacted flag) but not step 2 (propagating TRANSACTION_CONTEXT_DATA). For the specific deadlock fix with manually-transacted exchanges this is fine, but in scenarios with a real transaction manager, the missing context data could cause issues downstream. Is this intentionally scoped differently or an oversight?

Minor: JIRA link

The PR body references CAMEL-23281 and CAMEL-23030 but doesn't include a direct link to CAMEL-23299 at the top.

Otherwise the fix looks good — well-commented, properly guarded for SynchronousExecutorService, and the test coverage with @Timeout(30) is solid for deadlock reproducers.

Claude Code on behalf of Guillaume Nodet

@Croway
Copy link
Copy Markdown
Contributor Author

Croway commented Apr 9, 2026

good point @gnodet I'll add the TRANSACTION_CONTEXT_DATA handling

…hronous executor

Exchange.copy() does not preserve the transacted flag. When the aggregate
uses SynchronousExecutorService, the completion runs on the caller thread
and can legitimately be transactional. Propagate the flag so
Pipeline.process() uses scheduleQueue instead of scheduleMain, avoiding a
queue-swap deadlock in the reactive executor's executeFromQueue loop.
@Croway Croway force-pushed the ci-issue-CAMEL-23299-main branch from 70aaf4e to cd08ec6 Compare April 9, 2026 14:11
@Croway Croway merged commit f82a5c6 into apache:main Apr 9, 2026
6 checks passed
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.

4 participants