Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-4739

Race condition in log rotation (was: SIGUSR1 should set a flag rather than doing rotation)

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 2.2.5, 2.4.4, 2.5.0
    • 2.2.0, 2.2.2
    • Logging, Stability
    • None

    Description

      The locking within logRotate only covers the swap of file handles, but renaming an open log file while it is being written to by another thread is not safe. The locking needs to be modified so that no race conditions exist.

      In addition, doing log rotation from a signal handler may be unsafe. It would be better to set a flag in the signal handler, and respond to it from a normal (non-signal) code path. For example, we could rotate the log next time something is logged.

      Currently there is a deadlock if the current thread is in the middle of logging.

      Attachments

        Activity

          People

            Votes:
            24 Vote for this issue
            Watchers:
            29 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: