-
-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LogcatAppender causes thread deadlock #104
Comments
Great bug report 👍 I'll take a look |
tony19
added a commit
that referenced
this issue
Jan 9, 2016
Switched LogcatAppender to UnsynchronizedAppenderBase<> to fix a deadlock. This appender does not require synchronization.
Thank you for the quick fix. Any idea when it might be released? |
Released in 1.1.1-5 |
Closed
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Following code causes deadlock when using the default LogcatAppender in logback-android. The root cause is in the AppenderBase parent class, where the doAppend() method is synchronized.
Simple fix is be to change the LogcatAppender base class from AppenderBase to UnsynchronizedAppenderBase which doesn't h block at doAppend() method. This should be safe, because android logcat doesn't need any external synchronization.
Here are the relevant stack traces at deadlock:
"<11> T1" prio=5 waiting for monitor entry
java.lang.Thread.State: BLOCKED
at ch.qos.logback.core.AppenderBase.doAppend(Unknown Source:-1)
at ch.qos.logback.core.spi.AppenderAttachableImpl.appendLoopOnAppenders(Unknown Source:-1)
at ch.qos.logback.classic.Logger.appendLoopOnAppenders(Unknown Source:-1)
at ch.qos.logback.classic.Logger.callAppenders(Unknown Source:-1)
at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Unknown Source:-1)
at ch.qos.logback.classic.Logger.filterAndLog_1(Unknown Source:-1)
at ch.qos.logback.classic.Logger.debug(Unknown Source:-1)
at example.logbackdeadlock.MainActivity$A.doStuff(MainActivity.java:63)
at example.logbackdeadlock.MainActivity$2.run(MainActivity.java:78)
"<12> T2" prio=5 waiting for monitor entry
java.lang.Thread.State: BLOCKED
at example.logbackdeadlock.MainActivity$A.getName(MainActivity.java:51)
at example.logbackdeadlock.MainActivity$A.toString(MainActivity.java:59)
at org.slf4j.helpers.MessageFormatter.safeObjectAppend(MessageFormatter.java:297)
at org.slf4j.helpers.MessageFormatter.deeplyAppendParameter(MessageFormatter.java:269)
at org.slf4j.helpers.MessageFormatter.arrayFormat(MessageFormatter.java:227)
at ch.qos.logback.classic.spi.LoggingEvent.getFormattedMessage(Unknown Source:-1)
at ch.qos.logback.classic.pattern.MessageConverter.convert(Unknown Source:-1)
at ch.qos.logback.classic.pattern.MessageConverter.convert(Unknown Source:-1)
at ch.qos.logback.core.pattern.FormattingConverter.write(Unknown Source:-1)
at ch.qos.logback.core.pattern.PatternLayoutBase.writeLoopOnConverters(Unknown Source:-1)
at ch.qos.logback.classic.PatternLayout.doLayout(Unknown Source:-1)
at ch.qos.logback.classic.PatternLayout.doLayout(Unknown Source:-1)
at ch.qos.logback.classic.android.LogcatAppender.append(Unknown Source:-1)
at ch.qos.logback.classic.android.LogcatAppender.append(Unknown Source:-1)
at ch.qos.logback.core.AppenderBase.doAppend(Unknown Source:-1)
at ch.qos.logback.core.spi.AppenderAttachableImpl.appendLoopOnAppenders(Unknown Source:-1)
at ch.qos.logback.classic.Logger.appendLoopOnAppenders(Unknown Source:-1)
at ch.qos.logback.classic.Logger.callAppenders(Unknown Source:-1)
at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Unknown Source:-1)
at ch.qos.logback.classic.Logger.filterAndLog_2(Unknown Source:-1)
at ch.qos.logback.classic.Logger.debug(Unknown Source:-1)
at example.logbackdeadlock.MainActivity$3.run(MainActivity.java:90)
The text was updated successfully, but these errors were encountered: