SAP Knowledge Base Article - Preview

2712670 - Threads piling up and waiting to acquire lock on java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync

Symptom

  1. The performance of the server downgrades to a level that renders the admin cockpit and/or storefront unusable.
  2. The number of threads increases to (or close to) its maximum configured value.
  3. A large majority of threads are waiting to acquire a ReadLock:
    "Thread-2305" prio=5 tid=0x4080 nid=0xff0 WAITING - stats: cpu=6 blk=-1 wait=-1
    java.lang.Thread.State: WAITING
    at sun.misc.Unsafe.park(Native Method)
    parking to wait for java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync@10bb31f9
    at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:834)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireShared(AbstractQueuedSynchronizer.java:964)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireShared(AbstractQueuedSynchronizer.java:1282)
    at java.util.concurrent.locks.ReentrantReadWriteLock$ReadLock.lock(ReentrantReadWriteLock.java:731)
    ...
  4. Some threads are waiting to acquire a WriteLock:
    "Thread-1524" prio=5 tid=0x2698 nid=0xa8a WAITING - stats: cpu=679297 blk=-1 wait=-1
    java.lang.Thread.State: WAITING
    at sun.misc.Unsafe.park(Native Method)
    - parking to wait for java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync@10bb31f9
    at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:834)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:867)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1197)
    at java.util.concurrent.locks.ReentrantReadWriteLock$WriteLock.lock(ReentrantReadWriteLock.java:945)
    ...
  5. At the same time, the console.log shows a StackOverflowError which involves a WriteLock in the stack trace, or a StackOverflowError during the process of releasing the lock:
    SEVERE: >>java.lang.StackOverflowError
    INFO | jvm 1 | main | 2018/07/12 14:52:48.000 | >> at java.util.concurrent.locks.AbstractQueuedSynchronizer.compareAndSetTail(AbstractQueuedSynchronizer.java:2309)
    INFO | jvm 1 | main | 2018/07/12 14:52:48.000 | >> at java.util.concurrent.locks.AbstractQueuedSynchronizer.cancelAcquire(AbstractQueuedSynchronizer.java:763)
    INFO | jvm 1 | main | 2018/07/12 14:52:48.000 | >> at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:873)
    INFO | jvm 1 | main | 2018/07/12 14:52:48.000 | >> at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1197)
    INFO | jvm 1 | main | 2018/07/12 14:52:48.000 | >> at java.util.concurrent.locks.ReentrantReadWriteLock$WriteLock.lock(ReentrantReadWriteLock.java:945)
    INFO | jvm 1 | main | 2018/07/12 14:52:48.000 | >> at net.sf.ehcache.store.chm.SelectableConcurrentHashMap$Segment.remove(SelectableConcurrentHashMap.java:563)
    INFO | jvm 1 | main | 2018/07/12 14:52:48.000 | >> at net.sf.ehcache.store.chm.SelectableConcurrentHashMap.remove(SelectableConcurrentHashMap.java:393)
    INFO | jvm 1 | main | 2018/07/12 14:52:48.000 | >> at net.sf.ehcache.store.MemoryStore.remove(MemoryStore.java:359)
    INFO | jvm 1 | main | 2018/07/12 14:52:48.000 | >> at net.sf.ehcache.Cache.removeInternal(Cache.java:2401)
    INFO | jvm 1 | main | 2018/07/12 14:52:48.000 | >> at net.sf.ehcache.Cache.removeAndReturnElement(Cache.java:2246)
    INFO | jvm 1 | main | 2018/07/12 14:52:48.000 | >> at de.hybris.platform.regioncache.region.impl.EHCacheRegion.remove(EHCacheRegion.java:444)
    ...

    SEVERE: >>java.lang.StackOverflowError
    at java.util.concurrent.locks.AbstractQueuedSynchronizer.releaseShared(AbstractQueuedSynchronizer.java:1341) ~[?:1.8.0_221]
    at java.util.concurrent.locks.ReentrantReadWriteLock$ReadLock.unlock(ReentrantReadWriteLock.java:914) ~[?:1.8.0_221]
    at net.sf.ehcache.store.chm.SelectableConcurrentHashMap$Segment.get(SelectableConcurrentHashMap.java:735) ~[ehcache-2.9.0.jar:2.9.0]
    at net.sf.ehcache.store.chm.SelectableConcurrentHashMap.get(SelectableConcurrentHashMap.java:324) ~[ehcache-2.9.0.jar:2.9.0]
    at net.sf.ehcache.store.MemoryStore.get(MemoryStore.java:326) ~[ehcache-2.9.0.jar:2.9.0]
    at net.sf.ehcache.Cache.get(Cache.java:1734) ~[ehcache-2.9.0.jar:2.9.0]
    ...


Read more...

Environment

This issue is independent of the environment.

Product

SAP Commerce Cloud all versions ; SAP Commerce all versions

Keywords

ReentrantReadWriteLock, hybris, Commerce, Tomcat, maxThreads, readlock, writelock, synchronized, infinite loop, cyclic , KBA , CEC-COM-CPS , SAP Commerce , Problem

About this page

This is a preview of a SAP Knowledge Base Article. Click more to access the full version on SAP ONE Support launchpad (Login required).

Search for additional results

Visit SAP Support Portal's SAP Notes and KBA Search.