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

   _Claude Code on behalf of Claus Ibsen (davsclaus)_
   
   JIRA: https://issues.apache.org/jira/browse/CAMEL-24997
   
   A review of `DefaultReactiveExecutor` found the bug below. The fix has a 
test that fails without it.
   
   **After a nested `scheduleSync`, the worker was no longer regarded as 
running.** `scheduleSync` runs its task, and the pending tasks, right away, 
even when the current thread's worker is already running a task. That part is 
by design. But when it finished, it set the worker to not running, although the 
outer run was still in progress. From then on, `schedule()` called by the 
running task no longer queued the new task to run after the current one. 
Instead it started a new run loop inline, so the task ran before the current 
task was done, and the stack grew.
   
   The test shows it: inside a running task, a nested `scheduleSync` followed 
by `schedule()` gave the order `[task-start, sync, scheduled, task-end]` 
instead of `[task-start, sync, task-end, scheduled]`.
   
   **How this happens in practice:** a nested `scheduleSync` occurs, for 
example, when the thread pool of a parallel Multicast, Splitter or Recipient 
List is saturated and its rejection policy is `CallerRuns`, which is Camel's 
default. The task that calls `scheduleSync` then runs on a thread that is 
already running reactive work.
   
   The worker now restores the running state it had before the sync run. This 
is one local variable, with no cost on the hot path.
   
   No outside PRs overlap with this area.
   
   ### Tests
   - New `DefaultReactiveExecutorNestedSyncTest`, which fails without the fix.
   - The full `core/camel-core` suite passes with all upstream modules built 
from this branch: 7573 tests, 0 failures, 44 skipped. 
`RestProducerUnresolvedPathWarnTest` was flaky and passed on rerun; it does not 
touch this code.
   - `ManagedDefaultReactiveExecutorTest` (camel-management) passes.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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