Skip to content

Commit 8c524d6

Browse files
jtgrabowskinoorul
authored andcommitted
fix(webapi): add missing context deletion timeout (spark-jobserver#951)
Add explicit deletion timeout for StopContext message. In spark-jobserver#727 there was a contextDeletionTimeout added which determines how long we wait for a context to stop. WebApi does not respect this timeout though, implicit timeout for StopContext message is much shorter than actual contextDeletionTimeout. Fix by adding explicit timeout for StopContext message.
1 parent 2b0d036 commit 8c524d6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

job-server/src/main/scala/spark/jobserver/WebApi.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ class WebApi(system: ActorSystem,
134134
.fold(100 * 1024)(config.getBytes(_).toInt)
135135

136136
val contextTimeout = SparkJobUtils.getContextCreationTimeout(config)
137+
val contextDeletionTimeout = SparkJobUtils.getContextDeletionTimeout(config)
137138
val bindAddress = config.getString("spark.jobserver.bind-address")
138139

139140
val logger = LoggerFactory.getLogger(getClass)
@@ -405,7 +406,7 @@ class WebApi(system: ActorSystem,
405406
// and currently running jobs will be lost. Use with care!
406407
path(Segment) { (contextName) =>
407408
val (cName, _) = determineProxyUser(config, authInfo, contextName)
408-
val future = supervisor ? StopContext(cName)
409+
val future = (supervisor ? StopContext(cName))(contextDeletionTimeout.seconds)
409410
respondWithMediaType(MediaTypes.`application/json`) { ctx =>
410411
future.map {
411412
case ContextStopped => ctx.complete(StatusCodes.OK, successMap("Context stopped"))

0 commit comments

Comments
 (0)