You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by David Parks <da...@yahoo.com> on 2010/08/21 05:23:47 UTC

[Email] Email send hangs thread indefinitely on intermittent failure

I set up a simple test to send 50 emails through google app's SMTP server
with a short delay between them (just testing to see what I'm allowed to
do).

I set this up by opening 50 threads and pausing at different intervals for
each thread.

I notice that I sometimes end up with a thread that hangs indefinitely on a
connection that seems to be hung, but never times out (see the thread dump
below for one such case, it's been left hung for > 10 min now):

Any thoughts on this? Kind of scares me to think what might happen to a
server posting emails in the background. I would expect network timeouts to
all be handled at least with a default value by a simplifying wrapper class
such as this is. Or am I missing some logic here maybe?

Thanks,
David


Thread [Thread-23] (Suspended)	
	SocketInputStream.socketRead0(FileDescriptor, byte[], int, int, int)
line: not available [native method]	
	SocketInputStream.read(byte[], int, int) line: not available	
	InputRecord.readFully(InputStream, byte[], int, int) line: not
available	
	InputRecord.read(InputStream, OutputStream) line: not available	
	SSLSocketImpl.readRecord(InputRecord, boolean) line: not available

	SSLSocketImpl.readDataRecord(InputRecord) line: not available	
	AppInputStream.read(byte[], int, int) line: not available	
	TraceInputStream.read(byte[], int, int) line: 106	
	BufferedInputStream.fill() line: not available	
	BufferedInputStream.read() line: not available	
	LineInputStream.readLine() line: 84	
	SMTPTransport.readServerResponse() line: 1903	
	SMTPTransport.issueSendCommand(String, int) line: 1808	
	SMTPTransport.finishData() line: 1634	
	SMTPTransport.sendMessage(Message, Address[]) line: 889	
	Transport.send0(Message, Address[]) line: 191	
	Transport.send(Message) line: 120	
	HtmlEmail(Email).sendMimeMessage() line: 1232	
	HtmlEmail(Email).send() line: 1267	
	GoogleAppsEmailTest.sendEmail(int) line: 51	
	GoogleAppsEmailTest$1.run() line: 17	
	Thread.run() line: not available	



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


RE: [Email] Email send hangs thread indefinitely on intermittent failure

Posted by David Parks <da...@yahoo.com>.
Thanks for the reply Siegfried.

I did not have any timeout settings for my test. But it looks like these
settings are available only in 1.3 dev, not the release build (I'm using
1.2).

I didn't quite follow how to make use of the first two options
(MAIL_SMTP_CONNECTIONTIMEOUT/TIMEOUT).

But in any case do you (or does anyone) know how stable 1.3 is? Is this
problem solvable in 1.2? Perhaps there are defaults on these values in 1.3?

Thanks,
David


-----Original Message-----
From: Siegfried Goeschl [mailto:siegfried.goeschl@it20one.at] 
Sent: Saturday, August 21, 2010 12:05 AM
To: Commons Users List
Subject: Re: [Email] Email send hangs thread indefinitely on intermittent
failure

Hi David,

don't know if you have set any timeouts for your tests such as

+) Email.MAIL_SMTP_CONNECTIONTIMEOUT
+) Email.MAIL_SMTP_TIMEOUT
+) Email.setSocketConnectionTimeout()
+) Email.setSocketTimeout()

The first two go into the email session for (javax.mail) while the two
others are set directly on Email - see
http://java.sun.com/products/javamail/javadocs/com/sun/mail/smtp/package-sum
mary.html

Cheers,

Siegfried Goeschl

PS: Agreed on the fact the you should not hang indefinitely with a default
configuration



On 21.08.10 05:23, David Parks wrote:
> I set up a simple test to send 50 emails through google app's SMTP server
> with a short delay between them (just testing to see what I'm allowed to
> do).
>
> I set this up by opening 50 threads and pausing at different intervals for
> each thread.
>
> I notice that I sometimes end up with a thread that hangs indefinitely on
a
> connection that seems to be hung, but never times out (see the thread dump
> below for one such case, it's been left hung for>  10 min now):
>
> Any thoughts on this? Kind of scares me to think what might happen to a
> server posting emails in the background. I would expect network timeouts
to
> all be handled at least with a default value by a simplifying wrapper
class
> such as this is. Or am I missing some logic here maybe?
>
> Thanks,
> David
>
>
> Thread [Thread-23] (Suspended)	
> 	SocketInputStream.socketRead0(FileDescriptor, byte[], int, int, int)
> line: not available [native method]	
> 	SocketInputStream.read(byte[], int, int) line: not available	
> 	InputRecord.readFully(InputStream, byte[], int, int) line: not
> available	
> 	InputRecord.read(InputStream, OutputStream) line: not available	
> 	SSLSocketImpl.readRecord(InputRecord, boolean) line: not available
>
> 	SSLSocketImpl.readDataRecord(InputRecord) line: not available	
> 	AppInputStream.read(byte[], int, int) line: not available	
> 	TraceInputStream.read(byte[], int, int) line: 106	
> 	BufferedInputStream.fill() line: not available	
> 	BufferedInputStream.read() line: not available	
> 	LineInputStream.readLine() line: 84	
> 	SMTPTransport.readServerResponse() line: 1903	
> 	SMTPTransport.issueSendCommand(String, int) line: 1808	
> 	SMTPTransport.finishData() line: 1634	
> 	SMTPTransport.sendMessage(Message, Address[]) line: 889	
> 	Transport.send0(Message, Address[]) line: 191	
> 	Transport.send(Message) line: 120	
> 	HtmlEmail(Email).sendMimeMessage() line: 1232	
> 	HtmlEmail(Email).send() line: 1267	
> 	GoogleAppsEmailTest.sendEmail(int) line: 51	
> 	GoogleAppsEmailTest$1.run() line: 17	
> 	Thread.run() line: not available	
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


RE: [Email] Email send hangs thread indefinitely on intermittent failure

Posted by David Parks <da...@yahoo.com>.
Oh what a bugger, I see these two options are available in 1.2, but the
javadocs on the website are out of date (they don't show these two options).
And yep, that's what I needed to fix the problem. I'll put in a patch
suggestion to set these to default values out of the box. We definitely
shouldn't have to think at this level with a wrapper API expected to be used
in server apps.

Thanks much!
David


-----Original Message-----
From: Siegfried Goeschl [mailto:siegfried.goeschl@it20one.at] 
Sent: Saturday, August 21, 2010 12:05 AM
To: Commons Users List
Subject: Re: [Email] Email send hangs thread indefinitely on intermittent
failure

Hi David,

don't know if you have set any timeouts for your tests such as

+) Email.MAIL_SMTP_CONNECTIONTIMEOUT
+) Email.MAIL_SMTP_TIMEOUT
+) Email.setSocketConnectionTimeout()
+) Email.setSocketTimeout()

The first two go into the email session for (javax.mail) while the two
others are set directly on Email - see
http://java.sun.com/products/javamail/javadocs/com/sun/mail/smtp/package-sum
mary.html

Cheers,

Siegfried Goeschl

PS: Agreed on the fact the you should not hang indefinitely with a default
configuration



