File Attachments cause Out Of Memory problems
The below is an example stacktrace when processing an email with 17MB of attachments (encoded bulks up to 28MB!) The solution to this is to add more memory to the heap, see https://confluence.atlassian.com/display/JIRA/Increasing+JIRA+Memory
2014-04-05 17:10:14,175 QuartzScheduler_Worker-1 ERROR ServiceRunner [org.quartz.core.ErrorLogger] Job (DEFAULT.ServicesJob threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: java.lang.OutOfMemoryError: Java heap space]
at org.quartz.core.JobRunShell.run(JobRunShell.java:206)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)
* Nested Exception (Underlying Cause) ---------------
java.lang.OutOfMemoryError: Java heap space
at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:133)
at java.io.OutputStreamWriter.write(OutputStreamWriter.java:220)
at java.io.Writer.write(Writer.java:157)
at org.apache.log4j.helpers.CountingQuietWriter.write(CountingQuietWriter.java:45)
at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:310)
at org.apache.log4j.RollingFileAppender.subAppend(RollingFileAppender.java:276)
at org.apache.log4j.WriterAppender.append(WriterAppender.java:162)
at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
at com.atlassian.jira.logging.JiraHomeAppender.doAppend(JiraHomeAppender.java:243)
at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66)
at org.apache.log4j.Category.callAppenders(Category.java:206)
at org.apache.log4j.Category.forcedLog(Category.java:391)
at org.apache.log4j.Category.log(Category.java:838)
at com.atlassian.jira.web.action.admin.mail.LogPrintStream.flush(LogPrintStream.java:29)
at com.atlassian.jira.web.action.admin.mail.LogPrintStream.write(LogPrintStream.java:118)
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291)
at sun.nio.cs.StreamEncoder.flushBuffer(StreamEncoder.java:104)
at java.io.OutputStreamWriter.flushBuffer(OutputStreamWriter.java:185)
at java.io.PrintStream.write(PrintStream.java:527)
at java.io.PrintStream.print(PrintStream.java:669)
at java.io.PrintStream.println(PrintStream.java:806)
at com.atlassian.jira.web.action.admin.mail.LogPrintStream.println(LogPrintStream.java:111)
at com.sun.mail.pop3.Protocol.issueCommand(Protocol.java:701)
at com.sun.mail.pop3.Protocol.retr(Protocol.java:447)
at com.sun.mail.pop3.POP3Message.getRawStream(POP3Message.java:175)
at com.sun.mail.pop3.POP3Message.getContentStream(POP3Message.java:271)
at javax.mail.internet.MimePartDataSource.getInputStream(MimePartDataSource.java:99)
at javax.mail.internet.MimeMultipart.parsebm(MimeMultipart.java:785)
at javax.mail.internet.MimeMultipart.parse(MimeMultipart.java:503)
at javax.mail.internet.MimeMultipart.getCount(MimeMultipart.java:244)
at com.javahollic.jira.emh.engine.support.EMHMailUtils.getBodyImpl(EMHMailUtils.java:1167)