Skip to content
Permalink
Browse files
[FLINK-24735][sql-client] Catch Throwable rather than Exception in Lo…
…calExecutor to avoid client crash

This closes #19773.
  • Loading branch information
fsk119 committed May 23, 2022
1 parent f026f39 commit cdbc3f61583b339f508c54717a34bad16a00a681
Showing 1 changed file with 8 additions and 8 deletions.
@@ -170,8 +170,8 @@ public Operation parseStatement(String sessionId, String statement)
List<Operation> operations;
try {
operations = context.wrapClassLoader(() -> parser.parse(statement));
} catch (Exception e) {
throw new SqlExecutionException("Failed to parse statement: " + statement, e);
} catch (Throwable t) {
throw new SqlExecutionException("Failed to parse statement: " + statement, t);
}
if (operations.isEmpty()) {
throw new SqlExecutionException("Failed to parse statement: " + statement);
@@ -207,8 +207,8 @@ public TableResultInternal executeOperation(String sessionId, Operation operatio
(TableEnvironmentInternal) context.getTableEnvironment();
try {
return context.wrapClassLoader(() -> tEnv.executeInternal(operation));
} catch (Exception e) {
throw new SqlExecutionException(MESSAGE_SQL_EXECUTION_ERROR, e);
} catch (Throwable t) {
throw new SqlExecutionException(MESSAGE_SQL_EXECUTION_ERROR, t);
}
}

@@ -220,8 +220,8 @@ public TableResultInternal executeModifyOperations(
(TableEnvironmentInternal) context.getTableEnvironment();
try {
return context.wrapClassLoader(() -> tEnv.executeInternal(operations));
} catch (Exception e) {
throw new SqlExecutionException(MESSAGE_SQL_EXECUTION_ERROR, e);
} catch (Throwable t) {
throw new SqlExecutionException(MESSAGE_SQL_EXECUTION_ERROR, t);
}
}

@@ -299,8 +299,8 @@ public void cancelQuery(String sessionId, String resultId) throws SqlExecutionEx
try {
// this operator will also stop flink job
result.close();
} catch (Exception e) {
throw new SqlExecutionException("Could not cancel the query execution", e);
} catch (Throwable t) {
throw new SqlExecutionException("Could not cancel the query execution", t);
}
resultStore.removeResult(resultId);
}

0 comments on commit cdbc3f6

Please sign in to comment.