Closed Bug 108046 Opened 24 years ago Closed 24 years ago

DNSService Shutdown uses getService; suggest registering WeakRef

Categories

(Core :: Networking, defect, P1)

x86
Windows NT
defect

Tracking

()

VERIFIED FIXED
mozilla0.9.9

People

(Reporter: depman1, Assigned: gordon)

References

Details

(Whiteboard: patch)

Attachments

(1 file)

reproduced in 10/27 debug mozilla build. this is causing a warning message when shutting down mozilla. see bug 107391. 1. Set break points in nsWarning messages in nsComponentManager.cpp; nsComponentManagerImpl::GetService() and nsComponentManagerImpl::GetServiceByContractID() (currently lines 1750 & 2075). 2. Launch Mozilla with F5. 3. Quit Mozilla. 4. F5 until you see stack trace including destructor for nsIOService() 5. Doubleclick on 3 lines above ~nsIOService(): nsDNSService::RemovePrefObserver() line 1178 + 30 bytes Result: Creates nsIPrefService object by calling do_GetService() to shutdown DNSService service. Suggest registering a weakReference and using it to shutdown service.
Blocks: 107391
Here's the source in nsDnsService.cpp for RemovePrefObserver(): nsresult nsDNSService::RemovePrefObserver() { nsresult rv, rv2; nsCOMPtr<nsIPrefService> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv); if (NS_FAILED(rv)) return rv; nsCOMPtr<nsIPrefBranchInternal> prefInternal = do_QueryInterface(prefs, &rv); if (NS_FAILED(rv)) return rv; rv = prefInternal->RemoveObserver(NETWORK_ENABLEIDN, this); if (NS_FAILED(rv)) return rv; rv = prefInternal->RemoveObserver(NETWORK_DNS_CACHE_ENTRIES, this); rv2 = prefInternal->RemoveObserver(NETWORK_DNS_CACHE_EXPIRATION, this); return NS_FAILED(rv) ? rv : rv2; }
-> gordon
Assignee: neeti → gordon
Targeting for necko stability milestone 0.9.8.
Target Milestone: --- → mozilla0.9.8
Doug, according to dp's comment (#6) in bug 107391, this is correct pattern to be using. Can we just close this bug?
Target Milestone: mozilla0.9.8 → mozilla0.9.9
The only problem is if we do not correct this pattern, we will have to wade through many false positives.
Priority: -- → P1
Keywords: nsbeta1+
Darin, Doug, can you r/sr?
Whiteboard: patch
Comment on attachment 69538 [details] [diff] [review] proposed patch adding weak reference to pref service. r=dougt
Attachment #69538 - Flags: review+
Comment on attachment 69538 [details] [diff] [review] proposed patch adding weak reference to pref service. sr=darin
Attachment #69538 - Flags: superreview+
Patch checked in. Marking FIXED.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
David: Can you try your steps again and verify if it is gone?
Keywords: verifyme
Verified patch wrt to Mozilla 0.9.9 3/19/02 debug build. Looks fine. With steps above, nsDNSService::RemovePrefObserver()isn't in the shutdown call stack; getService() not used for dns service shutdown.
Status: RESOLVED → VERIFIED
Keywords: verifyme
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: