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

ReIndex all code will not wait more than 30 seconds before throwing a RuntimeException

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: High High
    • 4.0
    • 4.0 - Beta 1
    • Indexing

      There is a bug in the DefaultIndexManager that will cause it to throw a RTE if the re-index all operation takes longer than 30 seconds.

                 final Index.Result result = issueIndexer.indexIssuesBatchMode(issuesIterable, context);
                  await(result);
      

      await ends up calling obtain() then then this

          private boolean obtain(final Awaitable waitFor)
          {
              try
              {
                  if (waitFor.await(indexConfig.getIndexLockWaitTime(), TimeUnit.MILLISECONDS))
                  {
                      return true;
                  }
              }
              catch (final InterruptedException ie)
              {
                  log.error("Wait attempt interrupted.", new IndexException("Wait attempt interrupted.", ie));
                  return false;
              }
              // We failed to acquire a lock after waiting the configured time (default=30s), so give up.
              final String errorMessage = "Wait attempt timed out - waited " + indexConfig.getIndexLockWaitTime() + " milliseconds";
              // TODO Adding the stack trace here is kind of redundant, as you can see it in the Thread Dump anyway.
              log.error(errorMessage, new IndexException(errorMessage));
              // Generate thread dump so that we can tell what the thread which holds the lock is doing
              // This should never throw an Exception
              ThreadDumpGenerator.generateThreadDump();
              return false;
          }
      

      This wont work to well with really large data sets such as JAC! The indexing will appear to have failed but in fact its still running.

            jed Jed Wesley-Smith (Inactive)
            bbaker ɹǝʞɐq pɐɹq
            Archiver:
            mandreacchio Michael Andreacchio

              Created:
              Updated:
              Resolved:
              Archived: