Skip to content

CAMEL-23281: fix split/aggregate deadlock with SynchronousExecutorService in transacted routes#22493

Merged
Croway merged 1 commit intoapache:camel-4.18.xfrom
Croway:CAMEL-23281-split-aggregate-deadlock-4.18.x
Apr 8, 2026
Merged

CAMEL-23281: fix split/aggregate deadlock with SynchronousExecutorService in transacted routes#22493
Croway merged 1 commit intoapache:camel-4.18.xfrom
Croway:CAMEL-23281-split-aggregate-deadlock-4.18.x

Conversation

@Croway
Copy link
Copy Markdown
Contributor

@Croway Croway commented Apr 8, 2026

Backport of #22492 to camel-4.18.x.

Summary

  • Fix deadlock when using SynchronousExecutorService with split + aggregate in transacted routes
  • CAMEL-23030 changed scheduleSync(task) to schedule(task) for SynchronousExecutorService. The aggregated exchange loses the transacted flag (Exchange.copy() doesn't preserve it), so this new branch is always taken. schedule() queues the completion task, but the surrounding transacted split creates nested await → executeFromQueue cycles where Pipeline.scheduleMain() queue swapping makes the task unreachable — deadlock.
  • Fix: process the completion task inline via processor.process(exchange, callback) for SynchronousExecutorService, bypassing the reactive queue entirely.

Test plan

  • SplitAggregateInChoiceSynchronousExecutorTest — 3 tests (non-transacted, transacted, transacted+choice)
  • SplitAggregateSynchronousExecutorStackOverflowIssueTestCAMEL-23030 regression guard passes

…vice in transacted routes

Process aggregate completion inline for SynchronousExecutorService instead
of going through the reactive queue. The CAMEL-23030 change from
scheduleSync to schedule causes a deadlock when the surrounding split is
transacted: the nested await/executeFromQueue cycles interact with
Pipeline.scheduleMain queue swapping, making pending tasks unreachable.
@Croway Croway merged commit b6ccbeb into apache:camel-4.18.x Apr 8, 2026
3 checks passed
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