Skip to content

Commit 8911f44

Browse files
committed
synchronized getWorkerBroadcasts()
1 parent 6325fc1 commit 8911f44

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

core/src/main/scala/org/apache/spark/api/python/PythonRDD.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,9 @@ private[spark] object PythonRDD extends Logging {
303303
// remember the broadcasts sent to each worker
304304
private val workerBroadcasts = new mutable.WeakHashMap[Socket, mutable.Set[Long]]()
305305
private def getWorkerBroadcasts(worker: Socket) = {
306-
workerBroadcasts.getOrElseUpdate(worker, new mutable.HashSet[Long]())
306+
synchronized {
307+
workerBroadcasts.getOrElseUpdate(worker, new mutable.HashSet[Long]())
308+
}
307309
}
308310

309311
/**

0 commit comments

Comments
 (0)