OutOfMemory due to Large Mailbox Processing
This page describes a singular cause for Out Of Memory Heap Space Errors. Refer to JIRA Crashes Due to OutOfMemoryError Java heap space for a general discussion.
Symptoms
JIRA crashes or behaves unpredictably when processing email. Logs contain errors like:
java.lang.OutOfMemoryError: Java heap space
Cause
JIRA's email handler will continually scan a mailbox trying to clear out messages. As it processes the email it will keep allocating memory to the task and eventually run out of memory. With hundreds of thousands of emails in a mailbox watched by the email handler, JIRA can run out of memory.
Diagnosis
To assess this issue, check the accounts configured from Creating Issues and Comments from Email. The troubleshooting section of that page offers tips on how to debug mail messages, which you can count to see the volume of mail handled.
Resolution
- As a temporary measure, increase JIRA's Heap Space allocation.
- Clean out the mailbox and double-check its settings.