fix cancellation of LwtLoops
fix cancellation of LwtLoops

Summary:
This is a doozy... pull up a chair and bear with me:

`FlowServerMonitorServer.ServerInstance.CommandLoop.main` (part of the monitor) is an Lwt thread that reads from the command stream (from the client) and writes to the server's connection, in an infinite loop. separately, the monitor has a thread waiting on the server to exit which cancels `CommandLoop`. but Lwt can only check on the other thread when `CommandLoop` yields control, which it only does when the command stream is empty, or when it does I/O.

When the server exits under certain circumstances, the monitor chooses to restart it (see `KeepAliveLoop`). There are still pending requests in the command stream, waiting to be resent to the new server, and we've already talked to watchman. So `CommandLoop` doesn't need to yield control until it writes to the server connection.

If the new server also dies, Lwt doesn't get a chance to notice that the server process exited, so it can't cancel `CommandLoop` until `CommandLoop` writes to the server connection, which is dead, which causes a fatal in the monitor.

Inserting an `Lwt.pause` lets the loop yield so we can process the server exit. That cancels `CommandLoop` (and everything else) before `CommandLoop` can write to the closed connection, preventing the exception.

Reviewed By: samwgoldman

Differential Revision: D22061488

fbshipit-source-id: 57be98dfd1f67c04da63b3239cc8bea5ddf97193

mroch/flow,facebook/flow,mroch/flow,facebook/flow,facebook/flow,facebook/flow,mroch/flow,mroch/flow,facebook/flow,mroch/flow,mroch/flow,mroch/flow,facebook/flow,facebook/flow