This is an automated email from the ASF dual-hosted git repository.
yao pushed a commit to branch branch-1.5
in repository https://gitbox.apache.org/repos/asf/incubator-kyuubi.git
The following commit(s) were added to refs/heads/branch-1.5 by this push:
new 60ef29b [KYUUBI #2078] `logCaptureThread` does not catch sparksubmit
exception
60ef29b is described below
commit 60ef29b71002716d00a44f403a8d8f18a2cf2a97
Author: SteNicholas <[email protected]>
AuthorDate: Thu Mar 10 15:00:29 2022 +0800
[KYUUBI #2078] `logCaptureThread` does not catch sparksubmit exception
### _Why are the changes needed?_
`logCaptureThread` does not catch sparksubmit exception.
### _How was this patch tested?_
- [ ] Add some test cases that check the changes thoroughly including
negative and positive cases if possible
- [ ] Add screenshots for manual tests if appropriate
- [x] [Run
test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests)
locally before make a pull request
Closes #2090 from SteNicholas/KYUUBI-2078.
Closes #2078
11ff6824 [SteNicholas] [KYUUBI #2078] logCaptureThread does not catch
sparksubmit exception
Authored-by: SteNicholas <[email protected]>
Signed-off-by: Kent Yao <[email protected]>
(cherry picked from commit cf014ee282d28e717acb6e243522944e7bbb07cd)
Signed-off-by: Kent Yao <[email protected]>
---
.../src/main/scala/org/apache/kyuubi/engine/ProcBuilder.scala | 11 +++++++----
.../apache/kyuubi/engine/spark/SparkProcessBuilderSuite.scala | 10 ++++++++++
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git
a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/ProcBuilder.scala
b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/ProcBuilder.scala
index a5ffeec..704f606 100644
--- a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/ProcBuilder.scala
+++ b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/ProcBuilder.scala
@@ -148,14 +148,14 @@ trait ProcBuilder {
val maxErrorSize = conf.get(KyuubiConf.ENGINE_ERROR_MAX_SIZE)
while (true) {
if (reader.ready()) {
- var line: String = reader.readLine
- if (containsIgnoreCase(line, "Exception:") &&
+ var line: String = reader.readLine.trim
+ if (containsException(line) &&
!line.contains("at ") && !line.startsWith("Caused by:")) {
val sb = new StringBuilder(line)
error = KyuubiSQLException(sb.toString() + s"\n See more:
$engineLog")
- line = reader.readLine()
+ line = reader.readLine().trim
while (sb.length < maxErrorSize && line != null &&
- (containsIgnoreCase(line, "Exception:") ||
+ (containsException(line) ||
line.startsWith("\tat ") ||
line.startsWith("Caused by: "))) {
sb.append("\n" + line)
@@ -211,6 +211,9 @@ trait ProcBuilder {
case other => other
}
}
+
+ private def containsException(log: String): Boolean =
+ containsIgnoreCase(log, "Exception:") || containsIgnoreCase(log,
"Exception in thread")
}
object ProcBuilder extends Logging {
diff --git
a/kyuubi-server/src/test/scala/org/apache/kyuubi/engine/spark/SparkProcessBuilderSuite.scala
b/kyuubi-server/src/test/scala/org/apache/kyuubi/engine/spark/SparkProcessBuilderSuite.scala
index 79fb21f..128f5ab 100644
---
a/kyuubi-server/src/test/scala/org/apache/kyuubi/engine/spark/SparkProcessBuilderSuite.scala
+++
b/kyuubi-server/src/test/scala/org/apache/kyuubi/engine/spark/SparkProcessBuilderSuite.scala
@@ -94,6 +94,16 @@ class SparkProcessBuilderSuite extends KerberizedTestHelper {
assert(error1.getMessage.contains("See more: "))
assert(!error1.getMessage.contains(msg), "stack trace shall be
truncated")
}
+
+ val pb3 =
+ new SparkProcessBuilder("kentyao", conf.set("spark.kerberos.principal",
testPrincipal))
+ pb3.start
+ eventually(timeout(90.seconds), interval(500.milliseconds)) {
+ val error1 = pb3.getError
+ assert(!error1.getMessage.contains("Failed to detect the root cause"))
+ assert(error1.getMessage.contains("See more: "))
+ assert(error1.getMessage.contains("Exception in thread"))
+ }
}
test("proxy user or keytab") {