Skip to content

Commit 67421d8

Browse files
AngersZhuuuuHyukjinKwon
authored andcommitted
[SPARK-36692][CORE] Improve Error statement when requesting thread dump while executor already stopped
### What changes were proposed in this pull request? For now, when user check thread dump for a executor while this executor is stopped, the error log shows following might disturb users. ![image](https://user-images.githubusercontent.com/46485123/132471501-db96894d-abe9-4d62-9943-06c578382ef2.png) ### Why are the changes needed? Improve error message ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Closes #33935 from AngersZhuuuu/SPARK-36692. Lead-authored-by: Angerszhuuuu <[email protected]> Co-authored-by: AngersZhuuuu <[email protected]> Signed-off-by: Hyukjin Kwon <[email protected]>
1 parent 33bb7b3 commit 67421d8

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

core/src/main/scala/org/apache/spark/SparkContext.scala

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -694,8 +694,14 @@ class SparkContext(config: SparkConf) extends Logging {
694694
if (executorId == SparkContext.DRIVER_IDENTIFIER) {
695695
Some(Utils.getThreadDump())
696696
} else {
697-
val endpointRef = env.blockManager.master.getExecutorEndpointRef(executorId).get
698-
Some(endpointRef.askSync[Array[ThreadStackTrace]](TriggerThreadDump))
697+
env.blockManager.master.getExecutorEndpointRef(executorId) match {
698+
case Some(endpointRef) =>
699+
Some(endpointRef.askSync[Array[ThreadStackTrace]](TriggerThreadDump))
700+
case None =>
701+
logWarning(s"Executor $executorId might already have stopped and " +
702+
"can not request thread dump from it.")
703+
None
704+
}
699705
}
700706
} catch {
701707
case e: Exception =>

0 commit comments

Comments
 (0)