Uploaded image for project: 'Geode'
  1. Geode
  2. GEODE-4083

RegionVersionVector.updateLocalVersion can go into an infinite loop

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.4.0
    • regions
    • None

    Description

      RegionVersionVector.updateLocalVersion can go into an infinite loop.
      The problem is this 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);
        }
      

      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.

      Attachments

        Issue Links

          Activity

            People

              eshu Eric Shu
              dschneider Darrel Schneider
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: