davsclaus opened a new pull request, #24796:
URL: https://github.com/apache/camel/pull/24796

   ## Summary
   
   Fixes [CAMEL-24133](https://issues.apache.org/jira/browse/CAMEL-24133)
   
   Both Circuit Breaker EIP implementations (`ResilienceProcessor` and 
`FaultToleranceProcessor`) release the **original in-flight exchange** back to 
the processor exchange pool instead of the **correlated copy** when 
`camel.main.exchange-factory=pooled` is enabled.
   
   - `ResilienceProcessor.processTask()` called 
`processorExchangeFactory.release(exchange)` — the original
   - `FaultToleranceProcessor.CircuitBreakerTask.call()` — same bug
   
   This causes `PooledExchange.done()` to wipe the body, properties, exception, 
and exchangeId of the still-in-use original exchange, resulting in `null` body 
downstream and potential cross-exchange corruption under concurrency.
   
   **Fix:** Release the correlated `copy` (with null guard) instead of the 
original `exchange`, matching the pattern used by Enricher, Splitter, and 
MulticastProcessor.
   
   ## Changes
   
   - `ResilienceProcessor.java` — change 
`processorExchangeFactory.release(exchange)` to 
`processorExchangeFactory.release(copy)`
   - `FaultToleranceProcessor.java` — same change
   - Added `ResiliencePooledProcessorExchangeFactoryTest` — uses `timer:` 
consumer with both `PooledExchangeFactory` and 
`PooledProcessorExchangeFactory`, verifies body survives circuit breaker
   - Added `FaultTolerancePooledProcessorExchangeFactoryTest` — same test for 
microprofile-fault-tolerance
   
   ## Test plan
   
   - [x] New test `ResiliencePooledProcessorExchangeFactoryTest` passes (fails 
without fix)
   - [x] New test `FaultTolerancePooledProcessorExchangeFactoryTest` passes 
(fails without fix)
   - [x] All 45 existing camel-resilience4j tests pass
   - [x] All 21 existing camel-microprofile-fault-tolerance tests pass
   
   _Claude Code on behalf of davsclaus_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to