issues@javamail.java.net

[Bug 3442] New: SMTP socket connections are not closed on timeout waiting for server header

From: <bugzilla-daemon_at_kenai.com>
Date: Sat, 23 Oct 2010 00:17:53 +0000 (GMT)

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

           Summary: SMTP socket connections are not closed on timeout
                    waiting for server header
           Product: javamail
           Version: 1.4.4
          Platform: PC
        OS/Version: Mac OS
            Status: NEW
          Severity: enhancement
          Priority: P5
         Component: source
        AssignedTo: shannon_at_kenai.com
        ReportedBy: hughormond_at_kenai.com
                CC: issues_at_javamail.kenai.com


Create a server using a dumb socket listener like netcat to just listen on a
port.

Have JavaMail client connect to that port to send mail.

JavaMail client times out waiting on the server to send "220 ...", but leaves
the Socket connected until the Transport object is finalized.

Transport.close() is ineffective because the service is not marked as
connected.

Stack trace is from JavaMail 1.4.2, but SMTPTransport code has not changed
since then to fix this.


javax.mail.MessagingException: Exception reading response;
  nested exception is:
java.net.SocketTimeoutException: Read timed out
at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1925)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1684)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:525)
at javax.mail.Service.connect(Service.java:291)
...
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:106)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:84)
at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1903)
... 17 more

-- 
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.