mirror of https://github.com/apache/lucene.git
LUCENE-5626: Fix bug in SimpleFSLockFactory's obtain() that sometimes throwed IOException (ERROR_ACESS_DENIED) on Windows if the lock file was created concurrently
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1589394 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b74b88a823
commit
ee060ebca1
|
@ -99,6 +99,11 @@ Bug fixes
|
|||
* LUCENE-5600: HttpClientBase did not properly consume a connection if a server
|
||||
error occurred. (Christoph Kaser via Shai Erera)
|
||||
|
||||
* LUCENE-5626: Fix bug in SimpleFSLockFactory's obtain() that sometimes throwed
|
||||
IOException (ERROR_ACESS_DENIED) on Windows if the lock file was created
|
||||
concurrently. This error is now handled the same way like in NativeFSLockFactory
|
||||
by returning false. (Uwe Schindler, Robert Muir, Dawid Weiss)
|
||||
|
||||
======================= Lucene 4.8.0 =======================
|
||||
|
||||
System Requirements
|
||||
|
|
|
@ -132,7 +132,17 @@ class SimpleFSLock extends Lock {
|
|||
throw new IOException("Found regular file where directory expected: " +
|
||||
lockDir.getAbsolutePath());
|
||||
}
|
||||
return lockFile.createNewFile();
|
||||
|
||||
try {
|
||||
return lockFile.createNewFile();
|
||||
} catch (IOException ioe) {
|
||||
// On Windows, on concurrent createNewFile, the 2nd process gets "access denied".
|
||||
// In that case, the lock was not aquired successfully, so return false.
|
||||
// We record the failure reason here; the obtain with timeout (usually the
|
||||
// one calling us) will use this as "root cause" if it fails to get the lock.
|
||||
failureReason = ioe;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue