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

Remove backtraces on error when running rerun binary #4746

Merged
merged 6 commits into from Jan 9, 2024

Conversation

emilk
Copy link
Member

@emilk emilk commented Jan 9, 2024

What

Starting in anyhow 1.0.77, a backtrace will be printed on error if RUST_BACKTRACE is set, and we set RUST_BACKTRACE=1 in:

if std::env::var("RUST_BACKTRACE").is_err() {
// Make sure we always produce backtraces for the (hopefully rare) cases when we crash!
std::env::set_var("RUST_BACKTRACE", "1");
}

We do this because we want to print stack traces on panics.

However, for anyhow::Error our error messages should be good enough to not require a stack trace,
so with this PR we now explicitly print out the error instead of relying in the formatting that happens when returning anyhow::Result from main.

Result

❯ cargo run -p rerun-cli --quiet -- .github/workflows/documentation.yaml    
[2024-01-09T10:09:31Z INFO  re_data_source::load_file] Loading ".github/workflows/documentation.yaml"…
Error: ".github/workflows/documentation.yaml" -> No data-loader support for ".github/workflows/documentation.yaml"

Checklist

  • I have read and agree to Contributor Guide and the Code of Conduct
  • I've included a screenshot or gif (if applicable)
  • I have tested the web demo (if applicable):
  • The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG

@emilk emilk added 🧑‍💻 dev experience developer experience (excluding CI) CLI Related to the Rerun CLI labels Jan 9, 2024
@emilk emilk marked this pull request as ready for review January 9, 2024 10:09
@Wumpf Wumpf self-requested a review January 9, 2024 10:14
Copy link
Member

@Wumpf Wumpf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great find! 👌

@emilk emilk added exclude from changelog PRs with this won't show up in CHANGELOG.md include in changelog and removed exclude from changelog PRs with this won't show up in CHANGELOG.md labels Jan 9, 2024
@emilk emilk merged commit 97acc3e into main Jan 9, 2024
42 of 43 checks passed
@emilk emilk deleted the emilk/remove-backtraces branch January 9, 2024 10:35
emilk added a commit that referenced this pull request Jan 9, 2024
### What
* Closes #4738

Starting in [`anyhow
1.0.77`](https://github.com/dtolnay/anyhow/releases/tag/1.0.77), a
backtrace will be printed on error if `RUST_BACKTRACE` is set, and we
set `RUST_BACKTRACE=1` in:


https://github.com/rerun-io/rerun/blob/d204936e4a186b6f264425f7a3d3849f94b7b86f/crates/re_log/src/setup.rs#L32-L35

We do this because we want to print stack traces on panics.

However, for `anyhow::Error` our error messages _should_ be good enough
to not require a stack trace,
so with this PR we now explicitly print out the error instead of relying
in the formatting that happens when returning `anyhow::Result` from
`main`.

### Result
```
❯ cargo run -p rerun-cli --quiet -- .github/workflows/documentation.yaml    
[2024-01-09T10:09:31Z INFO  re_data_source::load_file] Loading ".github/workflows/documentation.yaml"…
Error: ".github/workflows/documentation.yaml" -> No data-loader support for ".github/workflows/documentation.yaml"
```

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested the web demo (if applicable):
* Using newly built examples:
[app.rerun.io](https://app.rerun.io/pr/4746/index.html)
* Using examples from latest `main` build:
[app.rerun.io](https://app.rerun.io/pr/4746/index.html?manifest_url=https://app.rerun.io/version/main/examples_manifest.json)
* Using full set of examples from `nightly` build:
[app.rerun.io](https://app.rerun.io/pr/4746/index.html?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json)
* [x] The PR title and labels are set such as to maximize their
usefulness for the next release's CHANGELOG

- [PR Build Summary](https://build.rerun.io/pr/4746)
- [Docs
preview](https://rerun.io/preview/dfadee45bb4767f1e81e2459b8e3f93aabcb5c39/docs)
<!--DOCS-PREVIEW-->
- [Examples
preview](https://rerun.io/preview/dfadee45bb4767f1e81e2459b8e3f93aabcb5c39/examples)
<!--EXAMPLES-PREVIEW-->
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)
emilk added a commit that referenced this pull request Jan 9, 2024
@emilk emilk added this to the 0.12.1 milestone Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLI Related to the Rerun CLI 🧑‍💻 dev experience developer experience (excluding CI) include in changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unexpected stack trace when loading a file with no data-loader support.
2 participants