Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-20927

The beeline has a dead cycle, resulting in high CPU.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.3.0
    • None
    • Clients
    • None

    Description

      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!

       

       

       

       

       

       

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            yinghua_zh yinghua_zh
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: