Closed Bug 462497 Opened 16 years ago Closed 16 years ago

nsComponentManagerImpl::HashContractID() reenters mMon

Categories

(Core :: XPCOM, defect)

defect
Not set
trivial

Tracking

()

RESOLVED FIXED
mozilla1.9.2a1

People

(Reporter: ynvich, Assigned: ynvich)

References

Details

(Keywords: fixed1.9.1, perf)

Attachments

(1 file, 4 obsolete files)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.3) Gecko/2008092816 Iceweasel/3.0.3 (Debian-3.0.3-3)
Build Identifier: trunk

nsComponentManagerImpl::HashContractID() is only called when mMon is already entered, so its re-entrance is probably excessive. Removing this should slightly reduce Ts.

Reproducible: Always




Patch follows.
Attached patch patch v1.0 (obsolete) (deleted) — Splinter Review
Patch removes |nsAutoMonitor| from  |nsComponentManagerImpl::HashContractID()|.
Attachment #345687 - Flags: review?(benjamin)
Comment on attachment 345687 [details] [diff] [review]
patch v1.0

The patch looks correct, but please document in the header that this method must only be called while the monitor is held (and ideally assert this is true, but I don't think NSPR has that capability currently)
Attachment #345687 - Flags: review?(benjamin) → review-
Attached patch patch v2.0 [Backout: Comment 8] (obsolete) (deleted) — Splinter Review
Patch:
* adds a comment in xpcom/components/nsComponentManager.h;
* adds an assertion using PR_GetMonitorEntryCount().
Attachment #345687 - Attachment is obsolete: true
Attachment #346107 - Flags: review?(benjamin)
Comment on attachment 346107 [details] [diff] [review]
patch v2.0
[Backout: Comment 8]

thanks!
Attachment #346107 - Flags: review?(benjamin) → review+
Keywords: checkin-needed, perf
Attachment #346107 - Flags: approval1.9.1b2?
Assignee: nobody → ynvich
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Keywords: checkin-needed
Comment on attachment 346107 [details] [diff] [review]
patch v2.0
[Backout: Comment 8]

We'll get this after beta 2
Attachment #346107 - Flags: approval1.9.1b2? → approval1.9.1b2-
Comment on attachment 346107 [details] [diff] [review]
patch v2.0
[Backout: Comment 8]

a191=beltzner who likes Ts wins
Keywords: checkin-needed
Comment on attachment 346107 [details] [diff] [review]
patch v2.0
[Backout: Comment 8]

http://hg.mozilla.org/mozilla-central/rev/8b5a38ba459a
Attachment #346107 - Attachment description: patch v2.0 → patch v2.0 [Checkin: Comment 7]
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Whiteboard: [c-n: baking for 1.9.1]
Target Milestone: --- → mozilla1.9.2a1
Version: unspecified → Trunk
Status: RESOLVED → REOPENED
Keywords: checkin-needed
Resolution: FIXED → ---
Whiteboard: [c-n: baking for 1.9.1]
Comment on attachment 346107 [details] [diff] [review]
patch v2.0
[Backout: Comment 8]

Backed out:
http://hg.mozilla.org/mozilla-central/rev/efe3c6f76bca
http://hg.mozilla.org/mozilla-central/rev/e45938aee309
See for example:
{
http://tinderbox.mozilla.org/showlog.cgi?log=Firefox/1229736880.1229736940.3072.gz
Linux mozilla-central leak test build on 2008/12/19 17:34:40

/builds/moz2_slave/mozilla-central-linux-debug/build/xpcom/components/nsComponentManager.cpp: In member function ‘nsresult nsComponentManagerImpl::HashContractID(const char*, PRUint32, nsFactoryEntry*)’:
/builds/moz2_slave/mozilla-central-linux-debug/build/xpcom/components/nsComponentManager.cpp:1301: error: ‘PR_GetMonitorEntryCount’ was not declared in this scope

/builds/moz2_slave/mozilla-central-linux-debug/build/xpcom/components/nsComponentManager.cpp: In member function ‘nsIModuleLoader* nsComponentManagerImpl::LoaderForType(LoaderType)’:
/builds/moz2_slave/mozilla-central-linux-debug/build/xpcom/components/nsComponentManager.cpp:2702: warning: comparison between signed and unsigned integer expressions
/builds/moz2_slave/mozilla-central-linux-debug/build/xpcom/components/nsComponentManager.cpp: In member function ‘void nsComponentManagerImpl::LoadDeferredModules(nsTArray<DeferredModule>&)’:
/builds/moz2_slave/mozilla-central-linux-debug/build/xpcom/components/nsComponentManager.cpp:3124: warning: comparison between signed and unsigned integer expressions
/builds/moz2_slave/mozilla-central-linux-debug/build/xpcom/components/nsComponentManager.cpp: In member function ‘virtual nsresult nsComponentManagerImpl::AutoUnregisterComponent(PRInt32, nsIFile*)’:
/builds/moz2_slave/mozilla-central-linux-debug/build/xpcom/components/nsComponentManager.cpp:3166: warning: comparison between signed and unsigned integer expressions
}

NB: The 3 warnings are probably not yours, but if you could have a look at them too...
Attachment #346107 - Attachment description: patch v2.0 [Checkin: Comment 7] → patch v2.0 [Backout: Comment 8]
Attached patch patch v2.1 (obsolete) (deleted) — Splinter Review
* fixed debug build by including "private/pprthred.h"
* fixed signed/unsigned mismatch warnings

Can r+/a+ be carried over in this situation?
Attachment #346107 - Attachment is obsolete: true
Attachment #353965 - Flags: review?(benjamin)
Attachment #353965 - Flags: approval1.9.1?
Comment on attachment 353965 [details] [diff] [review]
patch v2.1

>diff --git a/xpcom/components/nsComponentManager.cpp b/xpcom/components/nsComponentManager.cpp

>+/* Linux/Win32 export private NSPR files to include/private */
>+#ifdef XP_MAC

XP_MAC is dead (was MacOS9)
Attachment #353965 - Flags: review?(benjamin)
Attachment #353965 - Flags: review-
Attachment #353965 - Flags: approval1.9.1?
(In reply to comment #10)
> XP_MAC is dead (was MacOS9)

Any comments how it should look like instead? I copied the include block from here:
http://mxr.mozilla.org/mozilla/source/xpcom/base/nsGarbageCollector.c#54
Attached patch patch v2.2 (obsolete) (deleted) — Splinter Review
* plainly include "private/pprthred.h", following this:
 http://mxr.mozilla.org/mozilla/source/netwerk/base/src/nsFileStreams.cpp#49

* use special macro PR_InMonitor() instead of PR_GetMonitorEntryCount()
Attachment #353965 - Attachment is obsolete: true
Attachment #354404 - Flags: review?(benjamin)
Attachment #354404 - Flags: approval1.9.1?
Comment on attachment 354404 [details] [diff] [review]
patch v2.2

Please only ask for 1.9.1-approval once you've gotten review and the patch has landed on mozilla-central.
Attachment #354404 - Flags: approval1.9.1?
Comment on attachment 354404 [details] [diff] [review]
patch v2.2

>diff --git a/nsprpub/configure b/nsprpub/configure

Extraneous change?

>diff --git a/xpcom/components/nsComponentManager.cpp b/xpcom/components/nsComponentManager.cpp

>-    nsAutoMonitor mon(mMon);
>+    NS_ASSERTION(PR_InMonitor(mMon), "called from outside mMon");
> 

Go ahead and make this NS_ABORT_IF_FALSE, here and below.

>@@ -3163,7 +3164,7 @@ nsComponentManagerImpl::AutoUnregisterComponent(PRInt32 /* unused */,
>     nsCOMPtr<nsIModule> module;
>     rv = mNativeModuleLoader.LoadModule(lf, getter_AddRefs(module));
>     if (NS_FAILED(rv)) {
>-        for (LoaderType i = 0; i < mLoaderData.Length(); ++i) {
>+        for (LoaderType i = 0; (PRUint32) i < mLoaderData.Length(); ++i) {

I don't like ridealong changes... please put this in a separate bug/patch. Also, I prefer C++ initializations instead of C-style casts, so

PRUint32(i) < mLoaderData.Length()

The core of this patch looks good. Give me a clean one and I can r+ it right away!
Attachment #354404 - Flags: review?(benjamin) → review-
Attached patch patch v2.3 (deleted) — Splinter Review
* uses NS_ABORT_IF_FALSE instead of NS_ASSERTION;
* leaves out warning fixes.
Attachment #354404 - Attachment is obsolete: true
Attachment #355550 - Flags: review?(benjamin)
Attachment #355550 - Flags: review?(benjamin) → review+
Keywords: checkin-needed
Pushed fc85349c89b4
Status: REOPENED → RESOLVED
Closed: 16 years ago16 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Depends on: 472753
Keywords: checkin-needed
http://hg.mozilla.org/releases/mozilla-1.9.1/rev/7d740ae63d5c
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: