Skip to content

Commit 44b97f3

Browse files
dlmarionctubbsii
andauthored
Better handling for ignored interrupted exceptions (apache#5212)
Closes apache#5203 Co-authored-by: Christopher Tubbs <ctubbsii@apache.org>
1 parent b1510c3 commit 44b97f3

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

core/src/main/java/org/apache/accumulo/core/fate/zookeeper/DistributedReadWriteLock.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ public void lock() {
137137
return;
138138
}
139139
} catch (InterruptedException ex) {
140-
// ignored
140+
Thread.currentThread().interrupt();
141+
log.warn("Interrupted while waiting to acquire lock", ex);
141142
}
142143
}
143144
}

server/base/src/main/java/org/apache/accumulo/server/util/Admin.java

+12-2
Original file line numberDiff line numberDiff line change
@@ -494,22 +494,32 @@ private static void flushAll(final ClientContext context) {
494494
try {
495495
flusher.join(3000);
496496
} catch (InterruptedException e) {
497-
// ignore
497+
Thread.currentThread().interrupt();
498+
log.warn("Interrupted while waiting to join Flush thread", e);
498499
}
499500

500501
while (flusher.isAlive() && System.currentTimeMillis() - start < 15000) {
501502
int flushCount = flushesStarted.get();
502503
try {
503504
flusher.join(1000);
504505
} catch (InterruptedException e) {
505-
// ignore
506+
Thread.currentThread().interrupt();
507+
log.warn("Interrupted while waiting to join Flush thread", e);
506508
}
507509

508510
if (flushCount == flushesStarted.get()) {
509511
// no progress was made while waiting for join... maybe its stuck, stop waiting on it
510512
break;
511513
}
512514
}
515+
516+
flusher.interrupt();
517+
try {
518+
flusher.join();
519+
} catch (InterruptedException e) {
520+
Thread.currentThread().interrupt();
521+
log.warn("Interrupted while waiting to join Flush thread", e);
522+
}
513523
}
514524

515525
private static void stopServer(final ClientContext context, final boolean tabletServersToo)

server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java

+9-3
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,9 @@ public void run() {
301301
try {
302302
nextLog.offer(t, 12, TimeUnit.HOURS);
303303
} catch (InterruptedException ex) {
304-
// ignore
304+
// Throw an Error, not an Exception, so the AccumuloUncaughtExceptionHandler
305+
// will log this then halt the VM.
306+
throw new Error("Next log maker thread interrupted", ex);
305307
}
306308

307309
continue;
@@ -337,7 +339,9 @@ public void run() {
337339
try {
338340
nextLog.offer(t, 12, TimeUnit.HOURS);
339341
} catch (InterruptedException ex) {
340-
// ignore
342+
// Throw an Error, not an Exception, so the AccumuloUncaughtExceptionHandler
343+
// will log this then halt the VM.
344+
throw new Error("Next log maker thread interrupted", ex);
341345
}
342346

343347
continue;
@@ -348,7 +352,9 @@ public void run() {
348352
log.info("Our WAL was not used for 12 hours: {}", fileName);
349353
}
350354
} catch (InterruptedException e) {
351-
// ignore - server is shutting down
355+
// Throw an Error, not an Exception, so the AccumuloUncaughtExceptionHandler
356+
// will log this then halt the VM.
357+
throw new Error("Next log maker thread interrupted", e);
352358
}
353359
}
354360
}

0 commit comments

Comments
 (0)