elharo opened a new issue, #148:
URL: https://github.com/apache/maven-jarsigner-plugin/issues/148

   **Affected version:** HEAD
   
   **File:** 
`src/main/java/org/apache/maven/plugins/jarsigner/JarsignerSignMojo.java:329-353`
   
   The `ProcessArchives()` method creates an `ExecutorService` outside the 
try-finally block:
   
   ```java
   ExecutorService executor = Executors.newFixedThreadPool(threadCount);
   List<Future<Void>> futures = archives.stream()
           .map(file -> executor.submit((Callable<Void>) () -> {
               processArchive(file);
               return null;
           }))
           .collect(Collectors.toList());
   try {
       for (Future<Void> future : futures) {
           future.get();
       }
   } catch (...) {
       ...
   } finally {
       executor.shutdownNow();
   }
   ```
   
   If the stream pipeline (`.map(...)`, `.collect(...)`) throws an exception 
(e.g., an `OutOfMemoryError` during task submission), the executor is never 
shut down, leaving its threads running indefinitely. This could cause resource 
leaks in large builds.
   
   The fix should move the executor creation inside the try block or wrap the 
entire pipeline in the try-finally.
   


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