Skip to content
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

Merged
merged 1 commit into from
Aug 6, 2024

Conversation

brooksprumo
Copy link

@brooksprumo brooksprumo commented Aug 6, 2024

Problem

There are reports on Discord12 of people hitting panics while sending on a channel during snapshot unpacking. Here's an example:

thread 'solUnpkSnpsht01' panicked at /var/lib/buildkite-agent/builds/release/anza/agave-secondary/accounts-db/src/hardened_unpack.rs:338:45:
called `Result::unwrap()` on an `Err` value: "SendError(..)"
stack backtrace:

The unwrap doesn't yield the best panic message...

Summary of Changes

Improve the panic message.

Footnotes

  1. https://discord.com/channels/428295358100013066/560174212967432193/1270412894026207305

  2. https://discord.com/channels/428295358100013066/837340113067049050/1270052679309328408

@brooksprumo brooksprumo self-assigned this Aug 6, 2024
@brooksprumo brooksprumo added v1.18 v2.0 Backport to v2.0 branch labels Aug 6, 2024
Copy link

mergify bot commented Aug 6, 2024

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.

Copy link

mergify bot commented Aug 6, 2024

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.

@brooksprumo brooksprumo marked this pull request as ready for review August 6, 2024 17:01
if let Err(err) = result {
panic!(
"failed to send path '{}' from unpacker to rebuilder: {err}",
err.0.display(),
Copy link

@steviez steviez Aug 6, 2024

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 ?

Copy link
Author

@brooksprumo brooksprumo Aug 6, 2024

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.

Copy link

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

Copy link
Author

@brooksprumo brooksprumo Aug 6, 2024

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?

Copy link

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

@brooksprumo brooksprumo merged commit 427a18b into anza-xyz:master Aug 6, 2024
42 checks passed
@brooksprumo brooksprumo deleted the hardened-unpack-error branch August 6, 2024 18:37
mergify bot pushed a commit that referenced this pull request Aug 6, 2024
mergify bot pushed a commit that referenced this pull request Aug 6, 2024
brooksprumo added a commit that referenced this pull request Aug 16, 2024
…shot() (backport of #2459) (#2464)

Improves panic message if send() fails in streaming_unpack_snapshot() (#2459)

(cherry picked from commit 427a18b)

Co-authored-by: Brooks <brooks@anza.xyz>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v1.18 v2.0 Backport to v2.0 branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants