You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@geode.apache.org by "Swapnil Bawaskar (JIRA)" <ji...@apache.org> on 2018/02/01 22:52:20 UTC

[jira] [Closed] (GEODE-4083) RegionVersionVector.updateLocalVersion can go into an infinite loop

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

Swapnil Bawaskar closed GEODE-4083.
-----------------------------------

> RegionVersionVector.updateLocalVersion can go into an infinite loop
> -------------------------------------------------------------------
>
>                 Key: GEODE-4083
>                 URL: https://issues.apache.org/jira/browse/GEODE-4083
>             Project: Geode
>          Issue Type: Bug
>          Components: regions
>            Reporter: Darrel Schneider
>            Assignee: Eric Shu
>            Priority: Major
>             Fix For: 1.4.0
>
>
> RegionVersionVector.updateLocalVersion can go into an infinite loop.
> The problem is this code:
> {code}
>   private void updateLocalVersion(long version) {
>     boolean repeat = false;
>     do {
>       long myVersion = this.localVersion.get();
>       if (myVersion < version) {
>         repeat = !this.localVersion.compareAndSet(myVersion, version);
>       }
>     } while (repeat);
>   }
> {code}
> if version is "1" and localVersion.get() returns "0" the first time it is called but then compareAndSet returns false because localVersion has changed to "2" then the loop will never terminate because repeat will always be false and myVersion ("2" or more) will never be less than version ("1").
> The simple fix is to be sure repeat is set to false when myVersion is >= to version.



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