On 21.08.10 05:23, David Parks wrote:
> I set up a simple test to send 50 emails through google app's SMTP server
> with a short delay between them (just testing to see what I'm allowed to
> do).
>
> I set this up by opening 50 threads and pausing at different intervals for
> each thread.
>
> I notice that I sometimes end up with a thread that hangs indefinitely on
a
> connection that seems to be hung, but never times out (see the thread dump
> below for one such case, it's been left hung for>  10 min now):
>
> Any thoughts on this? Kind of scares me to think what might happen to a
> server posting emails in the background. I would expect network timeouts
to
> all be handled at least with a default value by a simplifying wrapper
class
> such as this is. Or am I missing some logic here maybe?
>
> Thanks,
> David
>
>
> Thread [Thread-23] (Suspended)	
> 	SocketInputStream.socketRead0(FileDescriptor, byte[], int, int, int)
> line: not available [native method]	
> 	SocketInputStream.read(byte[], int, int) line: not available	
> 	InputRecord.readFully(InputStream, byte[], int, int) line: not
> available	
> 	InputRecord.read(InputStream, OutputStream) line: not available	
> 	SSLSocketImpl.readRecord(InputRecord, boolean) line: not available
>
> 	SSLSocketImpl.readDataRecord(InputRecord) line: not available	
> 	AppInputStream.read(byte[], int, int) line: not available	
> 	TraceInputStream.read(byte[], int, int) line: 106	
> 	BufferedInputStream.fill() line: not available	
> 	BufferedInputStream.read() line: not available	
> 	LineInputStream.readLine() line: 84	
> 	SMTPTransport.readServerResponse() line: 1903	
> 	SMTPTransport.issueSendCommand(String, int) line: 1808	
> 	SMTPTransport.finishData() line: 1634	
> 	SMTPTransport.sendMessage(Message, Address[]) line: 889	
> 	Transport.send0(Message, Address[]) line: 191	
> 	Transport.send(Message) line: 120	
> 	HtmlEmail(Email).sendMimeMessage() line: 1232	
> 	HtmlEmail(Email).send() line: 1267	
> 	GoogleAppsEmailTest.sendEmail(int) line: 51	
> 	GoogleAppsEmailTest$1.run() line: 17	
> 	Thread.run() line: not available	
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: [Email] Email send hangs thread indefinitely on intermittent failure

Posted by Siegfried Goeschl <si...@it20one.at>.
Hi David,

don't know if you have set any timeouts for your tests such as

+) Email.MAIL_SMTP_CONNECTIONTIMEOUT
+) Email.MAIL_SMTP_TIMEOUT
+) Email.setSocketConnectionTimeout()
+) Email.setSocketTimeout()

The first two go into the email session for (javax.mail) while the two 
others are set directly on Email - see 
http://java.sun.com/products/javamail/javadocs/com/sun/mail/smtp/package-summary.html

Cheers,

Siegfried Goeschl

PS: Agreed on the fact the you should not hang indefinitely with a 
default configuration



On 21.08.10 05:23, David Parks wrote:
> I set up a simple test to send 50 emails through google app's SMTP server
> with a short delay between them (just testing to see what I'm allowed to
> do).
>
> I set this up by opening 50 threads and pausing at different intervals for
> each thread.
>
> I notice that I sometimes end up with a thread that hangs indefinitely on a
> connection that seems to be hung, but never times out (see the thread dump
> below for one such case, it's been left hung for>  10 min now):
>
> Any thoughts on this? Kind of scares me to think what might happen to a
> server posting emails in the background. I would expect network timeouts to
> all be handled at least with a default value by a simplifying wrapper class
> such as this is. Or am I missing some logic here maybe?
>
> Thanks,
> David
>
>
> Thread [Thread-23] (Suspended)	
> 	SocketInputStream.socketRead0(FileDescriptor, byte[], int, int, int)
> line: not available [native method]	
> 	SocketInputStream.read(byte[], int, int) line: not available	
> 	InputRecord.readFully(InputStream, byte[], int, int) line: not
> available	
> 	InputRecord.read(InputStream, OutputStream) line: not available	
> 	SSLSocketImpl.readRecord(InputRecord, boolean) line: not available
>
> 	SSLSocketImpl.readDataRecord(InputRecord) line: not available	
> 	AppInputStream.read(byte[], int, int) line: not available	
> 	TraceInputStream.read(byte[], int, int) line: 106	
> 	BufferedInputStream.fill() line: not available	
> 	BufferedInputStream.read() line: not available	
> 	LineInputStream.readLine() line: 84	
> 	SMTPTransport.readServerResponse() line: 1903	
> 	SMTPTransport.issueSendCommand(String, int) line: 1808	
> 	SMTPTransport.finishData() line: 1634	
> 	SMTPTransport.sendMessage(Message, Address[]) line: 889	
> 	Transport.send0(Message, Address[]) line: 191	
> 	Transport.send(Message) line: 120	
> 	HtmlEmail(Email).sendMimeMessage() line: 1232	
> 	HtmlEmail(Email).send() line: 1267	
> 	GoogleAppsEmailTest.sendEmail(int) line: 51	
> 	GoogleAppsEmailTest$1.run() line: 17	
> 	Thread.run() line: not available	
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org