File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed
core/src/java/org/apache/lucene/store Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -306,6 +306,9 @@ Bug Fixes
306306 resulted in query branches being wrongly ignored if the QueryIndex was
307307 built by a different JVM. (Luke Kot-Zaniewski)
308308
309+ * GITHUB#15106: Fix infinite loop when RefCountedSharedArena's underlying
310+ Arena#close fails due to concurrent usage of segments. (Uwe Schindler)
311+
309312Build
310313---------------------
311314* Upgrade forbiddenapis to version 3.9. (Uwe Schindler)
Original file line number Diff line number Diff line change @@ -50,7 +50,11 @@ final class RefCountedSharedArena implements Arena {
5050 private static final int ACQUIRE_DECREMENT = REMAINING_UNIT - 1 ; // 0xffff
5151
5252 private final String segmentName ;
53+
54+ // onClose could be called multiple times when the inner Arena's close fails with
55+ // IllegalStateException
5356 private final Runnable onClose ;
57+
5458 private final Arena arena ;
5559
5660 // high 16 bits contain the total remaining acquires; monotonically decreasing
@@ -99,14 +103,10 @@ boolean acquire() {
99103
100104 /** Decrements the ref count. */
101105 void release () {
102- int value ;
103106 while (true ) {
104- value = state .get ();
107+ final int value = state .get ();
105108 final int count = value & 0xFFFF ;
106- if (count == 0 ) {
107- throw new IllegalStateException (value == CLOSED ? "closed" : "nothing to release" );
108- }
109- final int newValue = count == 1 ? CLOSED : value - 1 ;
109+ final int newValue = count <= 1 ? CLOSED : value - 1 ;
110110 if (this .state .compareAndSet (value , newValue )) {
111111 if (newValue == CLOSED ) {
112112 onClose .run ();
You can’t perform that action at this time.
0 commit comments