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

Prudent FileAppender is stopped if a thread is ever interrupted prior to a logging call

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 1.0.13
    • Fix Version/s: 1.1.3
    • Component/s: logback-core
    • Labels:
      None
    • Environment:

      N/A

      Description

      If a thread is ever interrupted immediately followed by a logging call using a prudent FileAppender then the FileAppender is stopped and no logging can be done by any other thread.

      FileLockInterruptedException is thrown by FileChannel.lock used in FileAppender.safeWrite. This exception should not stop the entire appender, for my use cases it would be enough to just catch the exception and reset the interrupted flag.

      I've attached a very simple unit test that demonstrates this issue.

        Activity

        Hide
        diroussel David Roussel added a comment -

        Joe, can you provide a pull request, in github, with a fix?

        Show
        diroussel David Roussel added a comment - Joe, can you provide a pull request, in github, with a fix?
        Hide
        stuarthalloway Stuart Halloway added a comment -

        This is critical, and renders logback FileAppender not safe for use in multithreaded programs.

        Show
        stuarthalloway Stuart Halloway added a comment - This is critical, and renders logback FileAppender not safe for use in multithreaded programs.
        Show
        jjensen Joe Jensen added a comment - See https://github.com/qos-ch/logback/pull/134
        Hide
        nemecec Neeme Praks added a comment -
        Show
        nemecec Neeme Praks added a comment - Improved pull request: https://github.com/qos-ch/logback/pull/218
        Show
        tony19 Tony Trinh added a comment - Fixed in https://github.com/qos-ch/logback/commit/8936c0ba2cb372a75814f1b05474d8790eb9d042

          People

          • Assignee:
            tony19 Tony Trinh
            Reporter:
            jjensen Joe Jensen
          • Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: