Make ServerCommandLwt report different stack
commit1858f6c9284080b97f96d611afd4cf67b99c9a4d
authorLucian Wischik <ljw@fb.com>
Tue, 30 Jul 2019 22:16:41 +0000 (30 15:16 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Tue, 30 Jul 2019 22:21:18 +0000 (30 15:21 -0700)
tree5e8886425349b1e18417eac8a1b33f1e83057484
parentb6c3c2fb76d8c42ab820f5998c40ebf2508c5540
Make ServerCommandLwt report different stack

Summary:
The stack-traces I get from ServerCommandLwt are pretty awful due to asyncness, e.g.

```
[2019-07-29 17:47:35.657] [client-lsp] Starting clientLsp at /tmp/hh_server/zSdatazSsandcastlezSboxeszSwww.client_lsp_log
[2019-07-29 17:47:56.259] [client-lsp] Exception: message: End_of_file, stack trace: Raised at file "string.ml", line 114, characters 19-34
Called from file "sexp.ml", line 112, characters 13-47

 ---
Raised by primitive operation at file "stdlib.ml", line 390, characters 28-54
Called from file "stdlib.ml" (inlined), line 398, characters 2-47
Called from file "/mnt/btrfs/trunk-hg-fbcode-fbsource-61774532-1564138723/fbcode/hphp/hack/src/client/clientConnect.ml", line 46, characters 13-54

 ---
```

This diff changes it to capture the callstack at the start of the method, before any async resumptions have happened. This is a nicer callstack - it shows where in clientLsp actually called this code.

It's more expensive to gather the callstack in advance. But we're only doing it at the moment when clientLsp calls "rpc", which is of the order of magnitude of human actions, so I don't think that's an issue.

Reviewed By: 2BitSalute

Differential Revision: D16567199

fbshipit-source-id: 44f85241db0c4e13cbca3f4521133dd8c1bbc6cc
hphp/hack/src/server/serverCommandLwt.ml