Claus Ibsen created CAMEL-24174:
-----------------------------------
Summary: camel-jpa - Parallel EntityManager fix from CAMEL-22534
only covers Splitter, not Multicast/RecipientList/WireTap
Key: CAMEL-24174
URL: https://issues.apache.org/jira/browse/CAMEL-24174
Project: Camel
Issue Type: Bug
Components: camel-jpa
Reporter: Claus Ibsen
CAMEL-22534 fixed a concurrency issue where parallel sub-exchanges in the
Splitter shared the same non-thread-safe {{EntityManager}} map (exchange
property {{CamelEntityManager}}). The fix strips the {{JPA_ENTITY_MANAGER}}
property from sub-exchange copies when {{parallelProcessing}} is enabled, so
each branch creates its own dedicated {{EntityManager}}.
However, the fix was only applied in {{Splitter.java}} (line ~728-731). The
same property copy happens in:
- {{MulticastProcessor}} (used by {{multicast(parallelProcessing)}})
- {{RecipientListProcessor}} (used by {{recipientList(parallel)}})
- {{WireTapProcessor}}
All three copy exchange properties by default, so parallel branches through
these EIPs can share the same non-thread-safe {{HashMap<String,
EntityManager>}} and the same {{EntityManager}} instances across threads --
both concurrent EM use and map corruption are possible.
The fix should either:
- Move the property-stripping into the shared {{MulticastProcessor}} (since
Splitter and RecipientList both extend it), or
- Make the JPA helper's EM map thread-safe / per-thread.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v8.20.10#820010)