Copilot commented on code in PR #24416:
URL: https://github.com/apache/camel/pull/24416#discussion_r3523443795
##########
components/camel-wal/src/test/java/org/apache/camel/component/wal/LogWriterRollOverUpdateAsyncBase.java:
##########
@@ -84,7 +84,24 @@ protected void runTest(int queueCapacity) throws
IOException, InterruptedExcepti
final Future<?> updateTask =
executorService.submit(this::markRecordsAsCommitted);
- Assertions.assertTrue(latch.await(1, TimeUnit.MINUTES), "Failed to
generate records within 1 minute");
+ executorService.shutdown();
+
+ // Wait for both tasks to complete using Awaitility instead of only
+ // waiting for the generate task via a latch, which left a race window
+ // where the update task could still be running when verification
began.
+ await().atMost(2, TimeUnit.MINUTES)
+ .until(executorService::isTerminated);
Review Comment:
If Awaitility times out (or another runtime failure happens before
termination), the test can exit with the executor’s non-daemon threads still
running. That can leak threads into subsequent tests and even hang the test
JVM. Consider always forcing executor shutdown in a finally block (shutdownNow
+ awaitTermination) when termination is not reached.
--
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]