Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-2895

Async logging should avoid submitting work from Log4jThread threads

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.13.3
    • 2.14.0
    • Core
    • None

    Description

      In order to avoid deadlocks, when we have the option we should try to avoid enqueueing events for async loggers from threads that extend Log4jThread. Submitting events between AsyncLoggerContexts is rare, but can allow multiple disruptors to deadlock feeding events from one to the other. Similarly using both mixed async loggers with AsyncLoggerContext results in events flowing from one disruptor to another.

      There are several areas we can avoid these potential lockups by checking if the current thread is a Log4jThread and logging synchronously. Note that in these cases, events may be serialized to disk in an unexpected order, however the scenario is both sufficiently rare and dangerous that I think it's worthwhile to change.

      Attachments

        Activity

          People

            ckozak Carter Kozak
            ckozak Carter Kozak
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 20m
                20m