-
Notifications
You must be signed in to change notification settings - Fork 201
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
Improves panic message if send() fails in streaming_unpack_snapshot() #2459
Conversation
Backports to the stable branch are to be avoided unless absolutely necessary for fixing bugs, security issues, and perf regressions. Changes intended for backport should be structured such that a minimum effective diff can be committed separately from any refactoring, plumbing, cleanup, etc that are not strictly necessary to achieve the goal. Any of the latter should go only into master and ride the normal stabilization schedule. |
Backports to the beta branch are to be avoided unless absolutely necessary for fixing bugs, security issues, and perf regressions. Changes intended for backport should be structured such that a minimum effective diff can be committed separately from any refactoring, plumbing, cleanup, etc that are not strictly necessary to achieve the goal. Any of the latter should go only into master and ride the normal stabilization schedule. Exceptions include CI/metrics changes, CLI improvements and documentation updates on a case by case basis. |
if let Err(err) = result { | ||
panic!( | ||
"failed to send path '{}' from unpacker to rebuilder: {err}", | ||
err.0.display(), |
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.
entry_path_buf
instead of err.0.display
right ?
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.
Yes, ish. The entry_path_buf
was moved into the send
, so we'd have to clone it. But conveniently, if send
returns an Error, it puts the T
back inside. So in our case here, err.0
is entry_path_buf
and we don't need to clone it.
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.
Oh nice, was not aware. And it looks like the Display
impl for SendError
does NOT print the T
so we will not be double printing out the T
.
https://docs.rs/crossbeam-channel/0.5.11/src/crossbeam_channel/err.rs.html#124-128
nit: Thoughts on using into_inner()
over .0
? I doubt crossbeam would be adding additional items (and reordering them) at this point, but I feel like into_inner()
is slighter more expressive
https://docs.rs/crossbeam/latest/crossbeam/channel/struct.SendError.html#method.into_inner
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.
If we used into_inner()
, would we lose the ability to log the error itself though?
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.
Hmm yeah, I guess since we're inside a let Err(err) = ...
block, we can't call into_innter()
as that would move it. So, we'd have to clone; granted this isn't a big deal since the clone would be in the same line that we're panicking, but I think we can leave the .0
too
Problem
There are reports on Discord12 of people hitting panics while sending on a channel during snapshot unpacking. Here's an example:
The
unwrap
doesn't yield the best panic message...Summary of Changes
Improve the panic message.
Footnotes
https://discord.com/channels/428295358100013066/560174212967432193/1270412894026207305 ↩
https://discord.com/channels/428295358100013066/837340113067049050/1270052679309328408 ↩