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