Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,8 @@ public void close() {
}
connectionPool.clear();

if (workerGroup != null) {
if (workerGroup != null && !workerGroup.isShuttingDown()) {
workerGroup.shutdownGracefully();
workerGroup = null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -217,4 +217,11 @@ public Iterable<Map.Entry<String, String>> getAll() {
assertFalse(c1.isActive());
}
}

@Test(expected = IOException.class)
public void closeFactoryBeforeCreateClient() throws IOException, InterruptedException {
TransportClientFactory factory = context.createClientFactory();
factory.close();
factory.createClient(TestUtils.getLocalHost(), server1.getPort());
}
}
2 changes: 1 addition & 1 deletion core/src/main/scala/org/apache/spark/SparkEnv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class SparkEnv (
val outputCommitCoordinator: OutputCommitCoordinator,
val conf: SparkConf) extends Logging {

private[spark] var isStopped = false
@volatile private[spark] var isStopped = false
private val pythonWorkers = mutable.HashMap[(String, Map[String, String]), PythonWorkerFactory]()

// A general, soft-reference map for metadata needed during HadoopRDD split computation
Expand Down
5 changes: 5 additions & 0 deletions core/src/main/scala/org/apache/spark/executor/Executor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,11 @@ private[spark] class Executor(
setTaskFinishedAndClearInterruptStatus()
execBackend.statusUpdate(taskId, TaskState.KILLED, ser.serialize(reason))

case t: Throwable if env.isStopped =>
// Log the expected exception after executor.stop without stack traces
// see: SPARK-19147
logError(s"Exception in $taskName (TID $taskId): ${t.getMessage}")

case t: Throwable =>
// Attempt to exit cleanly by informing the driver of our failure.
// If anything goes wrong (or this was a fatal exception), we will delegate to
Expand Down