Github user JoshRosen commented on a diff in the pull request: https://github.com/apache/spark/pull/1606#discussion_r15436589 --- Diff: python/pyspark/context.py --- @@ -249,17 +258,14 @@ def defaultMinPartitions(self): """ return self._jsc.sc().defaultMinPartitions() - def __del__(self): --- End diff -- Because we keep a reference to this object in `SparkContext._active_spark_context`, this method never gets called except when cleaning up after a `SparkContext` creation attempt that failed because another context was already running. In that case, the call to `sc.stop()` clears `SparkContext._active_spark_context` and we lose track of the active context, which can allow the creation of multiple running contexts.
--- 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. ---