<div id="_htmlarea_default_style_" style="font:10pt arial,helvetica,sans-serif">Hi Ceki, thanks for the
reply.<br><br>Yes, I upgraded to 0.9.24 while investigating this problem.&nbsp; I must have captured the stack before
that.<br><br>I wondered about a race condition too.&nbsp; To try mitigate that at SubethaSMTP start/shutdown, I added
Thread.sleep(10000) calls after start and before shutdown.&nbsp; There was no change; is 10 seconds long enough to wait
to see if a shutdown server  is the problem?<br><br><br>Any suggestion for setting the timeout value via
Logback?<br><br><br>On Fri, 23 Jul 2010 17:22:27 +0200<br> Ceki Gülcü &lt;ceki@qos.ch&gt; wrote:<br>&gt; The line
numbers in the stack trace you sent indicate an <br>&gt;earlier version of logback, probably version 0.9.20 or
<br>&gt;0.9.21.<br>&gt; <br>&gt; In the past we also ran into problems while testing <br>&gt;SMTPAppender with
SubethaSMTP. If my memory serves me <br>&gt;correctly, it was due to a race condition. Maybe the <br>&gt;server is
shutdown before SMTPAppender has a chance to <br>&gt;receive the response of the server.<br>&gt; <br>&gt; On 23/07/2010
4:54 PM, Jeff Jensen wrote:<br>&gt;&gt; Using Logback 0.9.24 and SLF4J 1.6.1.<br>&gt;&gt;<br>&gt;&gt; I'm trying to
resolve a hang problem with the<br>&gt;&gt; ch.qos.logback.classic.net.SMTPAppender in an <br>&gt;&gt;integration test
and using<br>&gt;&gt; SubethaSMTP as the email server.  We have many tests <br>&gt;&gt;working with<br>&gt;&gt;
SubethaSMTP that send emails, but not with Logback, so I <br>&gt;&gt;know it works<br>&gt;&gt; for the non-Logback
configuration.  I've also seen <br>&gt;&gt;SMTPAppender work in<br>&gt;&gt; a different situation to the production
email server. <br>&gt;&gt; So I think I have<br>&gt;&gt; a config error somewhere with Logback setup to
<br>&gt;&gt;SubethaSMTP, but not sure<br>&gt;&gt; what, or there is an issue in the LB &amp; SS
interaction.<br>&gt;&gt;<br>&gt;&gt; This is the SMTPAppender config:<br>&gt;&gt;<br>&gt;&gt; &lt;appender name="EMAIL"
<br>&gt;&gt;class="ch.qos.logback.classic.net.SMTPAppender"&gt;<br>&gt;&gt; &lt;layout class="ch.qos.logback.classic.html.HTMLLayout"&gt;<br>&gt;&gt;
&lt;pattern&gt;%date%contextName%thread%-5level%-55logger{55}%mdc%marker%msg&lt;/pattern&gt;<br>&gt;&gt;<br>&gt;&gt;
&lt;throwableRenderer<br>&gt;&gt; class="ch.qos.logback.classic.html.DefaultThrowableRenderer"
<br>&gt;&gt;/&gt;<br>&gt;&gt; &lt;/layout&gt;<br>&gt;&gt; &lt;SMTPHost&gt;${mail.host.name}&lt;/SMTPHost&gt;<br>&gt;&gt;
&lt;SMTPPort&gt;${mail.port.number}&lt;/SMTPPort&gt;<br>&gt;&gt; &lt;From&gt;${batch.email.address.from}&lt;/From&gt;<br>&gt;&gt;
&lt;To&gt;${batch.email.address.to.cmrdevelopers}&lt;/To&gt;<br>&gt;&gt; &lt;Subject&gt;${batch.email.subject.prefix}Log
Email: <br>&gt;&gt;%msg&lt;/Subject&gt;<br>&gt;&gt; &lt;evaluator <br>&gt;&gt;class="ch.qos.logback.classic.boolex.OnMarkerEvaluator"&gt;<br>&gt;&gt;
&lt;marker&gt;EMAIL_DEVS&lt;/marker&gt;<br>&gt;&gt; &lt;/evaluator&gt;<br>&gt;&gt; &lt;/appender&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;
It hangs on call to SocketInputStream.socketRead0(), <br>&gt;&gt;which is a native<br>&gt;&gt; method.  Anyone
seen/solved this before?<br>&gt;&gt;<br>&gt;&gt; The timeout value is 0 on the socket read (means wait
<br>&gt;&gt;forever), so it is<br>&gt;&gt; waiting for a response to read.<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;
While I'm trying to resolve this, one thing I'd like to <br>&gt;&gt;do is set the<br>&gt;&gt; timeout value so at least
it doesn't hang.  I'm not sure <br>&gt;&gt;how to do that<br>&gt;&gt; with SMTPAppender -<br>&gt;&gt; anyone know how? 
The SMTPAppender/SMTPAppenderBase <br>&gt;&gt;class does not<br>&gt;&gt; have a timeout property, but SMTPAppenderBase
does pull <br>&gt;&gt;system<br>&gt;&gt; properties.  I'm hoping there is a config file-based <br>&gt;&gt;approach to do
this<br>&gt;&gt; though...<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; The following is a call stack
captured in the Eclipse <br>&gt;&gt;debugger; the next<br>&gt;&gt; line-step would go into socketRead0() and
hang.<br>&gt;&gt;<br>&gt;&gt;      org.eclipse.jdt.internal.junit.runner.RemoteTestRunner <br>&gt;&gt;at<br>&gt;&gt;
localhost:3598<br>&gt;&gt;          Thread [main] (Suspended)<br>&gt;&gt;              SocketInputStream.read(byte[],
int, int) <br>&gt;&gt;line: 129<br>&gt;&gt;              TraceInputStream.read(byte[], int, int) <br>&gt;&gt;line:
97<br>&gt;&gt;              BufferedInputStream.fill() line: 218<br>&gt;&gt;              BufferedInputStream.read()
line: 237<br>&gt;&gt;              LineInputStream.readLine() line: 75<br>&gt;&gt;             
SMTPTransport.readServerResponse() line: <br>&gt;&gt;1440<br>&gt;&gt;              SMTPTransport.openServer(String, int)
line: <br>&gt;&gt;1260<br>&gt;&gt;              SMTPTransport.protocolConnect(String, int, <br>&gt;&gt;String,
String)<br>&gt;&gt; line: 370<br>&gt;&gt;              SMTPTransport(Service).connect(String, int, <br>&gt;&gt;String,
String)<br>&gt;&gt; line: 275<br>&gt;&gt;              SMTPTransport(Service).connect(String, <br>&gt;&gt;String,
String)<br>&gt;&gt; line: 156<br>&gt;&gt;              SMTPTransport(Service).connect() line: 105<br>&gt;&gt;           
  Transport.send0(Message, Address[]) line: <br>&gt;&gt;168<br>&gt;&gt;              Transport.send(Message) line:
