-
Notifications
You must be signed in to change notification settings - Fork 43
buffer: Audit for panics and refactor #662
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
Merged
Merged
Conversation
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
d36bf7b to
60a4319
Compare
madeleyneVaca
previously approved these changes
Dec 23, 2025
jerrysxie
previously approved these changes
Dec 23, 2025
Contributor
|
@kurtjd Don't forget to announce on Zulip once it is ready to be merged, thanks! |
jerrysxie
approved these changes
Dec 23, 2025
madeleyneVaca
approved these changes
Dec 24, 2025
Contributor
|
Bypassed policy and merge since people are on vacation. |
Contributor
Author
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.
Removed panic paths from the
buffermodule. Instead made methods fallible and introduced anErrortype.Because certain traits are used with methods that assume infallibility (such as the drop and borrow traits), I couldn't just make these return a result. Instead, I added a
Poisonedstatus so in the off chance that adroporborrowcall would have panicked originally, the buffer is marked poisoned and will return aPoisonederror on future accesses.This also breaks the interfaces of a few services. For these I added a
Buffererror and made methods fallible if necessary. I'm not a fan of this since any buffer errors represent an internal programming bug to the service and not something the user should expect/handle, and this breaks encapsulation. I do not want to silently just ignore buffer errors, so I'm not sure what other alternative there is here (open to suggestions).Edit: Thinking about maybe renaming the
Buffererror variant of these services toInternalor something. I'd prefer to make it more clear when an error represents an internal invariant being broken that is not something meant to be handled by the caller in any practical manner. It would act as a catchall since the specifics of what caused the error are implementation details that could change any time and not something the caller should be concerned with.Also introduced a
Nevertype alias which is useful now that some functions represent never-ending tasks which should never return unless there is an error (see related discussion: #634 (comment)).Resolves #659