Closed Bug 334605 Opened 19 years ago Closed 19 years ago

balsa orange due to atom table shutdown code

Categories

(Core :: XPCOM, defect, P1)

x86
Linux
defect

Tracking

()

RESOLVED FIXED
mozilla1.8.1alpha2

People

(Reporter: dbaron, Assigned: dbaron)

References

Details

(Keywords: fixed1.8.1, Whiteboard: [patch])

Attachments

(1 file)

Balsa is orange due to the assertions added in bug 334180, due to a bug in the atom table shutdown code that I wrote (perhaps compiler-bug-sensitive). Calling virtual functions in the destructor of a base class isn't (IIRC) guaranteed or even supposed to call the function on the derived class. (mrbkap, is that right?) In any case, the following patch makes IsPermanent non-virtual so that it doesn't fire in the destructor. This is actually a pretty nasty bug.
Attached patch patchSplinter Review
Attachment #218957 - Flags: superreview?(brendan)
Attachment #218957 - Flags: review?(mrbkap)
Attachment #218957 - Flags: approval-branch-1.8.1?(brendan)
Status: NEW → ASSIGNED
Flags: blocking1.8.1?
Priority: -- → P1
Whiteboard: [patch]
Target Milestone: --- → mozilla1.8.1alpha2
(That said, I'm honestly not sure what code still uses permanent atoms.)
Comment on attachment 218957 [details] [diff] [review] patch - Index: nsAtomTable.cpp >+PermanentAtomImpl::PermanentAtomImpl() >+ : AtomImpl() Why bother calling the default constructor by hand? I'm not sure what the C++ standard has to say about this, but it seems like calling virtual functions from a base class' destructor is asking for trouble since the more derived class' destructor has already run.
Attachment #218957 - Flags: review?(mrbkap) → review+
(In reply to comment #3) > Why bother calling the default constructor by hand? AIX had trouble with it at one point and it doesn't hurt?
Comment on attachment 218957 [details] [diff] [review] patch rs=me. /be
Attachment #218957 - Flags: superreview?(brendan) → superreview+
Checked in to trunk, 2006-04-19 14:46 -0700. (But not 1.8 branch yet.)
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Comment on attachment 218957 [details] [diff] [review] patch brendan gave verbal approval-branch-1.8.1
Attachment #218957 - Flags: approval-branch-1.8.1?(brendan) → approval-branch-1.8.1+
Fix checked in to MOZILLA_1_8_BRANCH.
Keywords: fixed1.8.1
> (That said, I'm honestly not sure what code still uses permanent atoms.) The only non-test code in mozilla.org cvs on trunk that does is the code that runs when someone registers a static atom with the same name as an already-existing (in the table) non-static atom. We call PromoteToPermanent in that case. If we figured out a different way to do that, we could nix permanent atoms. We should consider nixing them from nsIAtom and nsIAtomService in any case....
This patch is actually threadsafe. If thread A calls addref or release on an atom at the same time as thread B calls PromoteToPermanent, there's a risk that thread B will set mRefCnt to REFCNT_PERMANENT_SENTINEL and then thread A increases or decreases it by one. Note that thread A doesn't necessarily have to be in addref/release, it might just have read the vtable pointer but not called the function yet. This problem didn't used to exist since it didn't matter if the refcount was modified a bit from other threads even after the atom was marked permanent.
Filed bug 335734 on threadsafety problems.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: