Closed Bug 1268215 Opened 8 years ago Closed 8 years ago

Make CCGraphBuilder::AddNode fallible

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla49
Tracking Status
firefox49 --- fixed

People

(Reporter: erahm, Assigned: erahm)

Details

Attachments

(1 file)

+++ This bug was initially created as a clone of Bug #1144649 +++

Currently |CCGraphBuilder::AddNode| is half fallible. The |AddNodeToMap| call [1] is fallible, but further down the |mNodeBuilder.Add| [2] call is infallible. This ends up doing a rather large allocation (~160K on 32-bit) [3] if a new block is needed.

FWIW I saw this show up in a OOM crash.

[1] https://dxr.mozilla.org/mozilla-central/rev/fc15477ce628599519cb0055f52cc195d640dc94/xpcom/base/nsCycleCollector.cpp#2210
[2] https://dxr.mozilla.org/mozilla-central/rev/fc15477ce628599519cb0055f52cc195d640dc94/xpcom/base/nsCycleCollector.cpp#2218
[3] https://dxr.mozilla.org/mozilla-central/rev/fc15477ce628599519cb0055f52cc195d640dc94/xpcom/base/nsCycleCollector.cpp#707
Severity: critical → normal
OS: Windows 7 → Unspecified
Hardware: x86 → Unspecified
Version: 38 Branch → Trunk
Attachment #8746184 - Flags: review?(continuation)
Assignee: nobody → erahm
Status: NEW → ASSIGNED
It looks like that I removed this in bug 864344, because NS_Alloc is infallible.

I'm not sure this is a good idea. It looks like the CC will just keep running rather than aborting if this happens. Analyzing a partial CC graph can result in the CC thinking that objects that are being held alive by JS are actually dead, which can result in null pointer derefs in random code.
(In reply to Andrew McCreight [:mccr8] from comment #2)
> It looks like that I removed this in bug 864344, because NS_Alloc is
> infallible.
> 
> I'm not sure this is a good idea. It looks like the CC will just keep
> running rather than aborting if this happens. Analyzing a partial CC graph
> can result in the CC thinking that objects that are being held alive by JS
> are actually dead, which can result in null pointer derefs in random code.

Okay, but just to be clear you made it kind of fallible in bug 1144649 (so more recently). Should we just make that infallible again?

I suppose we could also reduce the block size instead...
Comment on attachment 8746184 [details] [diff] [review]
Make CCGraphBuilder::AddNode fallible

Yeah, I guess it can't make things much worse. Reducing the size a bit might also be nice, but really I feel like the hash table is almost always going to be much bigger than one of these blocks.
Attachment #8746184 - Flags: review?(continuation) → review+
https://hg.mozilla.org/mozilla-central/rev/984b9c1f5c15
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: