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

ManagementListener.handleEvent logs a warning anytime a system Alert occurs

    XMLWordPrintableJSON

Details

    Description

      The IllegalMonitorStateException is being thrown because the read lock is acquired only if the ResourceEvent type is not SYSTEM_ALERT, but the code tries to unlock it unconditionally:

      Lock:

          if (event == ResourceEvent.CACHE_CREATE || event == ResourceEvent.CACHE_REMOVE) {
            readWriteLock.writeLock().lock();
          } else if (event != ResourceEvent.SYSTEM_ALERT) {
            readWriteLock.readLock().lock();
          }
      

      Unlock:

            if (event == ResourceEvent.CACHE_CREATE || event == ResourceEvent.CACHE_REMOVE) {
              readWriteLock.writeLock().unlock();
            } else {
              readWriteLock.readLock().unlock();
            }
      
      [vm0] [warn 2018/10/23 12:51:35.339 PDT <Pooled Message Processor 2> tid=0x58] attempt to unlock read lock, not locked by current thread
      [vm0] java.lang.IllegalMonitorStateException: attempt to unlock read lock, not locked by current thread
      [vm0] 	at java.util.concurrent.locks.ReentrantReadWriteLock$Sync.unmatchedUnlockException(ReentrantReadWriteLock.java:444)
      [vm0] 	at java.util.concurrent.locks.ReentrantReadWriteLock$Sync.tryReleaseShared(ReentrantReadWriteLock.java:428)
      [vm0] 	at java.util.concurrent.locks.AbstractQueuedSynchronizer.releaseShared(AbstractQueuedSynchronizer.java:1341)
      [vm0] 	at java.util.concurrent.locks.ReentrantReadWriteLock$ReadLock.unlock(ReentrantReadWriteLock.java:881)
      [vm0] 	at org.apache.geode.management.internal.beans.ManagementListener.handleEvent(ManagementListener.java:232)
      [vm0] 	at org.apache.geode.distributed.internal.InternalDistributedSystem.notifyResourceEventListeners(InternalDistributedSystem.java:2219)
      [vm0] 	at org.apache.geode.distributed.internal.InternalDistributedSystem.handleResourceEvent(InternalDistributedSystem.java:595)
      [vm0] 	at org.apache.geode.internal.admin.remote.AlertListenerMessage.process(AlertListenerMessage.java:106)
      [vm0] 	at org.apache.geode.distributed.internal.DistributionMessage.scheduleAction(DistributionMessage.java:367)
      [vm0] 	at org.apache.geode.distributed.internal.DistributionMessage$1.run(DistributionMessage.java:432)
      [vm0] 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      [vm0] 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      [vm0] 	at org.apache.geode.distributed.internal.ClusterDistributionManager.runUntilShutdown(ClusterDistributionManager.java:954)
      [vm0] 	at org.apache.geode.distributed.internal.ClusterDistributionManager.doProcessingThread(ClusterDistributionManager.java:820)
      [vm0] 	at org.apache.geode.internal.logging.LoggingThreadFactory.lambda$newThread$0(LoggingThreadFactory.java:121)
      [vm0] 	at java.lang.Thread.run(Thread.java:748)
      

      Attachments

        Issue Links

          Activity

            People

              klund Kirk Lund
              klund Kirk Lund
              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 - 20m
                  20m