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

Add more info to an ICE message #32371

Closed
wants to merge 1 commit into from
Closed

Conversation

nodakai
Copy link
Contributor

@nodakai nodakai commented Mar 20, 2016

The new message looks like

note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report:
note:   https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: version: 1.9.0-dev (3d7e519b7 2016-03-20)
note: run with `RUST_BACKTRACE=1` for a backtrace

Wonder if the version string should appear the first. Any suggestions?

@rust-highfive
Copy link
Collaborator

r? @Aatch

(rust_highfive has picked a reviewer for you, use r? to override)

@alexcrichton
Copy link
Member

In theory if this is an internal assertion error we may want actually dump a whole bunch of information. For example we could dump things like:

  • the entire output of --version --verbose
  • all command line arguments
  • a full backtrace by default

We may want to even go the extra mile and emit the information into a temporary file (e.g. bug-report.md) and ask that the file be directly uploaded to github (where the file may have more instructions).

I guess what I'm getting at is that this probably isn't too helpful for readers of the message except during bug reports, and we could perhaps add a whole lot more contextual information to bug reports by default as well (without streaming it all to the console).

cc @rust-lang/compiler
cc @rust-lang/tools

@bors
Copy link
Contributor

bors commented Mar 21, 2016

☔ The latest upstream changes (presumably #32369) made this pull request unmergeable. Please resolve the merge conflicts.

@nodakai
Copy link
Contributor Author

nodakai commented Mar 21, 2016

My impression was we don't suffer from a lack of information in a bug report that often. Instead I tend to see we cry for "Minimal case! Minimal reproducible test case!". So I'm not sure if a support for a rich crash report really helps the project.

By the way, as someone who gets paid by working for a proprietary software project, I'm not very comfortable with pastebin-like services.

the entire output of --version --verbose

Actually the "verbose" mode essentially adds the host triple only... Anyways this is straightforward.

all command line arguments

Minimal change to rustc_driver::run() will suffice

a full backtrace by default

What prevents us from hardcoding a full backtrace? Performance hit?

I think we can improve rustc_driver::monitor() so that if the passed closure panics, it's re-run with RUST_BACKTRACE=1. How do you like this idea?

@eddyb
Copy link
Member

eddyb commented Mar 21, 2016

What prevents us from hardcoding a full backtrace? Performance hit?

No, in the general case it's risking bugs in the libbacktrace code that may not be avoidable (other than by having RUST_BACKTRACE=0).
For rustc I think it's safe to have it enabled for ICEs, but not other fatal errors, maybe with a way to turn it off.
Problem is, the "abort if any errors have occurred mechanism uses a panic so every compilation with errors would have an unnecessary backtrace if nothing is changed.

@alexcrichton
Copy link
Member

Yeah it's certainly slow to produce a backtrace, but that doesn't matter much as we're just doing it whenever an error is generated.

I wouldn't recommend re-running the closure to the monitor function, errors like this can be transient sometimes or take a very long time to produce (long compiles), so we'd want to collect as much information as possible from when it happens originally.

@nrc
Copy link
Member

nrc commented Mar 21, 2016

I would be wary about dumping a tonne of info for an ICE by default. As a user experience, hitting an ICE is bad enough already, we really shouldn't make it worse by flooding the console with info. The majority of users are passive and will not report the bug, they are just quietly annoyed by it and dumping more info (esp. a backtrace) will just make them more annoyed. If we do this (and it seems like a good idea) we could perhaps do it by default on nightly and with a flag or env var on other channels (changing the "run with RUST_BACKTRACE=1 for a backtrace" message to something like "run with --verbose-ice for more information".

On this actual PR, I don't feel strongly either way.

@nodakai nodakai changed the title Add the rustc version to the ICE message. Add more info to an ICE message Mar 22, 2016
@nodakai
Copy link
Contributor Author

nodakai commented Mar 22, 2016

The new ICE message will look like

$ rustc -O /tmp/nodakai/ice.rs
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report:
note:   https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: version: 1.9.0-dev (1437edb98 2016-03-22)
note: host: x86_64-unknown-linux-gnu
note: arguments: ["rustc", "-O", "/tmp/nodakai/ice.rs"]
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'impossible range in AST', src/librustc_front/lowering.rs:1292
note: Run with `RUST_BACKTRACE=1` for a backtrace.

This patch adds version, host and arguments fields. I'll address the backtrace issue in a separate commit.

The new ICE message will look like

$ rustc -O /tmp/nodakai/ice.rs
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report:
note:   https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: version: 1.9.0-dev (1437edb98 2016-03-22)
note: host: x86_64-unknown-linux-gnu
note: arguments: ["rustc", "-O", "/tmp/nodakai/ice.rs"]
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'impossible range in AST', src/librustc_front/lowering.rs:1292
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Signed-off-by: NODA, Kai <[email protected]>
@alexcrichton
Copy link
Member

The tools team discussed this during triage yesterday, and the conclusion was that we like the idea here but probably want to tweak it. The key point we realized is that we don't want to pollute the ICE message on the console more than it is already today, but we probably want to perhaps dump more information somewhere. Along those lines, we envisioned something like:

  1. When an ICE is encountered, the compiler will dump all contextual information to a "bug report file". This file is likely just bug-report-XXXXX.md or something like that, and it's essentially something that can be copy/pasted into an issue report.
  2. The ICE message is tweaked slightly to indicate where the bug report is located on disk (probably in --out-dir).
  3. The ICE message already points to CONTRIBUTING.md, so we can tweak the wording there to indicate that if you're there because of an ICE you should copy/paste that markdown file into an issue and submit it. This file would also warn you to double-check the contents of the file to ensure you're not leaking any information you don't want (sensitive path names, etc).

That should help give us more information "by default" without polluting the terminal, and it's also an nice expandable vector for adding more information in the future.

How's that sound @nodakai?

@alexcrichton alexcrichton assigned alexcrichton and unassigned Aatch Mar 24, 2016
@nodakai
Copy link
Contributor Author

nodakai commented Mar 26, 2016

Sounds good, I'll work on a new patch.

Let me take this opportunity to fix this discouragingly lengthy URL
https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

At least it should be https://www.rust-lang.org/contribute.html and ideally just rust-lang.org/contribute.html . Is redirection guaranteed here?

@bors
Copy link
Contributor

bors commented Apr 9, 2016

☔ The latest upstream changes (presumably #32773) made this pull request unmergeable. Please resolve the merge conflicts.

@alexcrichton
Copy link
Member

Closing due to inactivity, but feel free to resubmit with a rebase!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants