You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "yinghua_zh (JIRA)" <ji...@apache.org> on 2018/11/16 05:22:00 UTC

[jira] [Created] (HIVE-20927) The beeline has a dead cycle, resulting in high CPU.

yinghua_zh created HIVE-20927:
---------------------------------

             Summary: The beeline has a dead cycle, resulting in high CPU.
                 Key: HIVE-20927
                 URL: https://issues.apache.org/jira/browse/HIVE-20927
             Project: Hive
          Issue Type: Bug
            Reporter: yinghua_zh


When beeline executes the command and places it for a period of time, it is found that the CPU of the beeline process is very high. It is the code that has a dead loop.The stack is as follows:

"Thread-4" #34 daemon prio=5 os_prio=0 tid=0x00007fbd6636d800 nid=0x162be sleeping[0x00007fbd2e042000]
java.lang.Thread.State: RUNNABLE
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Throwable.java:783)
- locked <0x000000076edb39d8> (a java.sql.SQLException)
at java.lang.Throwable.<init>(Throwable.java:265)
at java.lang.Exception.<init>(Exception.java:66)
at java.sql.SQLException.<init>(SQLException.java:119)
at org.apache.hive.jdbc.HiveStatement.checkConnection(HiveStatement.java:377)
at org.apache.hive.jdbc.HiveStatement.getQueryLog(HiveStatement.java:865)
at org.apache.hive.jdbc.HiveStatement.getQueryLog(HiveStatement.java:849)
at org.apache.hive.beeline.Commands$LogRunnable.updateQueryLog(Commands.java:1213)
at org.apache.hive.beeline.Commands$LogRunnable.run(Commands.java:1221)
at java.lang.Thread.run(Thread.java:745)

 

The dead cycle code is as is as follows:

@Override public void run() {
 while (hiveStatement.hasMoreLogs()) {
 try {
 updateQueryLog();
 Thread.sleep(queryProgressInterval);
 } catch (SQLException e) {
 commands.error(new SQLWarning(e));
 } catch (InterruptedException e) {
 commands.debug("Getting log thread is interrupted, since query is done!");
 commands.showRemainingLogsIfAny(hiveStatement);
 }
 }
 }
 }

   

 

when the mehtod (checkConnection("getQueryLog");)occurs exception,the condition "hiveStatement.hasMoreLogs()" is still true,exist the dead lop,but the thread sleep code is not be run,so the CPU is high!

 

 

 

 

 

 

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)