Closed Bug 502687 Opened 15 years ago Closed 15 years ago

GCGraphBuilder::AddNode crashes on OOM

Categories

(Core :: XPCOM, defect, P2)

defect

Tracking

()

VERIFIED FIXED
mozilla1.9.2
Tracking Status
status1.9.2 --- beta1-fixed
blocking1.9.1 --- .8+
status1.9.1 --- .8-fixed

People

(Reporter: mrbkap, Assigned: mrbkap)

References

Details

(Keywords: verified1.9.0.18, verified1.9.1, verified1.9.2)

Attachments

(1 file)

The code looks like:

    PtrToNodeEntry *e = static_cast<PtrToNodeEntry*>(PL_DHashTableOperate(&mPtrToNodeMap, s, PL_DHASH_ADD));
    PtrInfo *result;
    if (!e->mNode) {

but PL_DHASH_ADD returns NULL on OOM. The function already returns null in some cases, so callers should be mostly null safe. dbaron thinks that failure to add a node should result in leaks (as opposed to overreleasing).
Attached patch Proposed fixSplinter Review
I don't know how to test for this, but it does compile!
Assignee: nobody → mrbkap
Status: NEW → ASSIGNED
Attachment #387035 - Flags: superreview?(dbaron)
Attachment #387035 - Flags: review?(dbaron)
Comment on attachment 387035 [details] [diff] [review]
Proposed fix

r=dbaron
Attachment #387035 - Flags: superreview?(dbaron)
Attachment #387035 - Flags: review?(dbaron)
Attachment #387035 - Flags: review+
http://hg.mozilla.org/mozilla-central/rev/b0a681cd9df5
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
(In reply to comment #0)
> dbaron thinks that failure to add
> a node should result in leaks (as opposed to overreleasing).

I'm not convinced that that's true, XPConnect relies on the cycle collector traversing all of the XPConnect objects holding JS things. If we fail to add any of those, they will not get marked (whether they're live or not) and will be finalized. Something needs to signal this failure to XPConnect, so that it just marks all the JS things held by XPConnect objects. See also bug 460916.
Actually, this might be fine. The key is that we won't try to unlink the XPConnect objects, so they will all mark their JS object after CC.
We should take this on branches, we've sometimes seen this cause crashes with the testcase in bug 533000 (the testcase probably triggers it faster because it manages to use up much more memory quickly).
blocking1.9.1: --- → ?
Flags: blocking1.9.2?
Attachment #387035 - Flags: approval1.9.1.7?
Yeah, no reason not to block on this.
Flags: blocking1.9.2? → blocking1.9.2+
Priority: -- → P2
Target Milestone: --- → mozilla1.9.2
Turns out this was fixed on trunk before branching for 1.9.2, still need it on 1.9.1 though.
Cycle collector exists on the 1.9.0 branch, do we need this there too?
blocking1.9.1: ? → .7+
Flags: wanted1.9.0.x?
Flags: blocking1.9.0.17?
Comment on attachment 387035 [details] [diff] [review]
Proposed fix

Approved for 1.9.1.7, a=dveditz for release-drivers
Attachment #387035 - Flags: approval1.9.1.7? → approval1.9.1.7+
Comment on attachment 387035 [details] [diff] [review]
Proposed fix

Yeah, we should just take this on 1.9.0.
Attachment #387035 - Flags: approval1.9.0.17?
Flags: wanted1.9.0.x?
Flags: wanted1.9.0.x+
Flags: blocking1.9.0.18?
Flags: blocking1.9.0.18+
Comment on attachment 387035 [details] [diff] [review]
Proposed fix

Approved for 1.9.0.18, a=dveditz for release-drivers
Attachment #387035 - Flags: approval1.9.0.18? → approval1.9.0.18+
Whiteboard: [needs 1.9.0 landing]
Checked in for 1.9.0.x.
Keywords: fixed1.9.0.18
Whiteboard: [needs 1.9.0 landing]
Given by Blake's comment 1 we do not have a test and do not know how to test it. So QA can only verify this fix based on the check-ins on all branches. I have checked mozilla1.9.2, mozilla1.9.1, and mozilla1.9.0 for existence of this null pointer check. All look fine. Means I will mark all branches as verified fixed.
Status: RESOLVED → VERIFIED
OS: Linux → All
Hardware: x86 → All
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: