Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-10563

SparkContext's local properties should be cloned when inherited

Log workAgile BoardRank to TopRank to BottomAttach filesAttach ScreenshotBulk Copy AttachmentsBulk Move AttachmentsVotersStop watchingWatchersCreate sub-taskConvert to sub-taskLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.0.0
    • 1.5.1, 1.6.0
    • Spark Core
    • None

    Description

      Currently, when a child thread inherits local properties from the parent thread, it gets a reference of the parent's local properties and uses them as default values.

      The problem, however, is that when the parent changes the value of an existing property, the changes are reflected in the child thread! This has very confusing semantics, especially in streaming.

      private val localProperties = new InheritableThreadLocal[Properties] {
        override protected def childValue(parent: Properties): Properties = new Properties(parent)
        override protected def initialValue(): Properties = new Properties()
      }
      

      Instead, we should make a clone of the parent properties rather than passing in a mutable reference.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            andrewor14 Andrew Or Assign to me
            andrewor14 Andrew Or
            Votes:
            0 Vote for this issue
            Watchers:
            2 Stop watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment