james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Burrell Donkin (JIRA)" <server-...@james.apache.org>
Subject [jira] Commented: (MIME4J-5) Mime4j takes really long to parse big messages
Date Tue, 08 Jul 2008 22:04:31 GMT

    [ https://issues.apache.org/jira/browse/MIME4J-5?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12611823#action_12611823
] 

Robert Burrell Donkin commented on MIME4J-5:
--------------------------------------------

It's in MimeTokenEmbeddedMessageTest and is currently underscored out. (This mail original
comes from one of the IMAP functional tests)

I think I've worked out a possible theory. Too tired to test it right now. It's quite possible
that I don't grok the new structure so it's quite possibly rubbish but maybe it'll help.

1. A MimeBoundaryInputStream instance is created when the mime part containing the message
is started. The limit is accurately calculated from the InputBuffer. 2. The message is recursively
parsed by other MimeBoundaryInputStream instances using the same InputStream. During this,
the underlying buffer is refreshed at least once. Entity responsible for parsing the message
is pushed off the stack.
3. The original stream is now current again. It's at EOF so doesn't reculculate the limit.
But the buffer position has changed radically during the parsing of the message. So the offset
caculation is not longer correct. Too many bytes are thrown away and buffer is not positioned
at the start of the next mime part.
4. Buffer is now positioned some way into the next mime part. Parsing incorrect.


> Mime4j takes really long to parse big messages
> ----------------------------------------------
>
>                 Key: MIME4J-5
>                 URL: https://issues.apache.org/jira/browse/MIME4J-5
>             Project: Mime4j
>          Issue Type: Bug
>    Affects Versions: 0.3
>            Reporter: Norman Maurer
>            Assignee: Robert Burrell Donkin
>             Fix For: 0.4
>
>         Attachments: mime4j-2.patch, mime4j-3.patch, mime4j.patch
>
>
> From ml:
> Mime4j has general demonstrable performance problems:
> http://buni.org/bugzilla/show_bug.cgi?id=137
> http://blog.buni.org/blog/mbarker/Meldware/2007/01/27/Look-out-Its-behind-you
> I'd suggest a general code review for the "byte at a time + buffered input stream" anti-pattern
> and general refactoring to do things in blocks where possible.
> -Andy

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message