Don't open log file until lock is held
commit4c17c516086c5f5708b25058cf0c3a928884bfc1
authorGabe Levi <gabe@fb.com>
Fri, 10 Nov 2017 22:27:00 +0000 (10 14:27 -0800)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Fri, 10 Nov 2017 22:32:44 +0000 (10 14:32 -0800)
treeb36eb66be99010c14018e94425c33d9f89ce566a
parentc002058df2488c8aeb934d4051cee04dcf43224e
Don't open log file until lock is held

Summary:
I was investigating a bug report, and noticed that a running
server was logging to `.log.old`. Since we mess with log files before we
hold the lock, it's totally possible for this to happen.

The new solution is to wait until we have the lock before setting up the
log files. The main downside is that a daemonized monitor has nowhere to
log between being spawned and the log file being set up. Not a huge
deal, though, since if something goes wrong, `flow start` will report
why the monitor died.

Reviewed By: avikchaudhuri

Differential Revision: D6284950

fbshipit-source-id: a218f91a12a7dcad70f363dd346df7f5853f6e51
hphp/hack/src/utils/sys/daemon.ml