Skip to content

Commit 06dc4b5

Browse files
liyezhang556520Andrew Or
authored andcommitted
[SPARK-4989][CORE] avoid wrong eventlog conf cause cluster down in standalone mode
when enabling eventlog in standalone mode, if give the wrong configuration, the standalone cluster will down (cause master restart, lose connection with workers). How to reproduce: just give an invalid value to "spark.eventLog.dir", for example: spark.eventLog.dir=hdfs://tmp/logdir1, hdfs://tmp/logdir2. This will throw illegalArgumentException, which will cause the Master restart. And the whole cluster is not available. Author: Zhang, Liye <[email protected]> Closes #3824 from liyezhang556520/wrongConf4Cluster and squashes the following commits: 3c24d98 [Zhang, Liye] revert change with logwarning and excetption for FileNotFoundException 3c1ac2e [Zhang, Liye] change var to val a49c52f [Zhang, Liye] revert wrong modification 12eee85 [Zhang, Liye] add more message in log and on webUI 5c1fa33 [Zhang, Liye] cache exceptions when eventlog with wrong conf
1 parent f825e19 commit 06dc4b5

File tree

1 file changed

+20
-19
lines changed
  • core/src/main/scala/org/apache/spark/deploy/master

1 file changed

+20
-19
lines changed

core/src/main/scala/org/apache/spark/deploy/master/Master.scala

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -720,26 +720,27 @@ private[spark] class Master(
720720
def rebuildSparkUI(app: ApplicationInfo): Boolean = {
721721
val appName = app.desc.name
722722
val notFoundBasePath = HistoryServer.UI_PATH_PREFIX + "/not-found"
723-
val eventLogFile = app.desc.eventLogDir
724-
.map { dir => EventLoggingListener.getLogPath(dir, app.id) }
725-
.getOrElse {
726-
// Event logging is not enabled for this application
727-
app.desc.appUiUrl = notFoundBasePath
728-
return false
729-
}
730-
val fs = Utils.getHadoopFileSystem(eventLogFile, hadoopConf)
723+
try {
724+
val eventLogFile = app.desc.eventLogDir
725+
.map { dir => EventLoggingListener.getLogPath(dir, app.id) }
726+
.getOrElse {
727+
// Event logging is not enabled for this application
728+
app.desc.appUiUrl = notFoundBasePath
729+
return false
730+
}
731+
732+
val fs = Utils.getHadoopFileSystem(eventLogFile, hadoopConf)
731733

732-
if (fs.exists(new Path(eventLogFile + EventLoggingListener.IN_PROGRESS))) {
733-
// Event logging is enabled for this application, but the application is still in progress
734-
val title = s"Application history not found (${app.id})"
735-
var msg = s"Application $appName is still in progress."
736-
logWarning(msg)
737-
msg = URLEncoder.encode(msg, "UTF-8")
738-
app.desc.appUiUrl = notFoundBasePath + s"?msg=$msg&title=$title"
739-
return false
740-
}
734+
if (fs.exists(new Path(eventLogFile + EventLoggingListener.IN_PROGRESS))) {
735+
// Event logging is enabled for this application, but the application is still in progress
736+
val title = s"Application history not found (${app.id})"
737+
var msg = s"Application $appName is still in progress."
738+
logWarning(msg)
739+
msg = URLEncoder.encode(msg, "UTF-8")
740+
app.desc.appUiUrl = notFoundBasePath + s"?msg=$msg&title=$title"
741+
return false
742+
}
741743

742-
try {
743744
val (logInput, sparkVersion) = EventLoggingListener.openEventLog(new Path(eventLogFile), fs)
744745
val replayBus = new ReplayListenerBus()
745746
val ui = SparkUI.createHistoryUI(new SparkConf, replayBus, new SecurityManager(conf),
@@ -758,7 +759,7 @@ private[spark] class Master(
758759
case fnf: FileNotFoundException =>
759760
// Event logging is enabled for this application, but no event logs are found
760761
val title = s"Application history not found (${app.id})"
761-
var msg = s"No event logs found for application $appName in $eventLogFile."
762+
var msg = s"No event logs found for application $appName in ${app.desc.eventLogDir}."
762763
logWarning(msg)
763764
msg += " Did you specify the correct logging directory?"
764765
msg = URLEncoder.encode(msg, "UTF-8")

0 commit comments

Comments
 (0)