98<br>&gt;&gt;              SMTPAppender(SMTPAppenderBase&lt;E&gt;).sendBuffer(E) <br>&gt;&gt;line: 292<br>&gt;&gt;     
        SMTPAppender(SMTPAppenderBase&lt;E&gt;).append(E) <br>&gt;&gt;line: 159<br>&gt;&gt;             
SMTPAppender(AppenderBase&lt;E&gt;).doAppend(E) <br>&gt;&gt;line: 85<br>&gt;&gt;             
AppenderAttachableImpl&lt;E&gt;.appendLoopOnAppenders(E) <br>&gt;&gt;line: 64<br>&gt;&gt;             
Logger.appendLoopOnAppenders(ILoggingEvent) <br>&gt;&gt;line: 283<br>&gt;&gt;             
Logger.callAppenders(ILoggingEvent) line: <br>&gt;&gt;270<br>&gt;&gt;              Logger.buildLoggingEventAndAppend(String,
<br>&gt;&gt;Marker, Level,<br>&gt;&gt; String, Object[], Throwable) line: 471<br>&gt;&gt;             
Logger.filterAndLog_0_Or3Plus(String, <br>&gt;&gt;Marker, Level,<br>&gt;&gt; String, Object[], Throwable) line:
425<br>&gt;&gt;              Logger.error(Marker, String) line: 592<br>&gt;&gt;             
LoggerEmailTest.testEmailSend() line: 99<br>&gt;&gt;              NativeMethodAccessorImpl.invoke0(Method,
<br>&gt;&gt;Object, Object[])<br>&gt;&gt; line: not available [native method]<br>&gt;&gt;             
NativeMethodAccessorImpl.invoke(Object, <br>&gt;&gt;Object[]) line: 39<br>&gt;&gt;             
DelegatingMethodAccessorImpl.invoke(Object, <br>&gt;&gt;Object[]) line: 25<br>&gt;&gt;             
Method.invoke(Object, Object...) line: 597<br>&gt;&gt;              FrameworkMethod$1.runReflectiveCall() line:
<br>&gt;&gt;44<br>&gt;&gt;              FrameworkMethod$1(ReflectiveCallable).run() <br>&gt;&gt;line: 15<br>&gt;&gt;    
         FrameworkMethod.invokeExplosively(Object, <br>&gt;&gt;Object...) line: 41<br>&gt;&gt;             
