You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by us...@apache.org on 2014/04/23 14:43:38 UTC
svn commit: r1589394 - in /lucene/dev/trunk/lucene: CHANGES.txt
core/src/java/org/apache/lucene/store/SimpleFSLockFactory.java
Author: uschindler
Date: Wed Apr 23 12:43:38 2014
New Revision: 1589394
URL: http://svn.apache.org/r1589394
Log:
LUCENE-5626: Fix bug in SimpleFSLockFactory's obtain() that sometimes throwed IOException (ERROR_ACESS_DENIED) on Windows if the lock file was created concurrently
Modified:
lucene/dev/trunk/lucene/CHANGES.txt
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/store/SimpleFSLockFactory.java
Modified: lucene/dev/trunk/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/CHANGES.txt?rev=1589394&r1=1589393&r2=1589394&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/CHANGES.txt (original)
+++ lucene/dev/trunk/lucene/CHANGES.txt Wed Apr 23 12:43:38 2014
@@ -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
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/store/SimpleFSLockFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/store/SimpleFSLockFactory.java?rev=1589394&r1=1589393&r2=1589394&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/store/SimpleFSLockFactory.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/store/SimpleFSLockFactory.java Wed Apr 23 12:43:38 2014
@@ -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