You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2020/06/02 07:41:00 UTC

[jira] [Work logged] (HIVE-23526) Beeline may throw the misleading exception

     [ https://issues.apache.org/jira/browse/HIVE-23526?focusedWorklogId=439959&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-439959 ]

ASF GitHub Bot logged work on HIVE-23526:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 02/Jun/20 07:40
            Start Date: 02/Jun/20 07:40
    Worklog Time Spent: 10m 
      Work Description: kgyrtkirk commented on a change in pull request #1029:
URL: https://github.com/apache/hive/pull/1029#discussion_r433678995



##########
File path: beeline/src/java/org/apache/hive/beeline/Commands.java
##########
@@ -974,86 +974,79 @@ private boolean executeInternal(String sql, boolean call) {
 
     ClientHook hook = ClientCommandHookFactory.get().getHook(beeLine, sql);
 
-    try {
-      Statement stmnt = null;
-      boolean hasResults;
-      Thread logThread = null;
+    Statement stmnt = null;
+    boolean hasResults;
+    Thread logThread = null;
 
-      try {
-        long start = System.currentTimeMillis();
+    try {
+      long start = System.currentTimeMillis();
 
-        if (call) {
-          stmnt = beeLine.getDatabaseConnection().getConnection().prepareCall(sql);
-          hasResults = ((CallableStatement) stmnt).execute();
+      if (call) {
+        stmnt = beeLine.getDatabaseConnection().getConnection().prepareCall(sql);
+        hasResults = ((CallableStatement) stmnt).execute();
+      } else {
+        stmnt = beeLine.createStatement();
+        // In test mode we want the operation logs regardless of the settings
+        if (!beeLine.isTestMode() && beeLine.getOpts().isSilent()) {
+          hasResults = stmnt.execute(sql);
         } else {
-          stmnt = beeLine.createStatement();
-          // In test mode we want the operation logs regardless of the settings
-          if (!beeLine.isTestMode() && beeLine.getOpts().isSilent()) {
-            hasResults = stmnt.execute(sql);
-          } else {
-            InPlaceUpdateStream.EventNotifier eventNotifier =
-                new InPlaceUpdateStream.EventNotifier();
-            logThread = new Thread(createLogRunnable(stmnt, eventNotifier));
-            logThread.setDaemon(true);
-            logThread.start();
-            if (stmnt instanceof HiveStatement) {
-              HiveStatement hiveStatement = (HiveStatement) stmnt;
-              hiveStatement.setInPlaceUpdateStream(
-                  new BeelineInPlaceUpdateStream(
-                      beeLine.getErrorStream(),
-                      eventNotifier
-                  ));
-            }
-            hasResults = stmnt.execute(sql);
-            logThread.interrupt();
-            logThread.join(DEFAULT_QUERY_PROGRESS_THREAD_TIMEOUT);
+          InPlaceUpdateStream.EventNotifier eventNotifier =
+              new InPlaceUpdateStream.EventNotifier();
+          logThread = new Thread(createLogRunnable(stmnt, eventNotifier));
+          logThread.setDaemon(true);
+          logThread.start();
+          if (stmnt instanceof HiveStatement) {
+            HiveStatement hiveStatement = (HiveStatement) stmnt;
+            hiveStatement.setInPlaceUpdateStream(
+                new BeelineInPlaceUpdateStream(
+                    beeLine.getErrorStream(),
+                    eventNotifier
+                ));
           }
+          hasResults = stmnt.execute(sql);
+          logThread.interrupt();
+          logThread.join(DEFAULT_QUERY_PROGRESS_THREAD_TIMEOUT);
         }
+      }
 
-        beeLine.showWarnings();
-
-        if (hasResults) {
-          OutputFile outputFile = beeLine.getRecordOutputFile();
-          if (beeLine.isTestMode() && outputFile != null && outputFile.isActiveConverter()) {
-            outputFile.fetchStarted();
-            if (!sql.trim().toLowerCase().startsWith("explain")) {
-              outputFile.foundQuery(true);
-            } else {
-              outputFile.foundQuery(false);
-            }
-          }
-          do {
-            ResultSet rs = stmnt.getResultSet();
-            try {
-              int count = beeLine.print(rs);
-              long end = System.currentTimeMillis();
-
-              if (showReport()) {
-                beeLine.output(beeLine.loc("rows-selected", count) + " " + beeLine.locElapsedTime(end - start),
-                    true, beeLine.getErrorStream());
-              }
-            } finally {
-              if (logThread != null) {
-                logThread.join(DEFAULT_QUERY_PROGRESS_THREAD_TIMEOUT);
-                showRemainingLogsIfAny(stmnt);
-                logThread = null;
-              }
-              rs.close();

Review comment:
       removing this line will mean that the resultset will be never closed - even when the issue doesn't happen...
   
   isn't there a way to fix this w/o removing this close call?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 439959)
    Time Spent: 20m  (was: 10m)

> Beeline may throw the misleading exception
> ------------------------------------------
>
>                 Key: HIVE-23526
>                 URL: https://issues.apache.org/jira/browse/HIVE-23526
>             Project: Hive
>          Issue Type: Bug
>          Components: Beeline
>         Environment: Hive 1.2.2
>            Reporter: Zhihua Deng
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: HIVE-23526.2.patch, HIVE-23526.3.patch, HIVE-23526.patch, outofsequence.log
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> Sometimes we can see 'out of sequence response' message in beeline, for example:
> Error: org.apache.thrift.TApplicationException: CloseOperation failed: out of sequence response (state=08S01,code=0)
> java.sql.SQLException: org.apache.thrift.TApplicationException: CloseOperation failed: out of sequence response
> at org.apache.hive.jdbc.HiveStatement.closeClientOperation(HiveStatement.java:198)
> at org.apache.hive.jdbc.HiveStatement.close(HiveStatement.java:217)
> at org.apache.hive.beeline.Commands.execute(Commands.java:891)
> at org.apache.hive.beeline.Commands.sql(Commands.java:713)
> at org.apache.hive.beeline.BeeLine.dispatch(BeeLine.java:976)
> at org.apache.hive.beeline.BeeLine.execute(BeeLine.java:816)
> at org.apache.hive.beeline.BeeLine.begin(BeeLine.java:774)
> at org.apache.hive.beeline.BeeLine.mainWithInputRedirection(BeeLine.java:487)
> at org.apache.hive.beeline.BeeLine.main(BeeLine.java:470)
> and there is no other usage message to figured it out, even with --verbose, this makes problem puzzled as beeline does not have concurrency problem on underlying thrift transport.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)