[[xgboost4j-spark] Exception while converting booster to XGBoost model
Hello, I sometimes see that even though training is successful and Rabit returns with status code 0, the following code causes the spark job to fail:
In xgboost/jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/XGBoost.scala: convertBoosterToXGBoostModel(distributedBoosters.first(), isClassificationTask)
Here, for some reason distributedBoosters.first() is causing the problem. I'm unable to figure out why that would be the case since distributedBoosters can never be empty.
Environment info
Operating System: Ubuntu 12.04.5 LTS
Compiler: gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
Package used (python/R/jvm/C++): jvm
xgboost version used: d9584ab
Steps to reproduce
val paramMap = List( "eta" -> 0.1, "max_depth" -> 6, "tracker_conf" -> TrackerConf(Duration(500, scala.concurrent.duration.SECONDS), "scala"), "objective" -> "binary:logistic").toMap
val classificationModel = XGBoost.trainWithDataFrame( dataset, paramMap, 300, nWorkers = 40, useExternalMemory = true, featureCol = "features", labelCol = "indexedLabel")
What have you tried?
INFO XGBoostSpark: Rabit returns with exit code 0
Container marked as failed: container_e497_1482450014832_615058_01_000031 on host. Exit status: 255. Diagnostics: Exception from container-launch.
2016-12-29 07:44:23,220 [Driver] (MLCoreSystemException:190) ERROR {"exceptionType":"SYSTEM","stackTrace":"org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 14.0 failed 10 times, most recent failure: Lost task 0.9 in stage 14.0 (TID 609, hadoopworker1143-sjc1.prod.uber.internal): ExecutorLostFailure (executor 12 exited caused by one of the running tasks) Reason: Container marked as failed: container_e497_1482450014832_615058_01_000017 on host: hadoopworker1143-sjc1.prod.uber.internal. Exit status: 255. Diagnostics: Exception from container-launch.\nContainer id: container_e497_1482450014832_615058_01_000017\nExit code: 255\nStack trace: ExitCodeException exitCode=255: \n\tat org.apache.hadoop.util.Shell.runCommand(Shell.java:573)\n\tat org.apache.hadoop.util.Shell.run(Shell.java:476)\n\tat org.apache.hadoop.util.Shell$ShellCommandExecutor.execute(Shell.java:758)\n\tat org.apache.hadoop.yarn.server.nodemanager.DefaultContainerExecutor.launchContainer(DefaultContainerExecutor.java:213)\n\tat org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainerLaunch.call(ContainerLaunch.java:302)\n\tat org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainerLaunch.call(ContainerLaunch.java:82)\n\tat java.util.concurrent.FutureTask.run(FutureTask.java:266)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)\n\tat java.lang.Thread.run(Thread.java:745)\n\n\nContainer exited with a non-zero exit code 255\n\nDriver stacktrace:\n\tat org.apache.spark.scheduler.DAGScheduler.org$apache$spark$scheduler$DAGScheduler$$failJobAndIndependentStages(DAGScheduler.scala:1450)\n\tat org.apache.spark.scheduler.DAGScheduler$$anonfun$abortStage$1.apply(DAGScheduler.scala:1438)\n\tat org.apache.spark.scheduler.DAGScheduler$$anonfun$abortStage$1.apply(DAGScheduler.scala:1437)\n\tat scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)\n\tat scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48)\n\tat org.apache.spark.scheduler.DAGScheduler.abortStage(DAGScheduler.scala:1437)\n\tat org.apache.spark.scheduler.DAGScheduler$$anonfun$handleTaskSetFailed$1.apply(DAGScheduler.scala:811)\n\tat org.apache.spark.scheduler.DAGScheduler$$anonfun$handleTaskSetFailed$1.apply(DAGScheduler.scala:811)\n\tat scala.Option.foreach(Option.scala:257)\n\tat org.apache.spark.scheduler.DAGScheduler.handleTaskSetFailed(DAGScheduler.scala:811)\n\tat org.apache.spark.scheduler.DAGSchedulerEventProcessLoop.doOnReceive(DAGScheduler.scala:1659)\n\tat org.apache.spark.scheduler.DAGSchedulerEventProcessLoop.onReceive(DAGScheduler.scala:1618)\n\tat org.apache.spark.scheduler.DAGSchedulerEventProcessLoop.onReceive(DAGScheduler.scala:1607)\n\tat org.apache.spark.util.EventLoop$$anon$1.run(EventLoop.scala:48)\n\tat org.apache.spark.scheduler.DAGScheduler.runJob(DAGScheduler.scala:632)\n\tat org.apache.spark.SparkContext.runJob(SparkContext.scala:1886)\n\tat org.apache.spark.SparkContext.runJob(SparkContext.scala:1899)\n\tat org.apache.spark.SparkContext.runJob(SparkContext.scala:1912)\n\tat org.apache.spark.rdd.RDD$$anonfun$take$1.apply(RDD.scala:1305)\n\tat org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)\n\tat org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:112)\n\tat org.apache.spark.rdd.RDD.withScope(RDD.scala:358)\n\tat org.apache.spark.rdd.RDD.take(RDD.scala:1279)\n\tat org.apache.spark.rdd.RDD$$anonfun$first$1.apply(RDD.scala:1319)\n\tat org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)\n\tat org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:112)\n\tat org.apache.spark.rdd.RDD.withScope(RDD.scala:358)\n\tat org.apache.spark.rdd.RDD.first(RDD.scala:1318)\n\tat ml.dmlc.xgboost4j.scala.spark.XGBoost$.postTrackerReturnProcessing(XGBoost.scala:306)\n\tat ml.dmlc.xgboost4j.scala.spark.XGBoost$.trainWithRDD(XGBoost.scala:297)\n\tat ml.dmlc.xgboost4j.scala.spark.XGBoostEstimator.train(XGBoostEstimator.scala:119)\n\tat ml.dmlc.xgboost4j.scala.spark.XGBoostEstimator.train(XGBoostEstimator.scala:34)\n\tat org.apache.spark.ml.Predictor.fit(Predictor.scala:97)\n\tat ml.dmlc.xgboost4j.scala.spark.XGBoost$.trainWithDataFrame(XGBoost.scala:181)
Also note that the training did happen successfully and I saw all the iteration logs with the error reducing gradually.
so you may want to confirm two things
-
whether all partitions contain data (I think the current code base handles empty partition, if you found this is the reason, it might be a bug)
-
upgrade your gcc to 4.8 and try
This was a data locality issue. Got fixed by setting spark.locality.wait. Basically, if first() is run on an executor which doesn't have the data local to it, then it will trigger a re-evaluation which will cause the problem
this is interesting, so, you're on YARN-cluster mode and first() is run on a node which never run a Spark task?
This seems to be a to-be-resolved issue
Hi CodingCat, I have seen the same issue as observed by nikunjgit, even after setting "spark.locality.wait=3s". Do you have any suggestion on what could be the root cause? I am still new to XGBoost and am trying to understand what is happening.
Thanks!