[ 
https://issues.apache.org/jira/browse/SPARK-36717?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sean R. Owen resolved SPARK-36717.
----------------------------------
    Fix Version/s: 3.3.0
                   3.0.4
                   3.1.3
                   3.2.0
       Resolution: Fixed

Resolved by https://github.com/apache/spark/pull/33957

> Wrong order of variable initialization may lead to incorrect behavior
> ---------------------------------------------------------------------
>
>                 Key: SPARK-36717
>                 URL: https://issues.apache.org/jira/browse/SPARK-36717
>             Project: Spark
>          Issue Type: Bug
>          Components: Spark Core
>    Affects Versions: 3.1.2
>            Reporter: Jianmeng Li
>            Priority: Minor
>             Fix For: 3.2.0, 3.1.3, 3.0.4, 3.3.0
>
>
> Incorrect order of variable initialization may lead to incorrect behavior, 
> Related code: 
> [TorrentBroadcast.scala|https://github.com/apache/spark/blob/0494dc90af48ce7da0625485a4dc6917a244d580/core/src/main/scala/org/apache/spark/broadcast/TorrentBroadcast.scala#L94]
>  , TorrentBroadCast will get wrong checksumEnabled value after 
> initialization, this may not be what we need, we can move L94 front of 
> setConf(SparkEnv.get.conf) to avoid this.
> Supplement:
> Snippet 1:
> {code:java}
> class Broadcast {
>   def setConf(): Unit = {
>     checksumEnabled = true
>   }
>   setConf()
>   var checksumEnabled = false
> }
> println(new Broadcast().checksumEnabled){code}
> output:
> {code:java}
> false{code}
> Snippet 2:
> {code:java}
> class Broadcast {
>   var checksumEnabled = false
>   def setConf(): Unit = {
>     checksumEnabled = true
>   }
>   setConf()
> }
> println(new Broadcast().checksumEnabled){code}
> output: 
> {code:java}
> true{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to