OutOfMemoryError Caused by Large Comments or Descriptions in an Issue

Still need help?

The Atlassian Community is here for you.

Ask the community


An OutOfMemoryError is thrown by JIRA.

The following appears in the atlassian-jira.log:

2014-07-02 16:33:58,772 http-bio-6974-exec-23 ERROR username 993x628x2 bf7s1 /rest/issueNav/1/issueTable [common.error.jersey.ThrowableExceptionMapper] Uncaught exception thrown by REST service: Java heap space
java.lang.OutOfMemoryError: Java heap space
	at java.util.Arrays.copyOf(Arrays.java:2367)
	at java.lang.StringCoding.safeTrim(StringCoding.java:89)
	at java.lang.StringCoding.access$100(StringCoding.java:50)
	at java.lang.StringCoding$StringDecoder.decode(StringCoding.java:154)
	at java.lang.StringCoding.decode(StringCoding.java:193)
	at java.lang.String.<init>(String.java:416)
	at org.apache.lucene.store.DataInput.readString(DataInput.java:182)
	at org.apache.lucene.index.FieldsReader.addField(FieldsReader.java:431)
	at org.apache.lucene.index.FieldsReader.doc(FieldsReader.java:261)
	at org.apache.lucene.index.SegmentReader.document(SegmentReader.java:471)
	at org.apache.lucene.index.DirectoryReader.document(DirectoryReader.java:564)
	at org.apache.lucene.index.IndexReader.document(IndexReader.java:844)
	at org.apache.lucene.search.IndexSearcher.doc(IndexSearcher.java:242)
	at com.atlassian.jira.index.DelegateSearcher.doc(DelegateSearcher.java:93)
	at com.atlassian.jira.plugin.issuenav.service.issuetable.IssueDocumentAndIdCollector.addMatch(IssueDocumentAndIdCollector.java:207)
	at com.atlassian.jira.plugin.issuenav.service.issuetable.IssueDocumentAndIdCollector.computeResult(IssueDocumentAndIdCollector.java:186)
	at com.atlassian.jira.plugin.issuenav.service.issuetable.AbstractIssueTableCreator.executeNormalSearch(AbstractIssueTableCreator.java:237)
	at com.atlassian.jira.plugin.issuenav.service.issuetable.AbstractIssueTableCreator.create(AbstractIssueTableCreator.java:202)
	at com.atlassian.jira.plugin.issuenav.service.issuetable.DefaultIssueTableService.createIssueTableFromCreator(DefaultIssueTableService.java:188)
	at com.atlassian.jira.plugin.issuenav.service.issuetable.DefaultIssueTableService.getIssueTable(DefaultIssueTableService.java:302)
	at com.atlassian.jira.plugin.issuenav.service.issuetable.DefaultIssueTableService.getIssueTableFromFilterWithJql(DefaultIssueTableService.java:124)
	at com.atlassian.jira.plugin.issuenav.rest.IssueTableResource.getIssueTableHtml(IssueTableResource.java:99)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)


An OutOfMemoryError can be caused by almost anything, however in this specific example it's caused by very large descriptions (or comments) in issues. Those issues were created by automated scripts that inserted a significant amount of characters into the size of the issues. When JIRA attempts to read these issues it will run out of memory. There is a bug raised for this under  JRA-28519 - Getting issue details... STATUS .


Always back up your data before performing any modification to the database. If possible, try your modifications on a test server.

  1. First identify if there are any large comments (this SQL is PostgreSQL and may need to be modified depending upon the DBMS):

    SELECT ( p.pkey
             || '-'
             || i.issuenum )         AS issue,
           char_length(a.actionbody) AS size
    FROM   jiraaction a,
           jiraissue i,
           project p
    WHERE  i.project = p.id
           AND i.id = a.issueid
           AND a.actiontype = 'comment'
    ORDER  BY size DESC;

    (info) This will give the number of characters as the size. Anything over 300k may need to be reviewed.

  2. And then any large descriptions:

    SELECT ( p.pkey
             || '-'
             || i.issuenum )          AS issue,
           char_length(i.description) AS size
    FROM   jiraissue i,
           project p
    WHERE  i.project = p.id
           AND i.description IS NOT NULL
    ORDER  BY size DESC;  
  3. If these issues are particularly large, deleting them will resolve the problem. This should be done by getting the ID from step 1 or 2 and deleting them by accessing http://<BASE-URL>/secure/DeleteIssue!default.jspa?id=<Issue ID>. The issue must be deleted through the GUI otherwise it can leave orphaned records in the database that may still be causing problems.
  4. Identify how the issues are being created and address this to prevent it from continuing to happen.
  5. Set the jira.text.field.character.limit as per Edit the jira-config.properties file in Jira server. A sensible limit could be around 30k.
    (warning) For mail this is only applied in JIRA 6.3.12 and higher as per JRA-38357 - Getting issue details... STATUS .

Last modified on Oct 29, 2016

Was this helpful?

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