Skip to content
  • Nick Mathewson's avatar
    Fix a rare infinite-recursion bug when shutting down. · 9d118277
    Nick Mathewson authored
    Once we had called log_free_all(), anything that tried to log a
    message (like a failed tor_assert()) would fail like this:
    
       1. The logging call eventually invokes the _log() function.
       2. _log() calls tor_mutex_lock(log_mutex).
       3. tor_mutex_lock(m) calls tor_assert(m).
       4. Since we freed the log_mutex, tor_assert() fails, and tries to
          log its failure.
       5. GOTO 1.
    
    Now we allocate the mutex statically, and never destroy it on
    shutdown.
    
    Bugfix on 0.2.0.16-alpha, which introduced the log mutex.
    
    This bug was found by Matt Edman.
    9d118277