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

Guillaume Nodet commented on CAMEL-20997:
-----------------------------------------

Investigation notes (March 2026):

Scope analysis across the codebase:

*await() calls without timeout:*
* 434 instances across 251 test files
* Most are already protected with Awaitility {{atMost()}} or custom timeout 
constants
* Bare {{CountDownLatch.await()}} without timeout is the real risk — appears to 
be a small subset

*Thread.sleep() with large values (5+ seconds):*
* 154 instances across 123 test files
* Common durations: 5000-15000ms, some 30000+ms
* Should be replaced with event-based waiting (Awaitility)

*@Timeout annotations:*
* 255 test methods already use {{@Timeout}} (primarily in SFTP, Kafka, JMS 
tests)
* Not universally applied

*Global protection:*
* Surefire fork timeout: 600 seconds (10 minutes) — configured in parent/pom.xml
* Individual tests can still block for up to 10 minutes within that window

Worst offenders by module:
* {{camel-master}} cluster tests: FileLockClusterService*FailoverTest (16+ 
await calls)
* {{camel-mina-sftp}} integration tests: many files with 12-20 calls
* {{camel-quartz}} component tests: multiple files with 10+ calls
* {{camel-mllp}} tests: Thread.sleep(15000) patterns

Affected files: ~2.5% of all test files (gradual cleanup, not urgent)

Recommended approach:
# Audit bare {{CountDownLatch.await()}} calls — fix the truly blocking ones 
first (smallest set, highest risk)
# Standardize on Awaitility with consistent {{atMost()}} timeouts
# Replace {{Thread.sleep()}} with event-based waiting in worst offenders
# Consider applying {{@Timeout}} more broadly, especially for 
cluster/concurrency tests


> camel-tests: review tests that can block
> ----------------------------------------
>
>                 Key: CAMEL-20997
>                 URL: https://issues.apache.org/jira/browse/CAMEL-20997
>             Project: Camel
>          Issue Type: Task
>          Components: tests
>    Affects Versions: 4.8.0
>            Reporter: Otavio Rodolfo Piske
>            Priority: Minor
>              Labels: help-wanted
>
> We have some tests blocking indefinitely by doing things like: 
> * latch.await()
> * Thread.sleep(<huge number here>) 
> * Using locks without defining a maximum await time
> Tests like this should be reviewed and adjusted to ensure that they don't 
> block forever (or for very long). Other tests (manual, "performance", etc) 
> should be reviewed and dealt accordingly (moved to camel-performance-tests, 
> removed, etc). 



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

Reply via email to