logging: update AsyncFileWriter to interoperate with fork()
Summary: Update AsyncFileWriter to use pthread_atfork() to stop the I/O thread around a fork() operation. Both the parent and child restart the I/O thread after the fork. Messages that were queued up at the time of the fork are logged in the parent process after the fork occurs. Previously after a fork() the child process would not have an I/O thread running at all, so any messages sent to this handler would not actually be written. This also triggered some ASAN warnings which I did not fully track down. In the child process ASAN claimed that the exit handlers were run twice: from both the main thread and the I/O thread, which is surprising since the I/O thread should not run in the child process at all. Reviewed By: mnv104 Differential Revision: D7946725 fbshipit-source-id: e4ad398f7bb334882c5c0b2afacc30c27bf3f6e4
Showing
Please register or sign in to comment