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

   ## Problem
   
   `SedaConsumer.doRun()` has two `catch (Exception)` blocks in its polling 
loop — one wrapping `processPolledExchange` and one at the outer loop level. A 
`VirtualMachineError` such as `StackOverflowError` or `OutOfMemoryError` thrown 
during route processing extends `Error`, not `Exception`, and therefore escapes 
both handlers. This kills the consumer thread permanently: the route stays in 
`Started` state but the SEDA queue is never drained again.
   
   ## Fix
   
   Add a `catch (Error e)` block alongside each existing `catch (Exception e)` 
in `doRun()`:
   
   - **Inner catch** (wrapping `processPolledExchange`): logs at ERROR and 
continues the polling loop so the consumer thread survives and the queue keeps 
being drained.
   - **Outer catch** (at the top of the loop, e.g. for errors during 
`queue.poll` or `beforePoll`): same behaviour.
   
   ## Test
   
   `SedaConsumerVirtualMachineErrorTest` verifies the bug by injecting a custom 
`SedaConsumer` whose `processPolledExchange` throws `StackOverflowError` on the 
first exchange. It then asserts that the consumer thread survives, processes 
the remaining 4 messages, and leaves the queue empty.
   
   The injection goes through `createNewConsumer` on a custom `SedaEndpoint` 
returned by both `SedaComponent.createEndpoint` overrides, bypassing the async 
routing layers that happen to call the callback (and thus absorb the error) 
before rethrowing in a standard route.
   
   ---
   _Forgebot on behalf of gnodet_


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