-
Notifications
You must be signed in to change notification settings - Fork 268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fs-watch: Use a properly sized buffer for inotify events #195
Conversation
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
@@ -812,4 +819,26 @@ mod tests { | |||
fn inotify_nonexistent_files_dont_file_delete_events() { | |||
Fixture::new().test_inotify(test_detects_delete_and_recreate) | |||
} | |||
|
|||
const LONG: &str = "loooooooooooooooooooooooooooooooooooooooooooooooongboi"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this might be a good job for quickcheck
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's a good point. I'm going to go ahead and merge the bugfix first, though, so it's not blocked on writing a QuickCheck generator for valid filenames.
This picks up the following commits: * 0fe8063 replace with (#2370) (linkerd/linkerd2-proxy#201) * 1ea7559 Minor cleanup in the config tests (linkerd/linkerd2-proxy#188) * d0ef56b Update *ring* to 0.14.6 (linkerd/linkerd2-proxy#197) * c54377f fs-watch: Use a properly sized buffer for inotify events (linkerd/linkerd2-proxy#195) * 23e02a6 Update Router to wait for inner poll_ready before calling inner call * 2de8e9b Update metrics quickcheck to 0.8, and hyper to 0.12.24 * d1bbd4b make: Optionally include debug symbols with builds (linkerd/linkerd2-proxy#193) * 738a541 Fix compilation warnings in fs-watch (linkerd/linkerd2-proxy#192) * 6cc7558 Apply rustfmt (linkerd/linkerd2-proxy#191) Signed-off-by: Ivan Sim <ivan@buoyant.io>
This picks up the following commits: * 0fe8063 replace `Error::cause` with `Error::source` (#2370) (linkerd/linkerd2-proxy#201) * 1ea7559 Minor cleanup in the config tests (linkerd/linkerd2-proxy#188) * d0ef56b Update *ring* to 0.14.6 (linkerd/linkerd2-proxy#197) * c54377f fs-watch: Use a properly sized buffer for inotify events (linkerd/linkerd2-proxy#195) * 23e02a6 Update Router to wait for inner poll_ready before calling inner call * 2de8e9b Update metrics quickcheck to 0.8, and hyper to 0.12.24 * d1bbd4b make: Optionally include debug symbols with builds (linkerd/linkerd2-proxy#193) * 738a541 Fix compilation warnings in fs-watch (linkerd/linkerd2-proxy#192) * 6cc7558 Apply rustfmt (linkerd/linkerd2-proxy#191) Signed-off-by: Ivan Sim <ivan@buoyant.io>
This picks up the following commits: * 0fe8063 replace `Error::cause` with `Error::source` (#2370) (linkerd/linkerd2-proxy#201) * 1ea7559 Minor cleanup in the config tests (linkerd/linkerd2-proxy#188) * d0ef56b Update *ring* to 0.14.6 (linkerd/linkerd2-proxy#197) * c54377f fs-watch: Use a properly sized buffer for inotify events (linkerd/linkerd2-proxy#195) * 23e02a6 Update Router to wait for inner poll_ready before calling inner call * 2de8e9b Update metrics quickcheck to 0.8, and hyper to 0.12.24 * d1bbd4b make: Optionally include debug symbols with builds (linkerd/linkerd2-proxy#193) * 738a541 Fix compilation warnings in fs-watch (linkerd/linkerd2-proxy#192) * 6cc7558 Apply rustfmt (linkerd/linkerd2-proxy#191) Signed-off-by: Ivan Sim <ivan@buoyant.io>
Any HTTP/1.1 requests seen by the proxy will automatically set up to prepare such that if the proxied responses agree to an upgrade, the two connections will converted into a standard TCP proxy duplex. Implementation ----------------- This adds a new type, `transparency::Http11Upgrade`, which is a sort of rendezvous type for triggering HTTP/1.1 upgrades. In the h1 server service, if a request looks like an upgrade (`h1::wants_upgrade`), the request body is decorated with this new `Http11Upgrade` type. It is actually a pair, and so the second half is put into the request extensions, so that the h1 client service may look for it right before serialization. If it finds the half in the extensions, it decorates the *response* body with that half (if it looks like a response upgrade (`h1::is_upgrade`)). The `HttpBody` type now has a `Drop` impl, which will look to see if its been decorated with an `Http11Upgrade` half. If so, it will check for hyper's new `Body::on_upgrade()` future, and insert that into the half. When both `Http11Upgrade` halves are dropped, its internal `Drop` will look to if both halves have supplied an upgrade. If so, the two `OnUpgrade` futures from hyper are joined on, and when they succeed, a `transparency::tcp::duplex()` future is created. This chain is spawned into the default executor. The `drain::Watch` signal is carried along, to ensure upgraded connections still count towards active connections when the proxy wants to shutdown. Closes linkerd#195
The buffer passed to
read(2)
to read inotify events from the inotifyfd must be long enough to fit events with filenames of the maximum
allowable length. The
inotify-rs
library previously always constructedsuch a buffer, but as of 1fe4e38, we
are required to provide our own buffer. The buffer we were providing was
insufficiently large for some filenames.
See also the
man
page forinotify
:(http://man7.org/linux/man-pages/man7/inotify.7.html)
This branch updates the
fs-watch
lib to calculate the necessary bufferlength correctly, and use a properly-sized buffer. I've also added tests
that fail when the buffer is too short.
Fixes linkerd/linkerd2#2331
Signed-off-by: Eliza Weisman eliza@buoyant.io