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

   ## Summary
   
   Follow-up to #30713. The test `TimerNegativeDelayVirtualMachineErrorTest` 
merged in that PR has two defects that make it a false positive:
   
   1. **The latch is counted down _before_ the `StackOverflowError` is 
thrown.** The `await()` returns `true` on lambda completion, not on catch-block 
execution. Without the fix (error escapes uncaught, killing the executor 
thread), the lambda still completes before the throw — so the latch opens and 
the test passes on both old and new code.
   
   2. **Race condition: appender registered after context start.** JUnit 5 runs 
the superclass `@BeforeEach` (which calls `startCamelContext()`) before the 
subclass `@BeforeEach`. With `delay=-1` the timer fires immediately, so the 
ERROR log can be emitted before the appender is registered → spurious timeout 
failure.
   
   ## Fix
   
   - Replace `CountDownLatch` with a Log4j2 appender that captures 
`TimerConsumer` ERROR messages.
   - Wait for the message `"has been terminated"` to appear. Without the fix 
the `catch(Throwable)` block never runs and the message is never emitted.
   - Register the appender in `doPreSetup()` (called before 
`startCamelContext()`) to eliminate the race.
   - Add `@Isolated` to prevent log-capture interference with parallel tests.
   
   Both tests pass locally.
   
   _This PR was generated by an AI agent, Hermès on behalf of @gnodet._
   
   <!-- reviewer: gnodet-bot -->


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