Skip to content

Commit 1e2866b

Browse files
committed
Address CR comments
1. We should log the new port that we are going to try on instead of just saying "Trying again" 2. The first line should be logged at WARN level, not Info. 3. If the exception message contains "Address already in use" we can just log the exception message at WARN. 4. If the exception is some other message, we should log it at ERROR, and pass the exception to logError so that the entire stack trace is printed.
1 parent 9d85eed commit 1e2866b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

core/src/main/scala/org/apache/spark/ui/JettyUtils.scala

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,16 @@ private[spark] object JettyUtils extends Logging {
194194
case s: Success[_] =>
195195
(server, server.getConnectors.head.getLocalPort)
196196
case f: Failure[_] =>
197+
val nextPort = (currentPort + 1) % 65536
197198
server.stop()
198199
pool.stop()
199-
logInfo("Failed to create UI at port, %s. Trying again.".format(currentPort))
200-
logInfo("Error was: " + f.toString)
201-
connect((currentPort + 1) % 65536)
200+
val msg = s"Failed to create UI on port :$currentPort. Trying again on port :$nextPort"
201+
if(f.toString.contains("Address already in use")) {
202+
logWarning(s"$msg - $f")
203+
} else {
204+
logError(msg, f.exception)
205+
}
206+
connect(nextPort)
202207
}
203208
}
204209

0 commit comments

Comments
 (0)