From 245c7bb1597022ee547b97d34461da6ef9a3b991 Mon Sep 17 00:00:00 2001 From: Pankaj Kumar Date: Tue, 11 May 2021 01:28:09 +0530 Subject: [PATCH] HBASE-25875 RegionServer failed to start due to IllegalThreadStateException in AuthenticationTokenSecretManager.start --- .../java/org/apache/hadoop/hbase/ipc/NettyRpcServer.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcServer.java index 1d3981f78846..b7d446bc0feb 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcServer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcServer.java @@ -130,8 +130,12 @@ public synchronized void start() { } authTokenSecretMgr = createSecretManager(); if (authTokenSecretMgr != null) { - setSecretManager(authTokenSecretMgr); - authTokenSecretMgr.start(); + // Start AuthenticationTokenSecretManager in synchronized way to avoid race conditions in + // LeaderElector start. See HBASE-25875 + synchronized (authTokenSecretMgr) { + setSecretManager(authTokenSecretMgr); + authTokenSecretMgr.start(); + } } this.authManager = new ServiceAuthorizationManager(); HBasePolicyProvider.init(conf, authManager);