This is an automated email from the ASF dual-hosted git repository.

cstamas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git


The following commit(s) were added to refs/heads/master by this push:
     new 74bfbc09e Catch IOException with message "Resource deadlock avoided" 
which can happen on Unix level when multiple process try to lock same file 
(#1799)
74bfbc09e is described below

commit 74bfbc09eb1b0472917a9166cc09c43d53501cd4
Author: Olivier Lamy <[email protected]>
AuthorDate: Fri Feb 20 00:27:19 2026 +1000

    Catch IOException with message "Resource deadlock avoided" which can happen 
on Unix level when multiple process try to lock same file (#1799)
    
    * Catch IOException with message "Resource deadlock avoided" which can 
happen on Unix level when multiple process try to lock same file
    
    Signed-off-by: Olivier Lamy <[email protected]>
    
    * spotless
    
    Signed-off-by: Olivier Lamy <[email protected]>
    
    ---------
    
    Signed-off-by: Olivier Lamy <[email protected]>
---
 .../aether/internal/impl/DefaultTrackingFileManager.java   | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git 
a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultTrackingFileManager.java
 
b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultTrackingFileManager.java
index 28b3b0fc9..760fcfc12 100644
--- 
a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultTrackingFileManager.java
+++ 
b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultTrackingFileManager.java
@@ -161,9 +161,19 @@ public final class DefaultTrackingFileManager implements 
TrackingFileManager {
             try {
                 lock = channel.lock(0, Long.MAX_VALUE, shared);
                 break;
-            } catch (OverlappingFileLockException e) {
+            } catch (OverlappingFileLockException | IOException e) {
+                // For Unix process sun.nio.ch.UnixFileDispatcherImpl.lock0() 
is a native method that can throw
+                // IOException
+                // with message "Resource deadlock avoided"
+                // the system call level is involving fcntl() or flock()
+                // If the kernel detects that granting the lock would result 
in a deadlock
+                // (where two processes are waiting for each other to release 
locks which can happen when two processes
+                // are trying to lock the same file),
+                // it returns an EDEADLK error, which Java throws as an 
IOException.
+                // Read another comment from
+                // 
https://github.com/bdeployteam/bdeploy/blob/7c04e7228d6d48b8990e6703a8d476e21024c639/bhive/src/main/java/io/bdeploy/bhive/objects/LockableDatabase.java#L57
                 if (attempts <= 0) {
-                    throw new IOException(e);
+                    throw (e instanceof IOException) ? (IOException) e : new 
IOException(e);
                 }
                 try {
                     Thread.sleep(50L);

Reply via email to