This is an automated email from the ASF dual-hosted git repository.
kturner pushed a commit to branch 2.1
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/2.1 by this push:
new 7db250abff makes shutdown in compactor process to always halt (#5609)
7db250abff is described below
commit 7db250abff74a4643118c6457f401c2df7d7767c
Author: Keith Turner <[email protected]>
AuthorDate: Mon Jun 2 17:26:33 2025 -0400
makes shutdown in compactor process to always halt (#5609)
Ran into an issue where a compactor process threw an exception that
caused it to exit its main servers thread. This caused it shut down its
thrift server and delete its lock in zookeeper. However the process
stayed alive after its lock was deleted. This may have been due to some
non daemon threads in the process.
Co-authored-by: Daniel Roberts ddanielr <[email protected]>
---
.../accumulo/core/fate/zookeeper/ServiceLockSupport.java | 10 ++++++----
.../core/util/threads/AccumuloUncaughtExceptionHandler.java | 1 +
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git
a/core/src/main/java/org/apache/accumulo/core/fate/zookeeper/ServiceLockSupport.java
b/core/src/main/java/org/apache/accumulo/core/fate/zookeeper/ServiceLockSupport.java
index e4514e0808..efc335faf0 100644
---
a/core/src/main/java/org/apache/accumulo/core/fate/zookeeper/ServiceLockSupport.java
+++
b/core/src/main/java/org/apache/accumulo/core/fate/zookeeper/ServiceLockSupport.java
@@ -53,8 +53,8 @@ public class ServiceLockSupport {
@Override
public void lostLock(LockLossReason reason) {
if (shutdownComplete.get()) {
- LOG.warn("{} lost lock (reason = {}), not halting because shutdown is
complete.",
- serviceName, reason);
+ Halt.halt(0, serviceName + " lock in zookeeper lost (reason = " +
reason
+ + "), exiting cleanly because shutdown is complete.");
} else {
Halt.halt(-1, serviceName + " lock in zookeeper lost (reason = " +
reason + "), exiting!");
}
@@ -139,8 +139,10 @@ public class ServiceLockSupport {
@Override
public void lostLock(final LockLossReason reason) {
if (shutdownComplete.get()) {
- LOG.warn("{} lost lock (reason = {}), not halting because shutdown is
complete.",
- serviceName, reason);
+ Halt.halt(0,
+ serviceName + " lost lock (reason = " + reason
+ + "), exiting cleanly because shutdown is complete.",
+ () -> lostLockAction.accept(serviceName));
} else {
Halt.halt(1, serviceName + " lost lock (reason = " + reason + "),
exiting.",
() -> lostLockAction.accept(serviceName));
diff --git
a/core/src/main/java/org/apache/accumulo/core/util/threads/AccumuloUncaughtExceptionHandler.java
b/core/src/main/java/org/apache/accumulo/core/util/threads/AccumuloUncaughtExceptionHandler.java
index 1b01932721..3faa6e1e0e 100644
---
a/core/src/main/java/org/apache/accumulo/core/util/threads/AccumuloUncaughtExceptionHandler.java
+++
b/core/src/main/java/org/apache/accumulo/core/util/threads/AccumuloUncaughtExceptionHandler.java
@@ -68,6 +68,7 @@ class AccumuloUncaughtExceptionHandler implements
UncaughtExceptionHandler {
try {
e.printStackTrace();
System.err.println("Error thrown in thread: " + t + ", halting VM.");
+ System.err.flush();
} catch (Throwable e1) {
// If e == OutOfMemoryError, then it's probably that another Error
might be
// thrown when trying to print to System.err.