You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "slachiewicz (via GitHub)" <gi...@apache.org> on 2026/09/01 19:29:31 UTC

Re: [I] SyncContext double-close risk in DefaultArtifactResolver and DefaultMetadataResolver [maven-resolver]

slachiewicz commented on issue #1992:
URL: https://github.com/apache/maven-resolver/issues/1992#issuecomment-5499273671

   ### Analysis & Triage
   - **Problem Identified**: In `DefaultArtifactResolver` and `DefaultMetadataResolver`, `shared` and `exclusive` `SyncContext` instances are managed in an outer `try-with-resources` block, while `resolve()` also explicitly calls `current.close()` internally and in a `finally` block, causing duplicate `.close()` invocations on the same context instance.
   - **Affected Versions**: Both **1.9.x** and **2.0.x / master**.
   - **Plan to Fix**: 
     1. Refactor lock transition in `DefaultArtifactResolver` and `DefaultMetadataResolver` so `SyncContext` instances are closed strictly once via the outer try-with-resources.
     2. Add a unit test verifying single-close execution per `SyncContext` instance.


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