Possible Bug/Ressource exhaustion in SMTP client with 8bit transfers

View: New views
3 Messages — Rating Filter:   Alert me  

Possible Bug/Ressource exhaustion in SMTP client with 8bit transfers

by Raimund Jacob :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all, Hello Bill!

I ran into a situation where an application (which otherwise behaves
nicely) provokes this:

java.lang.OutOfMemoryError: unable to create new native thread
        at java.lang.Thread.start0(Native Method)
        at java.lang.Thread.start(Unknown Source)
        at javax.activation.DataHandler.getInputStream(DataHandler.java:261)
        at
javax.mail.internet.MimeBodyPart.getInputStream(MimeBodyPart.java:554)
        at
com.sun.mail.smtp.SMTPTransport.convertTo8Bit(SMTPTransport.java:768)
        at
com.sun.mail.smtp.SMTPTransport.convertTo8Bit(SMTPTransport.java:776)
        at
com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:580)
[...]

JavaMail 1.4.1, JDK 1.5.0_06 on Debian GNU/Linux 2.6.18-6-686

Reading the glassfish sources made me shiver: DataHandler.getInputStream
creates a Thread for converting between the interfaces involved.
Correct, but ressource-intensive. I also found a french comment by a
"bill s." - is that you?

Anyway, the bug IMHO is SMTPTransport.convertTo8Bit which opens that
virulent InputStream but never closes it (!). I guess this leads to that
converter Thread never dying which in turn kills the VM.

My workaround will be to set mail.smtp.allow8bitmime to false again and
never look back on that mistake.

My questions are: Will this be fixed? Will there be a new JavaMail release?

Thanks in advance,
        Raimund

--

Pinuts media+science Multimedia-Agentur GmbH

Dipl.-Inform. Raimund Jacob
Head of Development

http://www.pinuts.de
mailto:raimund.jacob@...

Charlottenstraße 18
10117 Berlin | Germany
voice: +49 30 5900903 22
fax: +49 30 5900903 90


Sitz / registered office: Berlin | AG Berlin-Charlottenburg | HRB 61363
Geschäftsführer / Managing director: Tilman Issing

===========================================================================
To unsubscribe, send email to listserv@... and include in the body
of the message "signoff JAVAMAIL-INTEREST".  For general help, send email to
listserv@... and include in the body of the message "help".

Re: Possible Bug/Ressource exhaustion in SMTP client with 8bit transfers

by Bill Shannon :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Raimund Jacob wrote:

> Hi all, Hello Bill!
>
> I ran into a situation where an application (which otherwise behaves
> nicely) provokes this:
>
> java.lang.OutOfMemoryError: unable to create new native thread
>         at java.lang.Thread.start0(Native Method)
>         at java.lang.Thread.start(Unknown Source)
>         at javax.activation.DataHandler.getInputStream(DataHandler.java:261)
>         at
> javax.mail.internet.MimeBodyPart.getInputStream(MimeBodyPart.java:554)
>         at
> com.sun.mail.smtp.SMTPTransport.convertTo8Bit(SMTPTransport.java:768)
>         at
> com.sun.mail.smtp.SMTPTransport.convertTo8Bit(SMTPTransport.java:776)
>         at
> com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:580)
> [...]
>
> JavaMail 1.4.1, JDK 1.5.0_06 on Debian GNU/Linux 2.6.18-6-686
>
> Reading the glassfish sources made me shiver: DataHandler.getInputStream
> creates a Thread for converting between the interfaces involved.
> Correct, but ressource-intensive. I also found a french comment by a
> "bill s." - is that you?

Yes.  I wrote the piece of code, someone else inserted it and added the
comment.

> Anyway, the bug IMHO is SMTPTransport.convertTo8Bit which opens that
> virulent InputStream but never closes it (!). I guess this leads to that
> converter Thread never dying which in turn kills the VM.

Yes, that looks like a bug.

> My workaround will be to set mail.smtp.allow8bitmime to false again and
> never look back on that mistake.
>
> My questions are: Will this be fixed? Will there be a new JavaMail release?

Yes, it will be fixed.  Let me know if you want to test the fixed version.
We don't have release plans for the next version yet.

===========================================================================
To unsubscribe, send email to listserv@... and include in the body
of the message "signoff JAVAMAIL-INTEREST".  For general help, send email to
listserv@... and include in the body of the message "help".

Re: Possible Bug/Ressource exhaustion in SMTP client with 8bit transfers

by Raimund Jacob :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Bill Shannon wrote:

Hi!

>> Anyway, the bug IMHO is SMTPTransport.convertTo8Bit which opens that
>> virulent InputStream but never closes it (!). I guess this leads to that
>> converter Thread never dying which in turn kills the VM.
>
> Yes, that looks like a bug.
>
>> My workaround will be to set mail.smtp.allow8bitmime to false again and
>> never look back on that mistake.
>>
>> My questions are: Will this be fixed? Will there be a new JavaMail
>> release?
>
> Yes, it will be fixed.  Let me know if you want to test the fixed version.
> We don't have release plans for the next version yet.

Well, since I cannot easily reproduce that in the lab, I'd rather pass.
I just disable the 8bit extension - it uses more resources than it saves
anyway.

If a lack of testing stops you from releasing i'll try to free some time
to do a proper test. Just send me the .jar then.

        Raimund

--
Pinuts media+science GmbH                 http://www.pinuts.de
Dipl. Inform. Raimund Jacob               Raimund.Jacob@...
Charlottenstr. 18                         voice : +49 30 59 00 90 322
10117 Berlin                              fax   : +49 30 59 00 90 390
Germany

===========================================================================
To unsubscribe, send email to listserv@... and include in the body
of the message "signoff JAVAMAIL-INTEREST".  For general help, send email to
listserv@... and include in the body of the message "help".
LightInTheBox - Buy quality products at wholesale price