OutOfMemoryError Caused by Large Comments or Descriptions in an Issue

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

症状

An OutOfMemoryError is thrown by JIRA.

atlassian-jira.log に次のメッセージが表示される。

2014-07-02 16:33:58,772 http-bio-6974-exec-23 ERROR username 993x628x2 bf7s1 127.0.0.1 /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 .

ソリューション

データベースの変更を行う場合は 必ず事前にバックアップを取得してください。可能な場合はテスト サーバーで変更を試すことをおすすめします。

  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,
           a.id,
           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,
           i.id,
           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 .

最終更新日: 2016 年 9 月 29 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.