kwin commented on code in PR #1799:
URL: https://github.com/apache/maven-resolver/pull/1799#discussion_r2826628191
##########
maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultTrackingFileManager.java:
##########
@@ -161,9 +161,19 @@ 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.
Review Comment:
IIUC this can only happen if the other process owning the lock is somehow
waiting for this process. Otherwise why would it otherwise be detected as
DEADLOCK situation in the first place? With the 2nd attempt how will the owning
process be unblocked. IMHO retry only makes sense if some lock is released in
between (the other process is waiting for). How would that be the case here?
--
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]