Uploaded image for project: 'Log4cxx'
  1. Log4cxx
  2. LOGCXX-317

Log4cxx triggers locking inversion, which can result in a deadlock

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.10.0
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      Operating System: Windows 2003 R2
      Compiler: Visual Studio 2005 SP1
      log4cxx 0.10.0 was compiled as a DLL.
      Note: the reported issue is independent of the above data.

      Description

      Calling log4cxx::configureAndWatch() results in Logger::mutex being locked first, and Hierarchy::mutex being locked nested.

      Calling log4cxx::getLogger() results in Hierarchy::mutex being locked first, and Logger::mutex being locked nested.

      See also the attachment for the full call stacks.

      Such behavior is called locking inversion and can result in a sporadic deadlock.

      This issue has been found via Intel Thread Checker.
      Note: there are also other tools that can detect locking inversion, e.g. the Helgrind tool included with the Valgrind suite.

        Attachments

        1. call-stacks.txt
          3 kB
          Bart Van Assche
        2. helgrind-locking-order-violation-report.txt
          5 kB
          Bart Van Assche
        3. locking-order-violation-example.cpp
          2 kB
          Bart Van Assche
        4. locking-order-violation-fix.patch
          0.4 kB
          Bart Van Assche

          Issue Links

            Activity

              People

              • Assignee:
                carnold@apache.org Curt Arnold
                Reporter:
                bart.vanassche Bart Van Assche
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 24h
                  24h
                  Remaining:
                  Remaining Estimate - 24h
                  24h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified