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

Expensive JQL When Comparing Versions

XMLWordPrintable

      Problem

      JIRA is comparing all project versions, including released/archived, when performing a JQL search with operators: < , > , <=, >=. This can result in expensive requests taking a long time to complete, exhausting thread pools.

      Steps to Reproduce

      • Create multiple versions across multiple projects
      • Archive and Release some versions
      • Perform a JQL search for versions using one of the operators: < , > , <=, >=
        • Example:
          fixVersion < "Version 1"
          
        • Note: trying to restrict the JQL to specific tickets/projects does not help

      Threads

      Under high load, notice that majority of threads are stuck with a similar stack:

      "http-nio-8081-exec-135" #165077 daemon prio=5 tid=0x00007fabd4065000 nid=0x5a25 runnable [0x00007fa9580a2000]
         java.lang.Thread.State: RUNNABLE
      	at com.google.common.cache.LocalCache.getIfPresent(LocalCache.java:3926)
      	at com.google.common.cache.LocalCache$LocalManualCache.getIfPresent(LocalCache.java:4733)
      	at com.atlassian.cache.memory.DelegatingCachedReference.get(DelegatingCachedReference.java:67)
      	at com.atlassian.jira.project.CachingProjectManager.getProjectObj(CachingProjectManager.java:78)
      	at com.atlassian.jira.project.version.VersionImpl.getProjectObject(VersionImpl.java:57)
      	at com.atlassian.jira.issue.comparator.VersionComparator.compare(VersionComparator.java:24)
      	at com.atlassian.jira.issue.comparator.VersionComparator.compare(VersionComparator.java:8)
      	at com.atlassian.query.operator.Operator$9$1.evaluate(Operator.java:59)
      	at com.atlassian.jira.util.EvaluateAllPredicate.evaluate(EvaluateAllPredicate.java:23)
      	at com.atlassian.jira.util.collect.CollectionUtil$GCollectPredicate.apply(CollectionUtil.java:424)
      	at com.google.common.collect.Iterators$7.computeNext(Iterators.java:652)
      	at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143)
      	at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138)
      ...
      	at com.atlassian.jira.jql.query.RelationalOperatorIdIndexValueQueryFactory.generateRangeQueryForPredicate(RelationalOperatorIdIndexValueQueryFactory.java:111)
      	at com.atlassian.jira.jql.query.RelationalOperatorIdIndexValueQueryFactory.generateQueryForValue(RelationalOperatorIdIndexValueQueryFactory.java:94)
      	at com.atlassian.jira.jql.query.RelationalOperatorIdIndexValueQueryFactory.createQueryForSingleValue(RelationalOperatorIdIndexValueQueryFactory.java:59)
      	at com.atlassian.jira.jql.query.GenericClauseQueryFactory.getQuery(GenericClauseQueryFactory.java:59)
      	at com.atlassian.jira.jql.query.VersionCustomFieldClauseQueryFactory.getQuery(VersionCustomFieldClauseQueryFactory.java:36)
      	at com.atlassian.jira.jql.query.ContextAwareQueryVisitor.visit(ContextAwareQueryVisitor.java:97)
      ...
      	at com.atlassian.jira.issue.search.providers.LuceneSearchProvider.createLuceneQuery(LuceneSearchProvider.java:272)
      	at com.atlassian.jira.issue.search.providers.LuceneSearchProvider.getHits(LuceneSearchProvider.java:210)
      ...
      	at com.atlassian.jira.gadgets.system.IssueTableResource.createResponse(IssueTableResource.java:479)
      	at com.atlassian.jira.gadgets.system.IssueTableResource.getFilterTable(IssueTableResource.java:235)
      ...
      

      Debugger Details

      With a debugger attached, we see that when JIRA reaches the RelationalOperatorIdIndexValueQueryFactory.generateRangeQueryForPredicate, it performs a domainObjects = resolver.getAll() which returns all versions in JIRA. See screenshot where the domainObjects contain all versions from JIRA, including versions from mutiple projects, archived, released, unreleased:

      • JIRA then proceeds to compare every version in JIRA via the VersionComparator.

              szarazinski Sławomir Zaraziński
              dchan David Chan
              Votes:
              16 Vote for this issue
              Watchers:
              24 Start watching this issue

                Created:
                Updated:
                Resolved: