Closed
Bug 1246720
Opened 10 years ago
Closed 10 years ago
Ensure that TraceChildren happens under a trace session
Categories
(Core :: JavaScript: GC, defect)
Core
JavaScript: GC
Tracking
()
RESOLVED
INVALID
| Tracking | Status | |
|---|---|---|
| firefox47 | --- | affected |
People
(Reporter: terrence, Assigned: terrence)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
|
4.05 KB,
patch
|
jonco
:
review+
|
Details | Diff | Splinter Review |
The heapState is only actually guarding against concurrent traversal of heap-internal structures, so TraceChildren's traversal of client fields does not technically require guarding. That said, it's more than a little weird to have GC tracing not happen under AutoTraceSession. This fact means that traversal for GC marking has a different isHeapBusy state than traversal for e.g. UnmarkGray barriers. This makes it difficult to add heap-state assertions for paths that happen in both those cases: i.e. the aforementioned tracing.
The attached patch adds an AutoTraceSession to JS::TraceChildren and asserts that js::TraceSession is only called when the heap is busy.
https://treeherder.mozilla.org/#/jobs?repo=try&revision=6d3649f42559
Attachment #8717065 -
Flags: review?(jcoppeard)
Updated•10 years ago
|
Attachment #8717065 -
Flags: review?(jcoppeard) → review+
| Assignee | ||
Comment 1•10 years ago
|
||
| Assignee | ||
Comment 2•10 years ago
|
||
Turns out that the CC can do TraceChildren recursively. It seems to only happen fairly rarely as not everything on Try failed and I didn't see it with just starting up the browser and poking about.
This case is scary enough that I think it warrants a new TraceChildrenWhileTracing API and a way to modify the heap status externally. I wanted to add state guards for CC anyway, so this is probably a good time.
Comment 3•10 years ago
|
||
(In reply to Terrence Cole [:terrence] from comment #2)
> Turns out that the CC can do TraceChildren recursively. It seems to only
> happen fairly rarely as not everything on Try failed and I didn't see it
> with just starting up the browser and poking about.
If a AddToCCKind() GC thing holds onto a non-CC kind GC thing, we trace through the latter recursively (and add anything that it holds onto to the former) so as to not need to add the non-CC kind thing to the CC graph. I think the idea is there are a bunch of shape etc. things that can blow up the graph.
| Assignee | ||
Comment 4•10 years ago
|
||
Shapes and ObjectGroups appear to be handled with special cases that end up using the internal js::TraceChildren and create their own heap session. So I guess this would only be used for Objects that have a Class::trace that holds onto strings or something?
Comment 5•10 years ago
|
||
(In reply to Terrence Cole [:terrence] from comment #4)
> So I guess this would only be used for Objects that have a Class::trace that
> holds onto strings or something?
String should not be traced in CC stuff because they can never hold onto CC things. If you look through places that CycleCollectedJSRuntime calls TraceChildren, you can see that they are mostly guarded to not call it when there is a string.
However, I was looking at the code right now and it appears we have a bug in NoteWeakMapsTracer::trace():
if (aValue.is<JSString>()) {
JS::TraceChildren(&mChildTracer, aValue);
}
This should be guarded on !aValue.is<JSString>().
It looks like this was accidentally dropped in bug 1105069:
http://hg.mozilla.org/mozilla-central/rev/aa2a54fffd77
Maybe that accounts for at least some of the failures you are seeing.
| Assignee | ||
Comment 6•10 years ago
|
||
Hurm, the more I look at it, the more I think tracing was just not meant to be done under an AutoTraceSession. Another example of poor naming from the long-ago-before-time..
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•