dweiss commented on code in PR #12751:
URL: https://github.com/apache/lucene/pull/12751#discussion_r1381916122


##########
lucene/core/src/java/org/apache/lucene/index/IndexWriter.java:
##########
@@ -2560,10 +2560,15 @@ private void rollbackInternalNoCommit() throws 
IOException {
 
           // close all the closeables we can (but important is readerPool and 
writeLock to prevent
           // leaks)
-          IOUtils.closeWhileHandlingException(readerPool, deleter, writeLock);
-          writeLock = null;
-          closed = true;
-          closing = false;
+          try {
+            IOUtils.closeWhileHandlingException(readerPool, deleter, 
writeLock);
+          } catch (Throwable t) {
+            throwable.addSuppressed(t);
+          } finally {
+            writeLock = null;
+            closed = true;
+            closing = false;
+          }
 
           // So any "concurrently closing" threads wake up and see that the 
close has now completed:
           notifyAll();

Review Comment:
   Ah, I see it now. Sure, I'll move it.  Out of curiosity - what's going to 
happen if an exception is thrown from here (it's before the synchronization 
block)?
   ```
           // Must not hold IW's lock while closing
           // mergeScheduler: this can lead to deadlock,
           // e.g. TestIW.testThreadInterruptDeadlock
           IOUtils.closeWhileHandlingException(mergeScheduler);
   ```



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to