Shixiong Zhu created SPARK-28486:
------------------------------------

             Summary: PythonBroadcast may delete the broadcast file while a 
Python worker still needs it
                 Key: SPARK-28486
                 URL: https://issues.apache.org/jira/browse/SPARK-28486
             Project: Spark
          Issue Type: New Feature
          Components: PySpark
    Affects Versions: 2.4.3
            Reporter: Shixiong Zhu


Steps to reproduce:
 * Run "bin/pyspark --master local[1,1] --conf spark.memory.fraction=0.0001" to 
start PySpark
 * Run the following codes:

{code:java}
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()
{code}
* Error:

{code}
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
{code}



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to