Add memory region to crash reports containing current actor/message manager message being processed
Categories
(Core :: DOM: Content Processes, task, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox77 | --- | fixed |
People
(Reporter: kmag, Assigned: Yoric)
References
(Blocks 1 open bug)
Details
Attachments
(4 files)
Crash reports don't contain JS stacks, which makes it hard to diagnose crashes caused by JS unless there's particularly relevant C++ on the stack. In the case of JS calling or called by actor or message manager messages, there often isn't.
It would help a lot if we simply stored the name of the actor/message we're currently sending or receiving in a memory region that we register with the crash reporter, so that we can inspect it to get some context for crash reports where it seems relevant.
This should add a small amount of overhead to message processing, but hopefully not much, since it just requires copying a handful of machine words which are already in the cache anyway.
Comment 1•5 years ago
|
||
Tracking for Fission dogfooding (M5)
kmag says he will have a patch up soon. This bug will make Fission crash reports easier to debug.
Comment 3•5 years ago
|
||
:kmag has a lot of bugs on his plate, so moving to m5b, and unassigning so we can find a new owner.
Comment 4•5 years ago
|
||
Yoric, will you have time to work on this bug after you finish JSContentActor?
This bug will improve Fission crash reporting. We expect to receive a lot of new crash reports when we start dogfood testing soon.
Assignee | ||
Comment 5•5 years ago
|
||
I can do that, yes.
We'll need to check the perf impact, though.
Assignee | ||
Comment 6•5 years ago
|
||
So, I think that the best way to do this is to do something like:
nsICrashReporter::annotateCrashReport("Fission:agent", agentName)
whenever we start receiving a message (start ofrecvRawMessage
);nsICrashReporter::annotateCrashReport("Fission:agent", "")
whenever we're done receiving a message (end ofrecvRawMessage
).
Gabriele, is there a better way?
Comment 7•5 years ago
|
||
That's the simple way. The other way if you have a persistent piece of memory that's holding this is using CrashReporter::RegisterAppMemory()
. However inspecting that is a lot harder on Socorro, because you need to manually download the minidump and analyze it with minidump_dump
, it's not surface any other way.
BTW if you're using annotations and you're in C++ it's better to just use CrashReporter::AnnotateCrashReport()
without going through the XPCOM interface.
Assignee | ||
Comment 8•5 years ago
|
||
Assignee | ||
Comment 9•5 years ago
•
|
||
Thanks.
Attaching a first version. I'm not sure how to best test this.
I guess
- I'll need a mochitest of whichever kind we're using in
dom/ipc/tests/JSWindowActor
; - Create a
JSWindowActor{Child, Parent}
pair; - Send the message
"crash"
to the child; - Make sure that the child does crash;
- From the parent, somehow locate the crash file <-- I've seen the code that does this in a xpcshell, but how do I do this in a mochitest?
- Run the minidump analyzer manually from the parent;
- From the parent, look at the table of annotations;
- Check that we have the right annotations.
Does this make sense? Is there a better way?
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Updated•5 years ago
|
Comment 10•5 years ago
|
||
I have no idea how to test crash annotations, so this is a :gsvelto question.
Comment 11•5 years ago
|
||
BrowserTestUtils.crashFrame()
is what you're looking for. It returns a promise that resolves to an object holding the crash annotations so you can inspect them.
Assignee | ||
Comment 12•5 years ago
|
||
Thanks. Any chance that there is also a way to crash without using an actor, to test that the annotation is not present when we're not in an actor?
Assignee | ||
Comment 13•5 years ago
|
||
Depends on D69993
Comment 14•5 years ago
|
||
(In reply to David Teller [:Yoric] (please use "needinfo") from comment #12)
Thanks. Any chance that there is also a way to crash without using an actor, to test that the annotation is not present when we're not in an actor?
I don't know enough about actors to answer that question :-(
Comment 15•5 years ago
|
||
(In reply to David Teller [:Yoric] (please use "needinfo") from comment #12)
Thanks. Any chance that there is also a way to crash without using an actor, to test that the annotation is not present when we're not in an actor?
Maybe this helps: do_crash is how crashes are generated for xpcshell-tests.
Assignee | ||
Comment 16•5 years ago
|
||
Depends on D70175
Assignee | ||
Comment 17•5 years ago
|
||
This should save (a little) memory and avoid quite a few conversions.
Assignee | ||
Updated•5 years ago
|
Comment 18•5 years ago
|
||
Comment 19•5 years ago
|
||
Backed out 4 changesets (Bug 1605209) for causing browser-chrome failures at dom/ipc/tests/JSWindowActor/browser_crash_report.js
Failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=298064845&repo=autoland&lineNumber=3174
[task 2020-04-17T09:40:49.285Z] 09:40:49 INFO - TEST-START | dom/ipc/tests/JSWindowActor/browser_crash_report.js
[task 2020-04-17T09:40:50.862Z] 09:40:50 INFO - TEST-INFO | started process screentopng
[task 2020-04-17T09:40:51.456Z] 09:40:51 INFO - TEST-INFO | screentopng: exit 0
[task 2020-04-17T09:40:51.457Z] 09:40:51 INFO - Buffered messages logged at 09:40:49
[task 2020-04-17T09:40:51.458Z] 09:40:51 INFO - Entering test bound
[task 2020-04-17T09:40:51.458Z] 09:40:51 INFO - Entering test: crash actor
[task 2020-04-17T09:40:51.459Z] 09:40:51 INFO - Buffered messages logged at 09:40:50
[task 2020-04-17T09:40:51.459Z] 09:40:51 INFO - browser ready
[task 2020-04-17T09:40:51.460Z] 09:40:51 INFO - Cannot test crash annotations without a crash reporter
[task 2020-04-17T09:40:51.460Z] 09:40:51 INFO - Exiting test: crash actor
[task 2020-04-17T09:40:51.461Z] 09:40:51 INFO - Leaving test bound
[task 2020-04-17T09:40:51.462Z] 09:40:51 INFO - Buffered messages finished
[task 2020-04-17T09:40:51.465Z] 09:40:51 INFO - TEST-UNEXPECTED-FAIL | dom/ipc/tests/JSWindowActor/browser_crash_report.js | This test contains no passes, no fails and no todos. Maybe it threw a silent exception? Make sure you use waitForExplicitFinish() if you need it. -
[task 2020-04-17T09:40:51.466Z] 09:40:51 INFO - GECKO(3502) | MEMORY STAT vsizeMaxContiguous not supported in this build configuration.
[task 2020-04-17T09:40:51.469Z] 09:40:51 INFO - GECKO(3502) | MEMORY STAT heapAllocated not supported in this build configuration.
[task 2020-04-17T09:40:51.469Z] 09:40:51 INFO - GECKO(3502) | MEMORY STAT | vsize 20974971MB | residentFast 1114MB
[task 2020-04-17T09:40:51.469Z] 09:40:51 INFO - TEST-OK | dom/ipc/tests/JSWindowActor/browser_crash_report.js | took 1620ms
[task 2020-04-17T09:40:51.469Z] 09:40:51 INFO - checking window state
[task 2020-04-17T09:40:51.469Z] 09:40:51 INFO - GECKO(3502) | must wait for focus
Comment 20•5 years ago
|
||
Comment 21•5 years ago
|
||
Comment 22•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/b2da7e86bdb0
https://hg.mozilla.org/mozilla-central/rev/61b7701d6f58
https://hg.mozilla.org/mozilla-central/rev/dfa9edcdc743
https://hg.mozilla.org/mozilla-central/rev/279da844cdfc
Assignee | ||
Updated•5 years ago
|
Description
•