Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upFire a mozbrowsererror event if pipeline/frame panics #10334
Comments
|
And maybe attach the back trace or add some more details to the event to allow browserhtml to report the crash. |
|
@paulrouget should that be |
|
At the moment, our binding to mozbrowsererror doesn't allow us to specify the type (https://github.com/servo/servo/blob/master/components/script_traits/lib.rs#L418). We'd need to extend @paulrouget How important is the type? Should we just emit a mozbrowsererror with no type info for now? |
|
Also @paulrouget, should there be any other info in the event? For example, would including the stack trace in the detail be useful? |
|
@asajeffrey The type is not important to maintain. We extend them as necessary. |
"fatal"
Not that important, but it's pretty easy to support: we should create a new event type in BrowserElement.webidl;
Absolutely. You can add an extra field to the webidl for that. |
|
From #10329 (comment)
Looking at this perhaps we have to use the latter option, since we need to be able to associate a panic with a specific |
|
@paulrouget For telemetry and stuff, would it be okay if the bhtml window itself could have a mozbrowsererror fired on it (not just its iframes)? This way, we can attempt to catch crashes in individual iframe threads, and if the panic is elsewhere, try to tell bhtml about it directly so that it can (attempt to) report to telemetry. |
|
@Manishearth Do we need to have a special event for that? Could we use this instead: https://html.spec.whatwg.org/multipage/webappapis.html#handler-onerror. Because we try to make mozbrowser events map contentDocument events. Regardless of the name of the event, it should be fired only if 1) the mozbrowser pref is on, 2) only to the very top level pipeline. |
|
Could it be a mozbrowsererror instead (fired on the (Yes, it will only trigger on Browser windows, but I like having that second step there too) |
|
Sure. To avoid confusion, could we name it |
|
sgtm |
|
OK, here's my first shot, but I don't think it's quite right (reasons below): fn handle_failure_msg(&mut self,
pipeline_id: PipelineId,
parent_info: Option<(PipelineId, SubpageId)>) {
...
if Some((parent_id, subpage_id)) = parent_info {
if Some(parent) = self.pipelines.get(&parent_id) {
let event = MozBrowserEvent::Error; // TODO: add type and detail
parent.trigger_mozbrowser_event(subpage_id, event);
}
}
...
}The reason why I don't think this is quite right is that it's firing the @Manishearth thoughts? |
|
(One thing holding this back is that we can't get at the error until #10345 lands). |
|
The subpage is used to identify the iframe element in the given pipeline, iirc. |
|
Which is to say, the script thread which may not be in a good state for dispatching events is entirely different from the script thread that contains the iframe element, since the two are considered cross origin to each other. |
|
@jdm: yes, but |
|
Goes and reads implementation... ah, I see the event is actually processed by the script thread of the parent, not of the child. This is good! Not so good is the nested case, since we want the event to reach the browser.html root iframe eventually. When the event reaches the document node of its containing iframe, does it keep bubbling? |
|
I was thinking we'd store a separate sender to the toplevel script task in the thread local state. This does break process isolation, however, so it has to be a different channel entirely that can only handle mozbrowserevents, which needs to be selected on. Perhaps this solution is better, though I'm not sure how process isolation is achieved here. Do child iframes have access to the parent script threads via the pipeline API? Even if x-origin? Is that not plusungood? The reason I'd prefer using TLS instead of the existing machinery is that we don't know how much is broken with the existing machinery when we hit the panic handler. IEven if something wasn't broken, it probably got cleaned up during unwinding -- panic handlers can't access your usual state since they run after destructors IIRC. This way we set up a channel when spawning a task (easy to do since it's not during a panic), stick it in TLS, and have the panic handler just blindly send the backtrace down that channel. |
|
OK, what we could do when an error happens is run up the pipeline tree starting at the pipeline that caused the error, until we find the Looking at the code for |
|
The idea right now is that we only intend to support mozbrowser frames in the top-level document. |
|
@jdm However, we want to support catching crashes in frames that are transitively under mozbrowser, no? |
|
That has interesting implications, since the root frame can't directly interact with the iframe containing the pipeline that failed. |
|
@jdm: indeed, but by this point the iframe contents are in some unknown state, hopefully about:failure. The chrome can't do much, except perhaps ask the user if they want to submit a report, and maybe kill the tab containing the crashed iframe. |
…earth Added panic message to failures. Added the panic message to failures. This is a step towards #10334, since it gives us access to the panic error message when we fire a `mozbrowsererror` event. The remaining steps are also to record the backtrace, and to report the failure in the event. <!-- 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/10587) <!-- Reviewable:end -->
|
Relevant IRC chat: http://logs.glob.uno/?c=mozilla%23servo&s=14+Apr+2016&e=14+Apr+2016#c406473 |
|
@paulrouget what should we do if a non-pipeline thread panics? There's no iframe responsible for the panic, should we just trigger a |
|
@Manishearth okay, I am going over previous discussions. @paulrouget you'd prefer a different event than a mozbrowsererror event with some other way of distinguishing that it didn't come from a particular iframe? |
|
|
We can fire it onto any fixed target, e.g. the root document, there's just no iframe to target, unless we wanted to try to track which pipeline each thread is acting on behalf of. |
The top level window is a Browser window though. |
|
It doesn't really matter. |
|
#10641 adds a panic channel that can be used by any thread (not just a pipeline thread) to report panics. Next up: add the backtrace to that channel, get all threads to report panics, and hook up to mozbrowsererror. |
Trigger mozbrowsererror event when a pipeline fails. Addresses part of #10334 (it fires the event, but does not include a backtrace). <!-- 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/10551) <!-- Reviewable:end -->
Dedicated panic channel Added a dedicated panic channel, and removed the panic messages for the script and layout threads. This is needed so that other threads can report panics, which is part of #10334. Note that this PR includes the commit from #10572, so should land after it lands. r? @Manishearth <!-- 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/10641) <!-- Reviewable:end -->
Dedicated panic channel Added a dedicated panic channel, and removed the panic messages for the script and layout threads. This is needed so that other threads can report panics, which is part of #10334. Note that this PR includes the commit from #10572, so should land after it lands. r? @Manishearth <!-- 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/10641) <!-- Reviewable:end -->
|
@paulrouget what do you want me to do in the case of multiple panics? Just send the first one? Just send the first one for each pipeline? These things usually travel in packs, since panics cascade. |
|
@paulrouget I added |
|
#10862 allows us to test this, by making sure the root pipeline survives, even when randomly killing pipelines. |
…anishearth Communicate a backtrace to the constellation when panicking. Send a representation of the backtrace from a pipeline thread to the constellation in the case of panic. This is the next step in communicating the backtrace to the browser chrome (#10334). <!-- 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/10824) <!-- Reviewable:end -->
Don't kill the root pipeline when randomly killing pipelines. Useful for stress-testing the browser chrome, e.g. testing #10334. <!-- 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/10862) <!-- Reviewable:end -->
|
#10898 only keeps the root pipeline alive when |
…shearth Add detail to mozbrowsererror events. Part of #10334. Once #10824 lands, we can include the panic reason and backtrace in the error report. <!-- 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/10837) <!-- Reviewable:end -->
… r=jdm Send the panic reason and backtrace in mozbrowsererror. Closes #10334. Glues together PRs #10837 and #10824. <!-- 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/10931) <!-- Reviewable:end -->
Followup: #10082 (comment)
mozbrowsererror with
type = "fatal".