You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "gnodet (via GitHub)" <gi...@apache.org> on 2026/08/27 09:52:23 UTC
[PR] Fix #12607: prevent session scope leak on MavenChainedWorkspaceReader constructor exception [maven]
gnodet opened a new pull request, #12863:
URL: https://github.com/apache/maven/pull/12863
## Summary
- Move `MavenChainedWorkspaceReader` construction **before** `sessionScope.enter()` in `DefaultMaven.doExecute()` to prevent a session scope thread-local leak when the constructor throws
## Problem
`sessionScope.enter()` was called at line 212, followed by `new MavenChainedWorkspaceReader(...)` at lines 213-214, **before** the `try` block at line 215. If the constructor threw any exception, the `sessionScope.exit()` in the `finally` block would never execute, leaking the session scope's thread-local `ScopeState`.
## Fix
Reorder the two statements so the workspace reader is constructed first. Since `MavenChainedWorkspaceReader` has no dependency on the session scope, this is safe. If its constructor throws, the scope was never entered, so no cleanup is needed.
## Test plan
- [x] Verified the fix by code inspection — the workspace reader constructor has no session scope dependency
- [x] All 612 existing tests in `maven-core` pass (including `DefaultMavenTest` and `SessionScopeProxyTest`)
- [x] Minimal one-line reorder diff — no behavioral change to the normal path
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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
Re: [PR] Fix #12607: prevent session scope leak on MavenChainedWorkspaceReader constructor exception [maven]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet merged PR #12863:
URL: https://github.com/apache/maven/pull/12863
--
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