make read_exact_at cancel-safe#6101
Merged
problame merged 1 commit intoproblame/integrate-tokio-epoll-uring/wipfrom Dec 12, 2023
Merged
Conversation
No tests were run or test report is not availableTest coverage report is not availableThe comment gets automatically updated with the latest test results
53ac78e at 2023-12-12T14:21:15.476Z :recycle: |
Contributor
Author
|
Compile error: I think this is rust-lang/rust#102211 (comment) although I freely admit I don't fully understand that issue. Anyway, following @jcsp 's advice I created a smaller reproducer and found that removing the Follow the process in |
problame
added a commit
that referenced
this pull request
Dec 11, 2023
koivunej
reviewed
Dec 11, 2023
Pass `FileGuard` to the tokio-epoll-uring read() operation. and avoids the nasty scopeguard usage. This makes the `read_exact_at` cancel-safe. Depends on neondatabase/tokio-epoll-uring#27
41a2fc2 to
53ac78e
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before this PR, we didn't move ownership of the
FileGuardto the read future.This meant the
read_exact_atfuture wasn't cancel-safe, because dropping it while thereadfuture was live could lead to use-after-closeof the file descriptor.We protected against that through a scopeguard.
This PR builds on top of neondatabase/tokio-epoll-uring#27
, passing
FileGuardownership to the tokio-epoll-uring read() operation.This makes the
read_exact_atcancel-safe.