[ 
http://issues.apache.org/jira/browse/JAMES-134?page=comments#action_12362806 ] 

OG commented on JAMES-134:
--------------------------

I looked further at MimeMessage, and I saw that also the constructor "public 
MimeMessage(MimeMessage source)" read it all to RAM (by reading into a 
ByteArrayOutputStream, and then into a SharedByteArrayInputStream which is also 
based on an array). Fortunately, it seems like the variables that are 
manipulated
in these constructors are protected, and therefor could be accessed from a 
subclass that is in a different package, which means that we can make  a 
subclass called 
"JamesMimeMessage" and have it override these constructors, and re do them with 
a "JamesSharedInputStream". The  "JamesSharedInputStream" can be based on a 
file and not on a huge array, and have maybe a small buffer for performance, 
and the stuff it needs in order to implement SharedInputStream. Then the 
MimeMessage instances could be replaced with the "JamesMimeMessage" instances, 
and this will solve the problem with MimeMessage.

What do you think?

Any other places have huge byte[]?

> Large emails in the spool cause SpoolManager to throw OutOfMemoryError
> ----------------------------------------------------------------------
>
>          Key: JAMES-134
>          URL: http://issues.apache.org/jira/browse/JAMES-134
>      Project: James
>         Type: Bug
>   Components: SpoolManager & Processors
>     Versions: 2.1, 2.1.3, 2.0a3, 2.2.0
>  Environment: Operating System: MacOS X
> Platform: Macintosh
>     Reporter: Matt Bishop
>  Attachments: TestMemRec.java
>
> Steps to repro:
> 1. Send yourself a very large email (16 megs works for me)
> 2. check the SpoolManager log and see this over and over:
> ERROR spoolmanager: Exception in JamesSpoolManager.run null
> java.lang.OutOfMemoryError
> What makes this problem particularly bad is that the spoolmanager doesn't 
> move on to other 
> messages but keeps pegging the CPU trying to process this email.  To fix it, 
> I have to shut down 
> james, delete the email files out of spool and restart.
> EXPECTED: email should spool to the user as expected.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to