[ 
https://issues.apache.org/jira/browse/CAMEL-25260?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18126953#comment-18126953
 ] 

Guillaume Nodet commented on CAMEL-25260:
-----------------------------------------

The fix has been merged via PR #27579.

*Root cause and fix:*
JUnit Platform 6.x added a warning when no {{executor-service}} is explicitly 
configured for parallel test execution. The warning appeared thousands of times 
in CI logs. The simplest fix is to set {{executor-service=FORK_JOIN_POOL}} 
explicitly in the three {{junit-platform.properties}} files (camel-core, 
camel-core-engine, camel-integration-test) — this silences the warning and 
keeps existing behavior unchanged, since {{ForkJoinPool}} was already the 
default.

We initially evaluated {{WORKER_THREAD_POOL}} (the other option introduced in 
JUnit 6.1, {{@API(status = EXPERIMENTAL)}}), but rejected it because it uses 
non-daemon threads by construction. This caused 
{{DefaultExecutorServiceManagerTest}} to fail deterministically: our 
{{ThreadFactoryListener}} test installs a bare factory that never calls 
{{setDaemon(true)}}, and {{BaseExecutorServiceManager.newThread}} calls 
{{createThreadFactory(..., daemon=true)}} — which the listener fully replaces, 
so the created threads are non-daemon. The {{ForkJoinPool}} path already 
creates daemon threads, so those tests pass unchanged.

*JUnit team feedback:*
The daemon-thread behavior of {{WORKER_THREAD_POOL}} may be worth reporting 
upstream. If the worker-thread-pool executor is intended as a general 
replacement for {{ForkJoinPool}}, it should either default to daemon threads or 
expose a daemon flag. We did not file a JUnit issue; if someone wants to pursue 
this, the relevant class is {{WorkerThreadPoolHierarchicalTestExecutorService}}.

*Follow-up:*
If a future JUnit version makes {{WORKER_THREAD_POOL}} stable and 
daemon-thread-safe, switching to it would be a straightforward one-line change 
in each of the three properties files. For now {{FORK_JOIN_POOL}} is the 
correct choice — it keeps {{CamelParallelExecutionStrategy}} fully effective 
(including the saturation predicate that logs pool-exhaustion warnings).


> Try 
> junit.jupiter.execution.parallel.config.executor-service=WORKER_THREAD_POOL
> -------------------------------------------------------------------------------
>
>                 Key: CAMEL-25260
>                 URL: https://issues.apache.org/jira/browse/CAMEL-25260
>             Project: Camel
>          Issue Type: Test
>          Components: build system
>    Affects Versions: 4.23.0
>            Reporter: Aurélien Pupier
>            Assignee: Guillaume Nodet
>            Priority: Major
>
> in logs, there are many times:
> {noformat}
>  [INFO] Parallel test execution is enabled but the default ForkJoinPool-based 
> executor service will be used. Please give the new implementation based on a 
> regular thread pool a try by setting the 
> 'junit.jupiter.execution.parallel.config.executor-service' configuration 
> parameter to 'WORKER_THREAD_POOL' and report any issues to the JUnit team. 
> Alternatively, set the configuration parameter to 'FORK_JOIN_POOL' to hide 
> this message and keep using the original implementation.
> {noformat}
> could be worthy to give a try to see if there are improvements (maybe also 
> with the other work in progress with -T1C)
> either it is better and use it, or not better and set 
> junit.jupiter.execution.parallel.config.executor-service=FORK_JOIN_POOL to 
> avoid the thousands of messages in the log



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to