Don't rely on kill return value for fallback path
commit418fff2115496b92dc7897157cf6787363dfb098
authorHenri Verroken <hverr@fb.com>
Wed, 18 Aug 2021 09:51:59 +0000 (18 02:51 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Wed, 18 Aug 2021 09:53:15 +0000 (18 02:53 -0700)
tree833fdcfd49eb3eaed522c6b73dd547a065081cb1
parent8a96dfdc03f3537b20da8afa6bdba691009099cc
Don't rely on kill return value for fallback path

Summary:
The `if kill(pid, SIGUSR2) != 0 then kill(pid, SIGKILL)` doesn't make sense. From the `man 2 kill` page:

```
ERRORS
       EINVAL An invalid signal was specified.

       EPERM  The process does not have permission to send the signal to any of the target processes.

       ESRCH  The process or process group does not exist.  Note that an existing process might be a zombie, a process that has terminated execution, but has not yet been wait(2)ed for.
```

Kill only **sends** the signal and makes sure it **arrives**. It makes no guarantee about whether the receiving process **properly interpreted the received signal!**

This explains why my `monitor_kill_again_fix` isn't as effective.

 ---

Fix: just start sending SIGKILLs after some time.

Reviewed By: ljw1004

Differential Revision: D30372367

fbshipit-source-id: cf0f133088628620821b71f49ca796210cf1c1e1
hphp/hack/src/monitor/serverMonitor.ml
hphp/hack/src/monitor/serverMonitorUtils.ml
hphp/hack/src/server/hhServerMonitorConfig.ml
hphp/hack/test/unit/informant/informant_server_lifetime_test.ml