sakshichitnis27 opened a new pull request, #2240: URL: https://github.com/apache/maven-resolver/pull/2240
## Summary - `NamedLockFactoryAdapter.acquire()` collects an exception for every failed attempt and throws `FailedToAcquireLockException` at the end whenever that list is non-empty. That also happens when a later attempt did acquire all the locks, so a successful retry is still reported as a failure (and the exception only lists the earlier "Attempt N" failures). - This updates `acquire()` to track whether an attempt succeeded and to throw only when none did. When every attempt fails the behavior is unchanged. - The 2.0.x implementation doesn't have this problem, so this is for the 1.9.x line only. This came up in apache/maven#11116, where a build with `-Daether.syncContext.named.retry=3` failed after "Attempt 1" even though the lock had been released. This doesn't change the lock timeout or the cause of slow lock acquisition discussed there. ## Testing I was able to reproduce this with Maven 3.9.11 (resolver 1.9.24): a separate JVM held the file lock (`aether.syncContext.named.factory=file-lock`, `nameMapper=file-gav`, `aether.named.file-lock.deleteLockFiles=false` so the lock file stays visible to other processes) on one dependency for 9s, with `time=3s` and `retry=3`. | resolver | `retry=3` | `retry=0` | | --- | --- | --- | | 1.9.x head (unmodified) | `BUILD FAILURE`, only "Attempt 1" listed | - | | 1.9.x head + this change | `BUILD SUCCESS` after the lock was released | `BUILD FAILURE` (timeout, as before) | - Added `NamedLockFactoryAdapterRetryTest` (a lock acquired on a retry is not a failure, including when only the second of two locks times out on the first attempt). Both tests fail without the change. - `mvn -pl maven-resolver-impl -am verify` - I haven't run `-Prun-its`. Related: apache/maven#11116 -- 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]
