Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-62666

JIRA method getVersionsByName inefficiently populates the cache

XMLWordPrintable

      Summary

      JIRA method getVersionsByName inefficiently populates the cache

      Environment

      Instances with large number of Versions are affected, example: 10000+

      Steps to Reproduce

      1. Restart JIRA
      2. Open filter with large number of Versions.

      Expected Results

      JIRA populates Versions cache quickly.

      Actual Results

      JIRA populates Versions cache very slow.
      Thread is populating the cache in the getVersionsByName method from DB which is slow:

      "http-bio-8080-exec-2933 uri:/jira/secure/BrowseProject.jspa username:" #125197 daemon prio=5 os_prio=0 tid=0x00007f74a40ac800 nid=0xc37 runnable [0x00007f735f0a8000]
         java.lang.Thread.State: RUNNABLE
      	at java.net.SocketInputStream.socketRead0(Native Method)
      ...
      	at oracle.jdbc.driver.InsensitiveScrollableResultSet.absoluteInternal(InsensitiveScrollableResultSet.java:979)
      ...
      	at org.ofbiz.core.entity.EntityListIterator.getCompleteList(EntityListIterator.java:308)
      ...
      	at com.atlassian.jira.project.version.OfBizVersionStore.getAllVersions(OfBizVersionStore.java:44)
      	at com.atlassian.jira.project.version.OfBizVersionStore.getVersionsByName(OfBizVersionStore.java:64)
      ...
      	at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3573)
      ...
      	at com.atlassian.cache.memory.DelegatingCache$DelegatingLoadingCache.get(DelegatingCache.java:324)
      	at com.atlassian.jira.project.version.CachingVersionStore.getVersionsByName(CachingVersionStore.java:148)
      	at com.atlassian.jira.project.version.DefaultVersionManager.getVersionsByName(DefaultVersionManager.java:577)
      ...
      

      Notes

      Call version.OfBizVersionStore#getVersionsByName resolves each version one by one, to resolve version it loads all versions from DB

      Full stack-trace for Oracle DB:

      "http-bio-8080-exec-2933 uri:/jira/secure/BrowseProject.jspa username:" #125197 daemon prio=5 os_prio=0 tid=0x00007f74a40ac800 nid=0xc37 runnable [0x00007f735f0a8000]
         java.lang.Thread.State: RUNNABLE
      	at java.net.SocketInputStream.socketRead0(Native Method)
      	at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
      	at java.net.SocketInputStream.read(SocketInputStream.java:170)
      	at java.net.SocketInputStream.read(SocketInputStream.java:141)
      	at oracle.net.ns.Packet.receive(Packet.java:311)
      	at oracle.net.ns.DataPacket.receive(DataPacket.java:105)
      	at oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:305)
      	at oracle.net.ns.NetInputStream.read(NetInputStream.java:249)
      	at oracle.net.ns.NetInputStream.read(NetInputStream.java:171)
      	at oracle.net.ns.NetInputStream.read(NetInputStream.java:89)
      	at oracle.jdbc.driver.T4CSocketInputStreamWrapper.readNextPacket(T4CSocketInputStreamWrapper.java:123)
      	at oracle.jdbc.driver.T4CSocketInputStreamWrapper.read(T4CSocketInputStreamWrapper.java:79)
      	at oracle.jdbc.driver.T4CMAREngineStream.unmarshalUB1(T4CMAREngineStream.java:429)
      	at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:397)
      	at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:257)
      	at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:587)
      	at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:225)
      	at oracle.jdbc.driver.T4CPreparedStatement.fetch(T4CPreparedStatement.java:1066)
      	at oracle.jdbc.driver.OracleStatement.fetchMoreRows(OracleStatement.java:3716)
      	at oracle.jdbc.driver.InsensitiveScrollableResultSet.fetchMoreRows(InsensitiveScrollableResultSet.java:1015)
      	at oracle.jdbc.driver.InsensitiveScrollableResultSet.absoluteInternal(InsensitiveScrollableResultSet.java:979)
      	at oracle.jdbc.driver.InsensitiveScrollableResultSet.next(InsensitiveScrollableResultSet.java:579)
      	- locked <0x000000022bcaf158> (a oracle.jdbc.driver.T4CConnection)
      	at org.apache.commons.dbcp.DelegatingResultSet.next(DelegatingResultSet.java:207)
      	at org.apache.commons.dbcp.DelegatingResultSet.next(DelegatingResultSet.java:207)
      	at org.ofbiz.core.entity.EntityListIterator.next(EntityListIterator.java:245)
      	at org.ofbiz.core.entity.EntityListIterator.getCompleteList(EntityListIterator.java:308)
      	at org.ofbiz.core.entity.GenericDAO.selectByAnd(GenericDAO.java:731)
      	at org.ofbiz.core.entity.GenericHelperDAO.findByAnd(GenericHelperDAO.java:150)
      	at org.ofbiz.core.entity.GenericDelegator.findByAnd(GenericDelegator.java:901)
      	at org.ofbiz.core.entity.GenericDelegator.findByAnd(GenericDelegator.java:879)
      	at org.ofbiz.core.entity.GenericDelegator.findAll(GenericDelegator.java:802)
      	at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findAll(DefaultOfBizDelegator.java:361)
      	at com.atlassian.jira.ofbiz.WrappingOfBizDelegator.findAll(WrappingOfBizDelegator.java:206)
      	at com.atlassian.jira.project.version.OfBizVersionStore.getAllVersions(OfBizVersionStore.java:44)
      	at com.atlassian.jira.project.version.OfBizVersionStore.getVersionsByName(OfBizVersionStore.java:64)
      	at com.atlassian.jira.project.version.CachingVersionStore$3.load(CachingVersionStore.java:71)
      	at com.atlassian.jira.project.version.CachingVersionStore$3.load(CachingVersionStore.java:66)
      	at com.atlassian.cache.memory.MemoryCacheManager$3$1.load(MemoryCacheManager.java:132)
      	at com.atlassian.cache.memory.BlockingCacheLoader.load(BlockingCacheLoader.java:51)
      	at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3573)
      	at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2350)
      	at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2313)
      	- locked <0x0000000679800570> (a com.google.common.cache.LocalCache$StrongEntry)
      	at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2228)
      	at com.google.common.cache.LocalCache.get(LocalCache.java:3970)
      	at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3974)
      	at com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4834)
      	at com.atlassian.cache.memory.DelegatingCache$DelegatingLoadingCache.get(DelegatingCache.java:324)
      	at com.atlassian.jira.project.version.CachingVersionStore.getVersionsByName(CachingVersionStore.java:148)
      	at com.atlassian.jira.project.version.DefaultVersionManager.getVersionsByName(DefaultVersionManager.java:577)
      ...
      

      Workaround

      None

              Unassigned Unassigned
              ayakovlev@atlassian.com Andriy Yakovlev [Atlassian]
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: