Skip to content

Skip printing the backtrace for RecvError/SendError - #10329

Merged
Ms2ger merged 3 commits into
servo:masterfrom
Manishearth:skip-backtrace
Apr 5, 2016
Merged

Ms2ger merged 3 commits into
servo:masterfrom
Manishearth:skip-backtrace

Conversation

@Manishearth

Copy link
Copy Markdown
Member

We currently get tons of useless backtraces clogging up the output when we have a panic cascade. This adds a handler that outputs a single line when a thread panics due to a sender or receiver hanging up, since this is almost always due to a panic cascade.

We could add a commandline arg that gets us back the old behavior, though I'm not sure if this is necessary.

r? @asajeffrey


This change is Reviewable

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Apr 1, 2016
Comment thread components/util/thread.rs
let new_handler = move |info: &PanicInfo| {
let payload = info.payload();
if let Some(s) = payload.downcast_ref::<String>() {
if s.contains("SendError") {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We could perhaps improve this check with a better regex match.

@Manishearth
Manishearth force-pushed the skip-backtrace branch 3 times, most recently from 8be0ce5 to 9e75d23 Compare April 1, 2016 02:18
We currently get tons of useless backtraces clogging up the output when we have a panic cascade. This adds a handler that outputs a single line when a thread panics due to a sender or receiver hanging up, since this is almost always due to a panic cascade.
@Manishearth

Copy link
Copy Markdown
Member Author

We still get panic cascades with IPC, however I'm not sure if that's due to #10260 or is a general thing/

Comment thread components/util/thread.rs Outdated
use std::thread::Builder;
use thread_state;

#[allow(unused_must_use)]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why this addition?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I skip the result of write!. I don't want to panic within a panic handler, and if stderr is broken I don't see much point of trying to output an error either.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

let _ = ...;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done

@jdm

jdm commented Apr 1, 2016

Copy link
Copy Markdown
Member

My fear is that this will suppress useful backtraces for errors that are not part of a panic cascade that happen to involve sending or receiving on an invalid sender/receiver.

@Manishearth

Copy link
Copy Markdown
Member Author

That's the only time you can get SendError/RecvError

@asajeffrey

Copy link
Copy Markdown
Contributor

Can't you get a SendError/RecvError if the other half of the channel has been reclaimed? So this would eat the stack trace even in cases where there's not a panic cascade.

In production use, there's a request (#10334) to send an event to the chrome, which can determine how best to present panics to the user. We might want to rely on that for the UX of panics, rather than trying to do a regex-based edit.


Reviewed 1 of 2 files at r1, 1 of 1 files at r3.
Review status: all files reviewed at latest revision, 2 unresolved discussions.


Comments from the review on Reviewable.io

@Manishearth

Copy link
Copy Markdown
Member Author

I could add a cmdline option to get it back.

I'm not sure how #10334 can be handled. By the time you reach a panic handler, that thread is effectively gone already -- the relevant machinery to report that error is already missing. recover() might be useful here, not sure.

@Manishearth

Copy link
Copy Markdown
Member Author

I added a commandline option.

As far as #10334, one way to handle this might be to have a global privileged "parent window". Windows corresponding to browser.html and those using that API have this. On Servo's side we store a global once-initialized static channel to its script task, and in the panic handler if we find such a channel and sending messages to the window works (use try_send() instead of send()), send a message to the script task with panic details. This triggers an event on the bhtml Window.

The alternative is to have each iframe mozbrowser get a special custom panic handler that bubbles it up. However, panics may not always be in the per-iframe threads, and if something else panics then there's not much we can do about it.

@asajeffrey

Copy link
Copy Markdown
Contributor

IRC conversation at http://logs.glob.uno/?c=mozilla%23servo#c399939


Reviewed 2 of 2 files at r4.
Review status: all files reviewed at latest revision, 2 unresolved discussions, some commit checks failed.


Comments from Reviewable

@asajeffrey

Copy link
Copy Markdown
Contributor

@bors-servo r+

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit a2c82a0 has been approved by asajeffrey

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Apr 5, 2016
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit a2c82a0 with merge 039e089...

bors-servo pushed a commit that referenced this pull request Apr 5, 2016
Skip printing the backtrace for RecvError/SendError

We currently get tons of useless backtraces clogging up the output when we have a panic cascade. This adds a handler that outputs a single line when a thread panics due to a sender or receiver hanging up, since this is almost always due to a panic cascade.

We could add a commandline arg that gets us back the old behavior, though I'm not sure if this is necessary.

r? @asajeffrey

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10329)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - linux-rel

@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Apr 5, 2016
@highfive highfive added the S-tests-failed The changes caused existing tests to fail. label Apr 5, 2016
@Manishearth

Copy link
Copy Markdown
Member Author

@bors-servo retry

Tests with unexpected results:
  ▶ TIMEOUT [expected OK] /cssom-view/scrollingElement.html
  │ 
  │ Xlib:  extension "XFree86-VidModeExtension" missing on display ":0".
  │ ERROR:js::rust: Error at http://web-platform.test:8000/cssom-view/scrollingElement.html:14:4: URL.createObjectURL is not a function
  │ 
  │ ERROR:js::rust: Error at http://web-platform.test:8000/cssom-view/scrollingElement.html:11:6: URL.createObjectURL is not a function
  └ 

this sounds like a problem with the infra, let's see if it's intermittent

@bors-servo

Copy link
Copy Markdown
Contributor

⚡ Previous build results for android, arm32, linux-dev, mac-dev-unit, mac-rel-css, mac-rel-wpt, status-appveyor are reusable. Rebuilding only linux-rel...

@KiChjang

KiChjang commented Apr 5, 2016

Copy link
Copy Markdown
Contributor

@Manishearth That's #10398.

@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - linux-rel

@highfive highfive added the S-tests-failed The changes caused existing tests to fail. label Apr 5, 2016
@KiChjang

KiChjang commented Apr 5, 2016

Copy link
Copy Markdown
Contributor

@bors-servo

Copy link
Copy Markdown
Contributor

⚡ Previous build results for android, arm32, linux-dev, mac-dev-unit, mac-rel-css, mac-rel-wpt, status-appveyor are reusable. Rebuilding only linux-rel...

@bors-servo bors-servo mentioned this pull request Apr 5, 2016
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - linux-rel

@highfive highfive added the S-tests-failed The changes caused existing tests to fail. label Apr 5, 2016
@Manishearth

Copy link
Copy Markdown
Member Author

Huh, looks like github search can't find that if I search for XFree

@KiChjang

KiChjang commented Apr 5, 2016

Copy link
Copy Markdown
Contributor

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit a2c82a0 with merge 05a4dcd...

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-tests-failed The changes caused existing tests to fail. labels Apr 5, 2016
bors-servo pushed a commit that referenced this pull request Apr 5, 2016
Skip printing the backtrace for RecvError/SendError

We currently get tons of useless backtraces clogging up the output when we have a panic cascade. This adds a handler that outputs a single line when a thread panics due to a sender or receiver hanging up, since this is almost always due to a panic cascade.

We could add a commandline arg that gets us back the old behavior, though I'm not sure if this is necessary.

r? @asajeffrey

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10329)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - android, arm32, linux-dev, linux-rel, mac-dev-unit, mac-rel-css, mac-rel-wpt, status-appveyor

@Ms2ger
Ms2ger merged commit a2c82a0 into servo:master Apr 5, 2016
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Apr 5, 2016
@Manishearth
Manishearth deleted the skip-backtrace branch April 5, 2016 11:21
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.

8 participants