You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Clebert Suconic (Jira)" <ji...@apache.org> on 2022/05/25 13:21:00 UTC

[jira] [Created] (ARTEMIS-3848) High cpu usage on ReadWrite locks

Clebert Suconic created ARTEMIS-3848:
----------------------------------------

             Summary: High cpu usage on ReadWrite locks
                 Key: ARTEMIS-3848
                 URL: https://issues.apache.org/jira/browse/ARTEMIS-3848
             Project: ActiveMQ Artemis
          Issue Type: Bug
    Affects Versions: 2.22.0
            Reporter: Clebert Suconic
            Assignee: Clebert Suconic
             Fix For: 2.23.0


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)




--
This message was sent by Atlassian Jira
(v8.20.7#820007)