Why Does the Spark RESTful API Return Incorrect Application Information?
Symptom
After a Spark application stops, accessing its REST API to retrieve job information may show a negative value for numActiveTasks, as shown in Figure 1.
numActiveTasks indicates the number of currently running tasks.
Procedure
- Set spark.history.briefInfo.gather to true and view brief information about JobHistory.
- Access the Spark JobHistory2x page at https://IP:port/api/v1/<appid>/jobs/.
The value of numActiveTasks in the job information is calculated by finding the difference between the number of SparkListenerTaskStart events and SparkListenerTaskEnd events in the eventlog file. If any of these events are lost from the eventLog file, this issue will occur.
