olamy commented on code in PR #1799:
URL: https://github.com/apache/maven-resolver/pull/1799#discussion_r2819940271


##########
maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultTrackingFileManager.java:
##########
@@ -161,9 +161,16 @@ private FileLock fileLock(FileChannel channel, boolean 
shared) throws IOExceptio
             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) {

Review Comment:
   should we add some "filtering" for IOException such?
   ```
   if(e.getMessage().contains("Resource deadlock avoided"))
   ```



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

Reply via email to