GitHub user BryanCutler opened a pull request:

    https://github.com/apache/spark/pull/18695

    [SPARK-12717][PYTHON] Adding thread-safe broadcast pickle registry

    ## What changes were proposed in this pull request?
    
    When using PySpark broadcast variables in a multi-threaded environment,  
`SparkContext._pickled_broadcast_vars` becomes a shared resource.  A race 
condition can occur when broadcast variables that are pickled from one thread 
get added to the shared ` _pickled_broadcast_vars` and become part of the 
python command from another thread.  This PR introduces a thread-safe pickled 
registry where the lock can be acquired while the python command is pickled 
(causing the broadcast variable to be pickled and added to the registry) and 
all pickled broadcast variables for that command can be retrieved.
    
    ## How was this patch tested?
    
    Existing unit tests.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/BryanCutler/spark 
pyspark-bcast-threadsafe-SPARK-12717

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/18695.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #18695
    
----
commit b703f8359cee3c65018fe43f45e26c50771866c7
Author: Bryan Cutler <[email protected]>
Date:   2017-07-20T21:36:09Z

    Added thread-safe broadcast pickle registry

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to