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/29 13:50:09 UTC

[I] [maven-4.0.x] DefaultMaven: session scope leak on constructor exception [maven]

elharo opened a new issue, #12607:
URL: https://github.com/apache/maven/issues/12607

   # DefaultMaven: Session scope leak on constructor exception
   
   **Found in:** maven-4.0.x branch
   **File:** `impl/maven-core/src/main/java/org/apache/maven/DefaultMaven.java` (lines 213-216)
   **Severity:** Medium
   
   ## Description
   
   `sessionScope.enter()` is called **outside** the try-finally block:
   
   ```java
   sessionScope.enter();
   MavenChainedWorkspaceReader chainedWorkspaceReader =
           new MavenChainedWorkspaceReader(request.getWorkspaceReader(), ideWorkspaceReader);
   try (CloseableSession closeableSession = ...) {
       ...
   } finally {
       sessionScope.exit();
   }
   ```
   
   If the constructor `new MavenChainedWorkspaceReader(...)` at lines 214-215 throws any exception, the `sessionScope.exit()` in the finally block will **never** execute. This leaks the session scope's thread-local state. The `ideWorkspaceReader` parameter is `@Nullable`, and the constructor delegates to `setReaders()` which could throw.


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


Re: [I] [maven-4.0.x] DefaultMaven: session scope leak on constructor exception [maven]

Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet closed issue #12607: [maven-4.0.x] DefaultMaven: session scope leak on constructor exception
URL: https://github.com/apache/maven/issues/12607


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org