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

   # Description
   Fixes [CAMEL-27451](https://issues.apache.org/jira/browse/CAMEL-27451).
   
   `SemanticEvaluateConsole` configured its thread pool with `poolSize(2)`, 
`maxPoolSize(2)`, and `maxQueueSize(0)` (`SynchronousQueue`) with an `Abort` 
rejected policy. When an evaluation finished, `FutureTask.set()` unblocked the 
caller, but the worker thread in `ThreadPoolExecutor` took a short window to 
clean up and loop back to `getTask()` / `workQueue.poll()`.
   
   If the caller immediately submitted a subsequent evaluation (e.g. rapid 
sequential test assertions or loop calls, especially under parallel 
multi-threaded `-T1C` builds), `SynchronousQueue.offer()` failed because no 
worker was actively waiting in `poll()`, and because `workerCount == 
maxPoolSize`, `ThreadPoolExecutor` rejected the submission as busy.
   
   This caused flakiness in `SemanticConsoleTest` 
(`directEvaluationValidatesOperationParametersInputAndOutput`, 
`invalidSamplesAndUnknownDefinitionsNeverCallTheExpert`, and 
`sampleUsesStateSelectorsAndReturnsTypedResultDetails`).
   
   ### Changes
   - Track active evaluations using a `Semaphore(2)` to directly bound 
concurrency and reject concurrent over-capacity calls with "Busy: semantic 
evaluations are already running".
   - Use a small bounded queue (`maxQueueSize(2)`) on the executor pool so 
sequential submissions do not race with worker thread completion loops.
   - Reset/drain semaphore permits in `doStart()` to ensure clean lifecycle 
restarts.
   
   _IBM Bob on behalf of apupier_


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