-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
watchman_client: don't spawn off reads on their own task
Summary: There are a couple issues with watchman_client as it exists today: First, if the reader task fails (e.g. because Watchman crashed), then we just hang forever. What happens then is that the reader stops sending messages, but the client doesn't notice because it's just waiting on a channel that is shared by the reader and clients that want to send requests. Second, even if the client is dropped and its channel is closed, the reader is left around because nothing stops it. Finally, there is a bit of a bug here in the sense that we assume the first read we do will always have the full PDU header. In practice since we talk to a local socket that is true, but I updated this slightly so that we continue trying to decode the header after getting more data, unless we've definitely seen too much data ( as per the comment that was there already) This diffs fixes those issues by removing the dedicated task we had for the reader, and instead having the client task do it. This requires rewriting the logic we use for reading a bit using a Decoder instead of doing it imperatively in an `async fn`. Reviewed By: markbt Differential Revision: D28742178 fbshipit-source-id: e3a2e3cc7269e45bf9d7865a9015f80f81fabfd3
- Loading branch information
1 parent
6206b68
commit 9c897ce
Showing
2 changed files
with
143 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters