issues@javamail.java.net

[Bug 4743] New: javamail 1.4.4 - OOM occurs when receive emails for a POP3 account that has more than 14,612,804 messages in INBOX

From: <bugzilla-daemon_at_kenai.com>
Date: Tue, 28 Feb 2012 02:47:17 +0000

http://kenai.com/bugzilla/show_bug.cgi?id=4743

             Bug #: 4743
           Summary: javamail 1.4.4 - OOM occurs when receive emails for a
                    POP3 account that has more than 14,612,804 messages in
                    INBOX
    Classification: Unclassified
           Product: javamail
           Version: 1.4.4
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P5
         Component: pop3
        AssignedTo: shannon_at_kenai.com
        ReportedBy: jamesjin_at_kenai.com
                CC: issues_at_javamail.kenai.com


We encounters OOM (OutOfMemoryError) when tried to receive emails for a POP3
account that has more than 14 million messages in its INBOX.
The heap size of JVM is 3GB and we are using a 64-bit JVM.

I think it happens when opening folder, since from the heap dump, I can find
that the size of the vector POP3Folder#message_cache is 14,612,804, while there
are only 13,583,387 instances of POP3Message. So OOM happens while it tried to
create the 13583388th instance of POP3Message.
And the size of an empty POP3Message is 216 bytes, so it costs us 216 *
13583387 = 2934011592 bytes = 2.73GB

I think a quick fix is enough for this case, e.g. if the total message in the
folder is more than a configurable value (e.g., 10, 000), then throw an
exception. Or if you can fix it like IMAPFolder in javamail 1.4.4, then it
would be better.

-- 
Configure bugmail: http://kenai.com/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.