You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "elharo (via GitHub)" <gi...@apache.org> on 2026/07/21 10:23:01 UTC
[I] ExecutorService leak in processArchives if stream pipeline throws [maven-jarsigner-plugin]
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: issues-unsubscribe@maven.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org