Closed Bug 639675 Opened 14 years ago Closed 12 years ago

incomplete enumeration of purple roots in DEBUG_CC code

Categories

(Core :: XPCOM, defect)

defect
Not set
minor

Tracking

()

RESOLVED WONTFIX

People

(Reporter: mccr8, Assigned: mccr8)

References

Details

Attachments

(1 file, 2 obsolete files)

User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b12) Gecko/20100101 Firefox/4.0b12 Build Identifier: Trunk When DEBUG_CC is on, the cycle collector (in nsCyclecollector.cpp) enumerates all of the purple roots, for the purpose of logging. Before it does that, it skips over all of the roots added by the runtimes using the following code: while (i++ < purpleStart) { queue.GetNext(); } i and queue are supposed to be advanced in parallel, and both values are use subsequent to this loop, but because of the post-increment i gets incremented one too many times, causing a purple root to be missed. It can be fixed by changing the loop to: while (i < purpleStart) { queue.GetNext(); ++i; } Also, NS_ASSERTION(queue.IsDone()); could be added after the next loop (after the purple loops have been enumerated) to prevent a regression. Reproducible: Always
Cool. Can you patch?
Blocks: 638299
Yes, I just need to grab a clean tree first. I'm a few weeks out of date.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Here's a patch for this bug. I have compiled it (without DEBUG_CC on...), but I haven't tested it yet in an unmodified copy. It only touches DEBUG_CC code so it shouldn't be a problem.
Comment on attachment 517613 [details] [diff] [review] fix off by one error in purple object enumeration peterv, can you land this for Andrew? (he has no commit access yet)
Attachment #517613 - Flags: review?(peterv)
My first patch isn't quite right because NS_ASSERTION takes two arguments. I'll upload a fixed patch once I make sure it actually compiles without new warnings with DEBUG_CC.
Revised version of the patch that has proper number of args to NS_ASSERTION. It compiles both with and without DEBUG_CC without any additional warnings.
Attachment #517613 - Attachment is obsolete: true
Attachment #517613 - Flags: review?(peterv)
Attachment #517786 - Flags: review?(peterv)
Attachment #517613 - Flags: review?(peterv)
Attachment #517613 - Flags: review?(peterv)
Comment on attachment 517786 [details] [diff] [review] revised version of the patch (fixed lack of NS_ASSERTION arg) I will get you access to tracemonkey to land it.
Attachment #517786 - Flags: review?(peterv)
Attachment #517786 - Flags: review+
Attachment #517786 - Flags: feedback?(peterv)
The queue iterator wasn't being advanced when mParams.mLogPointers wasn't being set, which would lead to the assertion failing in that case if DEBUG_CC was on, if there are any purple nodes.
Attachment #517786 - Attachment is obsolete: true
Attachment #517786 - Flags: feedback?(peterv)
Attachment #517919 - Flags: review?(gal)
Attachment #517919 - Flags: feedback?(peterv)
Attachment #517919 - Flags: review?(gal) → review+
There's another instance of this in the cycle collector, near the end of BeginCollection. I should patch that, too I guess.
Attachment #517919 - Flags: feedback?(peterv)
Assignee: nobody → continuation
RIP DEBUG_CC (bug 845441)
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: