Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-28486

PythonBroadcast may delete the broadcast file while a Python worker still needs it

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.3
    • Fix Version/s: 3.0.0
    • Component/s: PySpark
    • Labels:
      None

      Description

      Steps to reproduce:

      • Run "bin/pyspark --master local[1,1] --conf spark.memory.fraction=0.0001" to start PySpark
      • Run the following codes:
      b = sc.broadcast([100])
      sc.parallelize([0],1).map(lambda x: 0 if x == 0 else b.value[0]).collect()
      sc._jvm.java.lang.System.gc()
      import time
      time.sleep(5)
      sc._jvm.java.lang.System.gc()
      time.sleep(5)
      sc.parallelize([1],1).map(lambda x: 0 if x == 0 else b.value[0]).collect()
      
      • Error:
      IOError: [Errno 2] No such file or directory: u'.../spark-ee2a0da1-7d2e-48fd-be9a-fdcc89c5076c/broadcast4970491472715621982'
      
      	at org.apache.spark.api.python.BasePythonRunner$ReaderIterator.handlePythonException(PythonRunner.scala:452)
      	at org.apache.spark.api.python.PythonRunner$$anon$1.read(PythonRunner.scala:588)
      	at org.apache.spark.api.python.PythonRunner$$anon$1.read(PythonRunner.scala:571)
      	at org.apache.spark.api.python.BasePythonRunner$ReaderIterator.hasNext(PythonRunner.scala:406)
      	at org.apache.spark.InterruptibleIterator.hasNext(InterruptibleIterator.scala:37)
      	at scala.collection.Iterator$class.foreach(Iterator.scala:891)
      	at org.apache.spark.InterruptibleIterator.foreach(InterruptibleIterator.scala:28)
      	at scala.collection.generic.Growable$class.$plus$plus$eq(Growable.scala:59)
      	at scala.collection.mutable.ArrayBuffer.$plus$plus$eq(ArrayBuffer.scala:104)
      	at scala.collection.mutable.ArrayBuffer.$plus$plus$eq(ArrayBuffer.scala:48)
      	at scala.collection.TraversableOnce$class.to(TraversableOnce.scala:310)
      	at org.apache.spark.InterruptibleIterator.to(InterruptibleIterator.scala:28)
      	at scala.collection.TraversableOnce$class.toBuffer(TraversableOnce.scala:302)
      	at org.apache.spark.InterruptibleIterator.toBuffer(InterruptibleIterator.scala:28)
      	at scala.collection.TraversableOnce$class.toArray(TraversableOnce.scala:289)
      	at org.apache.spark.InterruptibleIterator.toArray(InterruptibleIterator.scala:28)
      	at org.apache.spark.rdd.RDD$$anonfun$collect$1$$anonfun$13.apply(RDD.scala:945)
      	at org.apache.spark.rdd.RDD$$anonfun$collect$1$$anonfun$13.apply(RDD.scala:945)
      	at org.apache.spark.SparkContext$$anonfun$runJob$5.apply(SparkContext.scala:2101)
      	at org.apache.spark.SparkContext$$anonfun$runJob$5.apply(SparkContext.scala:2101)
      	at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:90)
      	at org.apache.spark.scheduler.Task.run(Task.scala:121)
      	at org.apache.spark.executor.Executor$TaskRunner$$anonfun$10.apply(Executor.scala:408)
      	at org.apache.spark.util.Utils$.tryWithSafeFinally(Utils.scala:1360)
      	at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:414)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	... 1 more
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Ngone51 wuyi
                Reporter:
                zsxwing Shixiong Zhu
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: