Uploaded image for project: 'ActiveMQ Artemis'
  1. ActiveMQ Artemis
  2. ARTEMIS-3848

High cpu usage on ReadWrite locks

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.22.0
    • 2.23.0
    • None
    • None

    Description

      our HandlerBase is setting a boolean value if it's in handler.

      I thought by setting it to null I was clearing the ThreadLocal variable, however that's just creating a null entry.

      What makes it worst is the fact that threadLocal was non static. as a result we are getting a lot of entries on the ThreadLocal HashMap. as connections come and go, that will generate a leak on the thread.

      That will cause threads on the following stack trace to consume a lot of CPU:

      at java.lang.ThreadLocal$ThreadLocalMap.expungeStaleEntry(ThreadLocal.java:638)
      at java.lang.ThreadLocal$ThreadLocalMap.remove(ThreadLocal.java:520)
      at java.lang.ThreadLocal$ThreadLocalMap.access$200(ThreadLocal.java:319)
      at java.lang.ThreadLocal.remove(ThreadLocal.java:242)
      at java.util.concurrent.locks.ReentrantReadWriteLock$Sync.tryReleaseShared(ReentrantReadWriteLock.java:426)
      at java.util.concurrent.locks.AbstractQueuedSynchronizer.releaseShared(AbstractQueuedSynchronizer.java:1341)
      at java.util.concurrent.locks.ReentrantReadWriteLock$ReadLock.unlock(ReentrantReadWriteLock.java:881)

      Attachments

        Issue Links

          Activity

            People

              clebertsuconic Clebert Suconic
              clebertsuconic Clebert Suconic
              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 - 2h
                  2h