[
https://issues.apache.org/jira/browse/HIVE-16007?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15878306#comment-15878306
]
Peter Vary commented on HIVE-16007:
-----------------------------------
When the execute of the statement in HiveStatement.runAsyncOnServer() is not
successful, then the stmtHandle is never set. See:
{code:title=HiveStatement.runAsyncOnServer}
private void runAsyncOnServer(String sql) throws SQLException {
[..]
try {
TExecuteStatementResp execResp = client.ExecuteStatement(execReq);
Utils.verifySuccessWithInfo(execResp.getStatus());
stmtHandle = execResp.getOperationHandle();
isExecuteStatementFailed = false;
} catch (SQLException eS) {
isExecuteStatementFailed = true;
throw eS;
} catch (Exception ex) {
isExecuteStatementFailed = true;
throw new SQLException(ex.toString(), "08S01", ex);
}
}
{code}
The problem is caused by HiveStatement.hasMoreLogs() returning true, since the
isLogBeingGenerated is true by default, and not set in any of the catch
statements above.
The LogRunnable.updateQueryLog() will call HiveStatement.getQueryLog() will
throw an exception since the stmtHandle is null, and the
isExecuteStatementFailed is true {{Method getQueryLog() failed. Because the
stmtHandle in HiveStatement is null and the statement execution might fail.}},
and later when BeeLine closed the statement the HiveStatement.getQueryLog()
will throw {{Can't getConnection after statement has been closed}} exception.
But still the hasMoreLogs() will return true, so we have an infinite loop here:
{code:title=LogRunnable.run()}
@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);
}
}
}
{code}
> When the query does not complie the LogRunnable never stops
> -----------------------------------------------------------
>
> Key: HIVE-16007
> URL: https://issues.apache.org/jira/browse/HIVE-16007
> Project: Hive
> Issue Type: Bug
> Components: Beeline
> Affects Versions: 2.2.0
> Reporter: Peter Vary
> Assignee: Peter Vary
>
> When issuing a sql command which does not compile then the LogRunnable thread
> is never closed
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)