Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-357

Deadlock with DBAppender

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Critical Critical
    • None
    • 0.9.17
    • None
    • None
    • MacBook Pro 17"
      Intel Core 2 Duo
      2.33 GHz
      OS X 10.5.7 (9J61)

      java version "1.6.0_13"
      slf4j 1.5.8
      c3p0 0.9.1.2

    Description

      A deadlock occurs when running the attached application. For this lock to occur, we need to:

      • load a configuration other than the default in java app.
      • not have any default logback.xml in the classpath.
      • have these jars in the classpath
        c3p0-0.9.1.2.jar
        logback-core-0.9.17.jar
        logback-classic-0.9.17.jar
        log4j-over-slf4j-1.5.8.jar
        slf4j-api-1.5.8.jar
        mysql.jar
      • Place attached the logback2.xml file in the same package as the attached MainTest class.
      • adapt the logback2.xml file to your DB schema. (note that you do not need to have the DB tables created for the lock to occur, but the test is more conclusive if you have a valid DB connection and schema.)
      • Execute this
        java -cp ".:../c3p0-0.9.1.2.jar:../logback-core-0.9.17.jar:../logback-classic-0.9.17.jar:../log4j-over-slf4j-1.5.8.jar:../slf4j-api-1.5.8.jar:../mysql.jar" MainTest

      The application should output the logger status and hang.

      Workaround:

      • Do not include log4j-over-slf4j in the classpath,
      • or add a default logback.xml that will be loaded first (just copy and rename logback2.xml in same default package)
      • or use the attached logback2-works.xml instead of logback2.xml (modify MainTest to load that file instead.)

      In this last one, the change is that the DB appender is only used in a logger element instead of the root.

      I did not spend the time to look at the cause of this locking problem as the workarounds allow me to move on. So I hope this really belong in jira, and not a config/usage error on my part.


      Mel T.

      Attachments

        1. logback2.xml
          0.5 kB
        2. logback2-works.xml
          0.8 kB
        3. MainTest.java
          0.7 kB

        Activity

          People

            ceki Ceki Gülcü
            mtruc Mel T.
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: