Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 00635200C83 for ; Thu, 20 Apr 2017 03:48:12 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id F355B160BAA; Thu, 20 Apr 2017 01:48:11 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 1ACC1160B9C for ; Thu, 20 Apr 2017 03:48:10 +0200 (CEST) Received: (qmail 30187 invoked by uid 500); 20 Apr 2017 01:48:09 -0000 Mailing-List: contact issues-help@spark.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@spark.apache.org Received: (qmail 30178 invoked by uid 99); 20 Apr 2017 01:48:09 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Apr 2017 01:48:09 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 36A9B1A7B7D for ; Thu, 20 Apr 2017 01:48:09 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id vAUOBHYRbjBx for ; Thu, 20 Apr 2017 01:48:08 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 177D361A0B for ; Thu, 20 Apr 2017 01:48:07 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 024F4E0D8F for ; Thu, 20 Apr 2017 01:48:06 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id C3AC72408B for ; Thu, 20 Apr 2017 01:48:04 +0000 (UTC) Date: Thu, 20 Apr 2017 01:48:04 +0000 (UTC) From: "Apache Spark (JIRA)" To: issues@spark.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Assigned] (SPARK-12717) pyspark broadcast fails when using multiple threads MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 20 Apr 2017 01:48:12 -0000 [ https://issues.apache.org/jira/browse/SPARK-12717?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Apache Spark reassigned SPARK-12717: ------------------------------------ Assignee: (was: Apache Spark) > pyspark broadcast fails when using multiple threads > --------------------------------------------------- > > Key: SPARK-12717 > URL: https://issues.apache.org/jira/browse/SPARK-12717 > Project: Spark > Issue Type: Bug > Components: PySpark > Affects Versions: 1.6.0 > Environment: Linux, python 2.6 or python 2.7. > Reporter: Edward Walker > Priority: Critical > > The following multi-threaded program that uses broadcast variables consistently throws exceptions like: *Exception("Broadcast variable '18' not loaded!",)* --- even when run with "--master local[10]". > {code:title=bug_spark.py|borderStyle=solid} > try: > import pyspark > except: > pass > from optparse import OptionParser > > def my_option_parser(): > op = OptionParser() > op.add_option("--parallelism", dest="parallelism", type="int", default=20) > return op > > def do_process(x, w): > return x * w.value > > def func(name, rdd, conf): > new_rdd = rdd.map(lambda x : do_process(x, conf)) > total = new_rdd.reduce(lambda x, y : x + y) > count = rdd.count() > print name, 1.0 * total / count > > if __name__ == "__main__": > import threading > op = my_option_parser() > options, args = op.parse_args() > sc = pyspark.SparkContext(appName="Buggy") > data_rdd = sc.parallelize(range(0,1000), 1) > confs = [ sc.broadcast(i) for i in xrange(options.parallelism) ] > threads = [ threading.Thread(target=func, args=["thread_" + str(i), data_rdd, confs[i]]) for i in xrange(options.parallelism) ] > for t in threads: > t.start() > for t in threads: > t.join() > {code} > Abridged run output: > {code:title=abridge_run.txt|borderStyle=solid} > % spark-submit --master local[10] bug_spark.py --parallelism 20 > [snip] > 16/01/08 17:10:20 ERROR Executor: Exception in task 0.0 in stage 9.0 (TID 9) > org.apache.spark.api.python.PythonException: Traceback (most recent call last): > File "/Network/Servers/mother.adverplex.com/Volumes/homeland/Users/walker/.spark/spark-1.6.0-bin-hadoop2.6/python/lib/pyspark.zip/pyspark/worker.py", line 98, in main > command = pickleSer._read_with_length(infile) > File "/Network/Servers/mother.adverplex.com/Volumes/homeland/Users/walker/.spark/spark-1.6.0-bin-hadoop2.6/python/lib/pyspark.zip/pyspark/serializers.py", line 164, in _read_with_length > return self.loads(obj) > File "/Network/Servers/mother.adverplex.com/Volumes/homeland/Users/walker/.spark/spark-1.6.0-bin-hadoop2.6/python/lib/pyspark.zip/pyspark/serializers.py", line 422, in loads > return pickle.loads(obj) > File "/Network/Servers/mother.adverplex.com/Volumes/homeland/Users/walker/.spark/spark-1.6.0-bin-hadoop2.6/python/lib/pyspark.zip/pyspark/broadcast.py", line 39, in _from_id > raise Exception("Broadcast variable '%s' not loaded!" % bid) > Exception: (Exception("Broadcast variable '6' not loaded!",), , (6L,)) > at org.apache.spark.api.python.PythonRunner$$anon$1.read(PythonRDD.scala:166) > at org.apache.spark.api.python.PythonRunner$$anon$1.(PythonRDD.scala:207) > at org.apache.spark.api.python.PythonRunner.compute(PythonRDD.scala:125) > at org.apache.spark.api.python.PythonRDD.compute(PythonRDD.scala:70) > at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:306) > at org.apache.spark.rdd.RDD.iterator(RDD.scala:270) > at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:66) > at org.apache.spark.scheduler.Task.run(Task.scala:89) > at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:213) > at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) > at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) > at java.lang.Thread.run(Thread.java:745) > [snip] > {code} -- This message was sent by Atlassian JIRA (v6.3.15#6346) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org For additional commands, e-mail: issues-help@spark.apache.org