janhoy commented on code in PR #3957:
URL: https://github.com/apache/solr/pull/3957#discussion_r2627138095


##########
solr/core/src/test/org/apache/solr/cloud/LeaderElectionTest.java:
##########
@@ -579,23 +581,33 @@ public void run() {
       connLossThread.join();
       killThread.join();
 
-      int seq = threads.get(getLeaderThread()).getSeq();
+      // Retry getting leader with extended timeout to handle edge cases where
+      // getLeaderUrl() gets an unexpected exception and throws 
RuntimeException
+      RetryUtil.retryOnException(
+          Exception.class,
+          60000, // 60 seconds total timeout
+          100,   // 100ms between retries
+          () -> {
+            int seq = threads.get(getLeaderThread()).getSeq();
+            log.info("Leader election stress test completed, leader seq: {}", 
seq);
+          });
 
-      // we have a leader we know, TODO: lets check some other things
     } finally {
       // cleanup any threads still running
       for (ClientThread thread : threads) {
-        thread.close();
-      }
-
-      // cleanup any threads still running
-      for (ClientThread thread : threads) {
-        thread.es.zkClient.close();
-        thread.close();
+        try {
+          thread.close();
+        } catch (Exception e) {
+          // ignore cleanup errors

Review Comment:
   If you inspect `thread.close()`, it will actually also call 
`thread.es.zkClient.close()` internally, so this was never necessary.



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