How to Disable the Index Optimization Job in JIRA

Still need help?

The Atlassian Community is here for you.

Ask the community

Outdated

This page is outdated

tip/resting Created with Sketch.

This article applies to JIRA 5.1.5 and earlier.


Symptoms

  1. HTTP threads are timing out around the time the index optimization job runs.
  2. The index optimization job is taking longer than 30 seconds to finish.

The following appears in the atlassian-jira.log:

2012-08-22 00:00:00,014 QuartzWorker-1 INFO ServiceRunner     [issue.index.job.OptimizeIndexJob] Optimize Index Job running...
2012-08-22 00:01:38,253 QuartzWorker-1 INFO ServiceRunner     [issue.index.job.OptimizeIndexJob] Indexes Optimized. Took: 98237 milliseconds.
2012-08-22 00:01:38,253 QuartzWorker-1 INFO ServiceRunner     [issue.index.job.OptimizeIndexJob] Optimize Index Job complete.
...
2012-08-22 00:00:35,865 http-8000-Processor32 ERROR tstcreateissue230 62307x782180x10 779gde http://localhost:8000/secure/AddComment.jspa [jira.issue.index.DefaultIndexManager] Wait attempt timed out - waited 30000 milliseconds com.atlassian.jira.issue.index.IndexException: Wait attempt timed out - waited 30000 milliseconds 
	at com.atlassian.jira.issue.index.DefaultIndexManager.obtain(DefaultIndexManager.java:525) 
	at com.atlassian.jira.issue.index.DefaultIndexManager.await(DefaultIndexManager.java:466) 
	at com.atlassian.jira.issue.index.DefaultIndexManager.reIndexIssues(DefaultIndexManager.java:330) 
	at com.atlassian.jira.issue.index.DefaultIndexManager.reIndexIssues(DefaultIndexManager.java:282) 
	at com.atlassian.jira.issue.index.DefaultIndexManager.reIndexIssueObjects(DefaultIndexManager.java:292) 
	at sun.reflect.GeneratedMethodAccessor352.invoke(Unknown Source) 
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
	at java.lang.reflect.Method.invoke(Method.java:597) 
	at com.atlassian.util.profiling.object.ObjectProfiler.profiledInvoke(ObjectProfiler.java:70) 
	at com.atlassian.jira.config.component.SwitchingInvocationHandler.invoke(SwitchingInvocationHandler.java:28) 
	at $Proxy63.reIndexIssueObjects(Unknown Source) 
	at com.atlassian.jira.event.listeners.search.IssueIndexListener.reIndex(IssueIndexListener.java:155) 
	at com.atlassian.jira.event.listeners.search.IssueIndexListener.issueCommented(IssueIndexListener.java:88) 
	at com.atlassian.jira.event.issue.AbstractIssueEventListener.workflowEvent(AbstractIssueEventListener.java:112) 
	at com.atlassian.jira.event.issue.IssueEventDispatcher.dispatchEvent(IssueEventDispatcher.java:125) 
	at com.atlassian.jira.event.issue.IssueEventDispatcher.dispatchEvent(IssueEventDispatcher.java:83) 
	at com.atlassian.jira.web.action.issue.AddComment.alertSystemOfComment(AddComment.java:101) 
	at com.atlassian.jira.web.action.issue.AddComment.doExecute(AddComment.java:85) 
	at webwork.action.ActionSupport.execute(ActionSupport.java:153) 

Cause

The index optimization job can cause JIRA operations, such as HTTP threads to timeout if they occur whilst the job is running as the indexes are locked. This is currently being tracked here:  JRA-19145 - Getting issue details... STATUS . It will also cause additional problems with  JRA-29587 - Getting issue details... STATUS .

Resolution

tip/resting Created with Sketch.

This can also be caused by slow disk speed, please our Testing Disk Access Speed KB and test to see if the disk is causing problems first. If the disk speed is acceptable, this can be resolved by disabling the Index Optimization job.


  1. Add the following lines to <JIRA-HOME>/jira-config.properties:
    jira.index.max.reindexes=0
    jira.index.update.bulk.optimization=0
  2. (This step is for JIRA 5.0 to 5.1.5 only): Remove the entry for OptimizeIndexes job from <JIRA-install>/atlassian-jira/WEB-INF/classes/scheduler-config.xml:

            <trigger name="OptimizeIndexesTrigger" job="OptimizeIndexes" type="cron">
                <expression>0 0 0 * * ?</expression><!-- run at midnight -->
            </trigger>
    tip/resting Created with Sketch.

    This job is required in versions of JIRA prior to 5.0, and should only be removed for JIRA 5.0 and later.

    As of JIRA 5.1.6, this was removed (see  JRA-29487 - Getting issue details... STATUS  for further information).

  3. Restart JIRA.

Alternative Resolution

For versions of JIRA prior to 5.0, instead of disabling the Index Optimisation job we can schedule it to run another time. The scheduler configuration uses a cron expression, so to change it to 19:00 every day:

  1. Modify the  <JIRA-install>/atlassian-jira/WEB-INF/classes/scheduler-config.xml to below:

            <trigger name="OptimizeIndexesTrigger" job="OptimizeIndexes" type="cron">
                <expression>0 0 19 * * ?</expression><!-- run at 19:00 every day-->
            </trigger>
  2. Restart JIRA.
Last modified on Nov 12, 2018

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.