diff --git a/core/src/main/scala/org/apache/spark/SparkEnv.scala b/core/src/main/scala/org/apache/spark/SparkEnv.scala index f25db7f8de565..a0836a2a68313 100644 --- a/core/src/main/scala/org/apache/spark/SparkEnv.scala +++ b/core/src/main/scala/org/apache/spark/SparkEnv.scala @@ -93,6 +93,14 @@ class SparkEnv ( // actorSystem.awaitTermination() // Note that blockTransferService is stopped by BlockManager since it is started by it. + + // If we only stop sc, but sparksubmit still run as a services we need to delete the tmp dir + // if not, it will create too many tmp dir + try { + Utils.deleteRecursively(new File(sparkFilesDir)) + } catch { + case e: Exception => logError(s"Exception while deleting Spark temp dir: $sparkFilesDir", e) + } } private[spark]