Skip to content

Commit

Permalink
OAK-5649 - Error in RefreshPolicy can lead to IndexNode lock leak
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/oak/trunk@1783061 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
chetanmeh committed Feb 15, 2017
1 parent fc941d6 commit bf6922e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Expand Up @@ -146,8 +146,16 @@ boolean acquire() {
lock.readLock().unlock();
return false;
} else {
refreshPolicy.refreshOnReadIfRequired(refreshCallback);
return true;
boolean success = false;
try {
refreshPolicy.refreshOnReadIfRequired(refreshCallback);
success = true;
return true;
} finally {
if (!success) {
lock.readLock().unlock();
}
}
}
}

Expand Down
Expand Up @@ -39,7 +39,6 @@
import org.apache.lucene.search.TopDocs;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
Expand Down Expand Up @@ -108,7 +107,6 @@ public void nullIndex_NonFreshIndex() throws Exception{
assertNull(IndexNode.open("/foo", rootBuilder.getNodeState(), builder.getNodeState(), readerFactory, nrtFactory));
}

@Ignore("OAK-5649")
@Test
public void lockAndRefreshPolicy() throws Exception {
NodeState state = createNRTIndex();
Expand Down

0 comments on commit bf6922e

Please sign in to comment.