Github user JoshRosen commented on the pull request:

    https://github.com/apache/spark/pull/5277#issuecomment-87942978
  
    > From the comments and codes, only activeContext, contextBeingConstructed 
and stopped are protected by SPARK_CONTEXT_CONSTRUCTOR_LOCK.
    
    @zsxwing, I took a closer look and I'm not even sure that we need the 
synchronization for guarding `stopped`, since it's volatile: 
    
    ```
      @volatile private var stopped: Boolean = false
    ```
    
    I suppose that the `SPARK_CONTEXT_CONSTRUCTOR_LOCK` was preventing multiple 
threads from being in `stop()` at the same time, but I don't know that we need 
to enforce that requirement; it's not enforced in pre-1.2 versions of the code 
(such as 
https://github.com/apache/spark/blob/39761f515d65afff377873ee4701b9313c317a60/core/src/main/scala/org/apache/spark/SparkContext.scala#L1024).
  Maybe we can resolve this deadlock by removing this `synchronized` call?


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to