[
https://issues.apache.org/jira/browse/HBASE-27335?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17586096#comment-17586096
]
LiangJun He commented on HBASE-27335:
-------------------------------------
I have seen that this part of the code of branch-1 and master branch sets the
thread as the daemon thread, only branch-2 is not set. The master branch code
is as follows:
{code:java}
private ThreadPoolExecutor createThreadPool() {
Configuration conf = conn.getConfiguration();
int threads = conf.getInt("hbase.hconnection.threads.max", 256);
long keepAliveTime = conf.getLong("hbase.hconnection.threads.keepalivetime",
60);
BlockingQueue<Runnable> workQueue =
new LinkedBlockingQueue<>(threads *
conf.getInt(HConstants.HBASE_CLIENT_MAX_TOTAL_TASKS,
HConstants.DEFAULT_HBASE_CLIENT_MAX_TOTAL_TASKS));
ThreadPoolExecutor tpe = new ThreadPoolExecutor(threads, threads,
keepAliveTime,
TimeUnit.SECONDS, workQueue,
new ThreadFactoryBuilder().setDaemon(true).setNameFormat(toString() +
"-shared-%d").build());
tpe.allowCoreThreadTimeOut(true);
return tpe;
} {code}
The branch-2 branch code is as follows:
{code:java}
private ThreadPoolExecutor getThreadPool(int maxThreads, int coreThreads,
String nameHint,
BlockingQueue<Runnable> passedWorkQueue) {
// shared HTable thread executor not yet initialized
if (maxThreads == 0) {
maxThreads = Runtime.getRuntime().availableProcessors() * 8;
}
if (coreThreads == 0) {
coreThreads = Runtime.getRuntime().availableProcessors() * 8;
}
long keepAliveTime = conf.getLong("hbase.hconnection.threads.keepalivetime",
60);
BlockingQueue<Runnable> workQueue = passedWorkQueue;
if (workQueue == null) {
workQueue =
new LinkedBlockingQueue<>(maxThreads *
conf.getInt(HConstants.HBASE_CLIENT_MAX_TOTAL_TASKS,
HConstants.DEFAULT_HBASE_CLIENT_MAX_TOTAL_TASKS));
coreThreads = maxThreads;
}
ThreadPoolExecutor tpe =
new ThreadPoolExecutor(coreThreads, maxThreads, keepAliveTime,
TimeUnit.SECONDS, workQueue,
new ThreadFactoryBuilder().setNameFormat(toString() + nameHint +
"-pool-%d")
.setUncaughtExceptionHandler(Threads.LOGGING_EXCEPTION_HANDLER).build());
tpe.allowCoreThreadTimeOut(true);
return tpe;
} {code}
I will submit a PR to solve this problem.
> HBase shell hang for a minute when quiting
> ------------------------------------------
>
> Key: HBASE-27335
> URL: https://issues.apache.org/jira/browse/HBASE-27335
> Project: HBase
> Issue Type: Bug
> Components: shell
> Reporter: Duo Zhang
> Assignee: LiangJun He
> Priority: Major
> Attachments: jstack.log
>
>
> Found this when trying the 2.5.0 RC. The way to reproduce
> Use './bin/hbase shell' to connect to a cluster, and then run these two
> commands
> {code}
> count "hbase:meta"
> quit
> {code}
> We will hang about 1 minute before the final exit of the shell process.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)