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

Billy Liu reassigned KYLIN-2874:
--------------------------------

    Assignee: liyang

> Ineffective check in CubeDesc#getInitialCuboidScheduler
> -------------------------------------------------------
>
>                 Key: KYLIN-2874
>                 URL: https://issues.apache.org/jira/browse/KYLIN-2874
>             Project: Kylin
>          Issue Type: Bug
>            Reporter: Ted Yu
>            Assignee: liyang
>            Priority: Major
>             Fix For: v2.3.0
>
>
> {code}
>     public CuboidScheduler getInitialCuboidScheduler() {
>         if (cuboidScheduler != null)
>             return cuboidScheduler;
>         synchronized (this) {
>             if (cuboidScheduler == null) {
>                 cuboidScheduler = CuboidScheduler.getInstance(this);
>             }
> {code}
> Suppose thread 1 obtains the lock and modifies cuboidScheduler.
> This modification can be re-ordered with other correlated field assignments 
> within this critical section at runtime. Thus, checking the value of 
> cuboidScheduler is not an effective test that the critical section has 
> completed unless the guarding lock is held while checking.
> When cuboidScheduler is assigned a newly constructed value, the JVM is 
> allowed to reorder the assignment of the new reference to cuboidScheduler 
> before any field assignments that may occur in the constructor.
> If thread 2 comes and read cuboidScheduler, it may use partially initialized 
> object.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to