InvokeMethod.evaluate() line: 20<br>&gt;&gt;              RunBefores.evaluate() line: 28<br>&gt;&gt;             
RunBeforeTestMethodCallbacks.evaluate() <br>&gt;&gt;line: 74<br>&gt;&gt;              RunAfters.evaluate() line:
31<br>&gt;&gt;              RunAfterTestMethodCallbacks.evaluate() <br>&gt;&gt;line: 82<br>&gt;&gt;             
SpringRepeat.evaluate() line: 72<br>&gt;&gt;              SpringJUnit4ClassRunner.runChild(FrameworkMethod,<br>&gt;&gt;
RunNotifier) line: 240<br>&gt;&gt;<br>&gt;&gt; SpringJUnit4ClassRunner(BlockJUnit4ClassRunner).runChild(Object,<br>&gt;&gt;
RunNotifier) line: 50<br>&gt;&gt;              ParentRunner$3.run() line: 193<br>&gt;&gt;             
ParentRunner$1.schedule(Runnable) line: 52<br>&gt;&gt;<br>&gt;&gt; SpringJUnit4ClassRunner(ParentRunner&lt;T&gt;).runChildren(RunNotifier)
<br>&gt;&gt;line: 191<br>&gt;&gt;              ParentRunner&lt;T&gt;.access$000(ParentRunner, <br>&gt;&gt;RunNotifier)
line: 42<br>&gt;&gt;              ParentRunner$2.evaluate() line: 184<br>&gt;&gt;             
RunBeforeTestClassCallbacks.evaluate() <br>&gt;&gt;line: 61<br>&gt;&gt;              RunAfterTestClassCallbacks.evaluate()
line: <br>&gt;&gt;70<br>&gt;&gt;              SpringJUnit4ClassRunner(ParentRunner&lt;T&gt;).run(RunNotifier)<br>&gt;&gt;
line: 236<br>&gt;&gt;              SpringJUnit4ClassRunner.run(RunNotifier) <br>&gt;&gt;line:
180<br>&gt;&gt;<br>&gt;&gt; JUnit4TestClassReference(JUnit4TestReference).run(TestExecution) <br>&gt;&gt;line:
46<br>&gt;&gt;              TestExecution.run(ITestReference[]) line: <br>&gt;&gt;38<br>&gt;&gt;             
RemoteTestRunner.runTests(String[], String, <br>&gt;&gt;TestExecution)<br>&gt;&gt; line: 467<br>&gt;&gt;             
RemoteTestRunner.runTests(TestExecution) <br>&gt;&gt;line: 683<br>&gt;&gt;              RemoteTestRunner.run() line:
390<br>&gt;&gt;              RemoteTestRunner.main(String[]) line: 197<br>&gt;&gt;          Thread [ReaderThread]
(Running)<br>&gt;&gt;          Thread [org.subethamail.smtp.server.SMTPServer] <br>&gt;&gt;(Running)<br>&gt;&gt;        
 Thread <br>&gt;&gt;[org.subethamail.smtp.server.Session-/127.0.0.1:3601]<br>&gt;&gt; (Running)<br>&gt;&gt;<br>&gt;
<br>&gt; _______________________________________________<br>&gt; Logback-user mailing list<br>&gt;
Logback-user@qos.ch<br>&gt; http://qos.ch/mailman/listinfo/logback-user<br>&gt; <br><br></div>