closing stdio fds on exit can interfere with LeakSanitizer, etc
At tor exit time,
tor_log_close_sigsafe_err_fds() winds up closing stderr or stdout if they're being log destinations. This can close stderr before tools like LeakSanitizer can output useful information, e.g., if there's a config setting like
Log notice stderr. (valgrind doesn't seem to have this problem, maybe because it runs a separate process?)
Is it correct for us to close a default fd like stderr or stdout if we're not running as a daemon? Other tools that do runtime interception might also be affected. If we think we have a good reason to explicitly close these fds, we probably should document how tor's closing of these fds can interfere with debugging tools.
nickm thinks this behavior might be new in 0.4.2 with the signal safety work. I haven't had time to investigate further.