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

RedundancyLogger might throw NPE

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.9.0
    • 1.9.0
    • None

    Description

      I noticed in some tests with following error logged in debug level:
      
      [debug 2019/04/10 11:25:52.904 PDT <RedundancyLogger for region TestRegion> tid=0x55] Unexpected exception in PR redundancy recovery
      java.lang.NullPointerException
              at org.apache.geode.internal.cache.partitioned.RedundancyLogger.run2(RedundancyLogger.java:154)
              at org.apache.geode.internal.cache.partitioned.RecoveryRunnable.run(RecoveryRunnable.java:59)
              at java.lang.Thread.run(Thread.java:748)
      
      Then I looked at the code that it's using:
      (this.allBucketsRecoveredFromDisk.getCount() > 0) in more than one places.
      
      The allBucketsRecoveredFromDisk is referecing to the object in PRHARedundancyProvider. 
      But in PRHARedundancyProvider, it is using:
        public boolean isPersistentRecoveryComplete() {
          if (!ColocationHelper.checkMembersColocation(this.prRegion, this.prRegion.getMyId())) {
            return false;
          }
      
          if (allBucketsRecoveredFromDisk != null && allBucketsRecoveredFromDisk.getCount() > 0) {
            return false;
          }
      
      So allBucketsRecoveredFromDisk could be null. We should alway use 
      "(allBucketsRecoveredFromDisk != null && allBucketsRecoveredFromDisk.getCount() > 0) " instead of "(this.allBucketsRecoveredFromDisk.getCount() > 0)"
      
      

      Attachments

        Issue Links

          Activity

            People

              eshu Eric Shu
              zhouxj Xiaojian Zhou
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1.5h
                  1.5h