Skip to content

Commit 69d1b41

Browse files
committed
Do not block on posting SparkListenerApplicationEnd
1 parent 19d5dd0 commit 69d1b41

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

core/src/main/scala/org/apache/spark/SparkContext.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,7 @@ class SparkContext(config: SparkConf) extends Logging {
11881188
* condition exists in which the listeners may stop before this event has been propagated.
11891189
*/
11901190
private def postApplicationEnd() {
1191-
listenerBus.post(SparkListenerApplicationEnd(System.currentTimeMillis), blocking = true)
1191+
listenerBus.post(SparkListenerApplicationEnd(System.currentTimeMillis))
11921192
}
11931193

11941194
/** Post the environment update event once the task scheduler is ready */

core/src/main/scala/org/apache/spark/scheduler/LiveListenerBus.scala

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,13 @@ private[spark] class LiveListenerBus extends SparkListenerBus with Logging {
6868
started = true
6969
}
7070

71-
def post(event: SparkListenerEvent, blocking: Boolean = false) {
72-
if (!blocking) {
73-
val eventAdded = eventQueue.offer(event)
74-
if (!eventAdded && !queueFullErrorMessageLogged) {
75-
logError("Dropping SparkListenerEvent because no remaining room in event queue. " +
76-
"This likely means one of the SparkListeners is too slow and cannot keep up with the " +
77-
"rate at which tasks are being started by the scheduler.")
78-
queueFullErrorMessageLogged = true
79-
}
80-
} else {
81-
// Bypass the event queue and post to all attached listeners immediately
82-
postToAll(event)
71+
def post(event: SparkListenerEvent) {
72+
val eventAdded = eventQueue.offer(event)
73+
if (!eventAdded && !queueFullErrorMessageLogged) {
74+
logError("Dropping SparkListenerEvent because no remaining room in event queue. " +
75+
"This likely means one of the SparkListeners is too slow and cannot keep up with the " +
76+
"rate at which tasks are being started by the scheduler.")
77+
queueFullErrorMessageLogged = true
8378
}
8479
}
8580

0 commit comments

Comments
 (0)