You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kylin.apache.org by "Shaofeng SHI (JIRA)" <ji...@apache.org> on 2016/04/21 04:10:25 UTC

[jira] [Resolved] (KYLIN-1563) Unsafe check of initiated in HybridInstance#init()

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

Shaofeng SHI resolved KYLIN-1563.
---------------------------------
       Resolution: Fixed
    Fix Version/s: v1.5.2

> Unsafe check of initiated in HybridInstance#init()
> --------------------------------------------------
>
>                 Key: KYLIN-1563
>                 URL: https://issues.apache.org/jira/browse/KYLIN-1563
>             Project: Kylin
>          Issue Type: Bug
>            Reporter: Ted Yu
>            Assignee: Shaofeng SHI
>             Fix For: v1.5.2
>
>
> {code}
>     private void init() {
>         if (initiated == true)
>             return;
>         synchronized (this) {
>             if (initiated == true)
>                 return;
>             if (realizationEntries == null || realizationEntries.size() == 0)
>                 throw new IllegalArgumentException();
> {code}
> Suppose there are two threads executing the above code.
> Thread1 uses the value read from field initiated in the condition initiated == true. It sees that the condition is false.
> Thread2 checks variable initiated, reading it after Thread1 assigns to initiated but before some of the correlated field assignments take place. It sees the condition initiated == true as being true. It continues on before the critical section has completed, and can read data changed by that critical section while it is in an inconsistent state.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)