Closed Bug 650858 Opened 13 years ago Closed 13 years ago

Instantiating nsICertOverrideService at startup throws NS_ERROR_XPC_GS_RETURNED_FAILURE and makes Firefox unusable

Categories

(Core :: Security: PSM, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
firefox5 + unaffected
firefox6 + unaffected
firefox7 + unaffected
firefox8 + fixed
firefox9 - affected
firefox10 - affected

People

(Reporter: chofmann, Assigned: briansmith)

References

Details

(Keywords: regression, Whiteboard: [may need backout like 5 got])

Attachments

(3 files)

I was running an aurora build from a few days ago.
Got the update offer.
Accepted it, and said ok to restart.

Aurrora restarts, but when it comes back up I get:
 my two app tabs that have no content loads, 
 a new tab that has no content.  
 typing a url in location bar of any of these tabs, or a new tab doesn't respond with loading any content.  
 Quit Aurora kills the window but leaves the process behind.
 need to force quit to kill off the process

restart aurora results in the same problems.

but interestingly I've found that if I start firefox 4.0, quit, then start aurora again, aurora works fine.

I think this basic pattern has happened to me twice now with the last two update offers.
if this is happening to more than just me it would be a serious blocker.
Please attach the last-update.log file which is located inside the Mac app bundle in the Contents/MacOS/updates directory.
I just updated from the 14th build to the following build without any problems whatsoever. 

Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:5.0a2) Gecko/20110418 Firefox/5.0a2

Also, the fact that your build starts working after switching profiles makes me think it is something with your profile that is causing the problem.

Moving over to General since this doesn't appear to be a toolkit -> app update or Firefox -> installer bug.
Component: Installer → General
QA Contact: installer → general
Summary: problems with updates on aurora → problems after updating on aurora
btw: if you attach the last-update.log I'll double check if there were any problems with the update
Attachment #526846 - Attachment mime type: application/octet-stream → text/plain
Comment on attachment 526846 [details]
last-update.log from this moring

The update completed successfully without any issues which further leads me to believe this has nothing to do with app update and is likely something to do with the profile.
Keywords: qawanted
updated to: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:5.0a2) Gecko/20110419 Firefox/5.0a2 just now and it happened again.

several tabs seemed like they tried to make a network connection to zimbra, gmail, and a few other tabs I had open from previous session, but timed out.  Other tabs showed the url they were trying to load but just a white page.

attempting to reload any of the tabs or load another page got no response.
no diff between contents of the previously posted last-update.log and results returned from this update.

does that non-fatal error show up much?

FINISH REMOVEDIR Contents/MacOS/searchplugins/
non-fatal error removing directory: Contents/MacOS/searchplugins/, rv: 0, err: 66
succeeded
calling QuitProgressUI
(In reply to comment #8)
> no diff between contents of the previously posted last-update.log and results
> returned from this update.
> 
> does that non-fatal error show up much?
> 
> FINISH REMOVEDIR Contents/MacOS/searchplugins/
> non-fatal error removing directory: Contents/MacOS/searchplugins/, rv: 0, err:
> 66
> succeeded
> calling QuitProgressUI
Yes and it is a non issue. rmdir instructions are for removing empty directories and the searchplugins directory is not empty. The instruction is in the Firefox removed-files.in file and can be removed but is not a problem. I or someone else will probably remove it as part of bug 649607.
Chris, could you try recreating this bug with a new profile without any modifications so we can try to eliminate whether it is something in your profile causing this?
This happened to me too, with Aurora 5.0a2. No idea if that's related, but applying an update makes Aurora to restart and quit immediately (I can barely see the window opening and tabs loading their content, before it quits).
(In reply to comment #11)
> This happened to me too, with Aurora 5.0a2. No idea if that's related, but
> applying an update makes Aurora to restart and quit immediately (I can barely
> see the window opening and tabs loading their content, before it quits).
Can you try the steps in comment #10?
Doing a quick test, I couldn't reproduce the problem with a new profile and no plugins and no addons.
found some steps that might help to understand whats going on.

doesn't look like its connected to update at all, but trying to go from an old aurora session, shutting that down, then trying to start aurora again.

on starting that second session rob and I found this message in the error console:

Error: gBrowser.addProgressListener was called with a second argument, which is not supported. See bug 608628.
Source File: chrome://browser/content/tabbrowser.xml
Line: 1840

We also found if we disabled the perspectives addon (ver 4.1) that got rid of the problem and I'm able to go from one aurora session to another smoothly, without having to start up firefox 4 to get aurora started again.

the next step is to figure out if there other addons other than perspectives that might cause this problem, and if the fix needs to come on the addon side, or if there is something that we can do in firefox.
As Dao mentioned in the other bug, that exception is non-fatal, so it shouldn't be causing any of these symptoms.
Might be something else that this add-on is doing then since everything worked fine after disabling only that one add-on.
Summary: problems after updating on aurora → problems after updating on aurora with the perspectives addon
According to https://addons.mozilla.org/en-US/firefox/addon/perspectives/ the Perspectives add-on only has a few tens of thousands of downloads and it's not compatible with Firefox after version 4.0.*  If the problem is limited to that add-on, I think we can safely stop tracking this. We have much larger fish to fry.
Dao, can you explain exactly why we don't need to worry about this? Have we figured out exactly why perspectives is breaking?
Assignee: nobody → dao
Perspectives is now marked compatible with Firefox 5.*

I suspect that was auto-bumped, and if it's not true we should revert it back to 4.0.* and be done with it.
(In reply to comment #18)
> Dao, can you explain exactly why we don't need to worry about this? Have we
> figured out exactly why perspectives is breaking?

Other than ruling out bug 608628, no, and I don't think it's good use of developer time to review random extensions. As things stand, there's no reason to believe that this is a Firefox bug. Someone should notify the add-on developer, who can report back when hitting a bug in our code base.
(In reply to comment #19)
> Perspectives is now marked compatible with Firefox 5.*
> 
> I suspect that was auto-bumped, and if it's not true we should revert it
> back to 4.0.* and be done with it.

I believe Jorge is the right person for this.
Assignee: dao → jorge
Component: General → Compatibility Tools
Product: Firefox → addons.mozilla.org
QA Contact: general → compatibility
Keywords: qawanted
I did the following:

1) Install Perspectives in Firefox 4.0.1
2) Set up a couple of App Tabs.
3) Close and open the same profile using Aurora.

This didn't trigger the error. However, coincidentally I had an Aurora update in line and installed it. After the restart I did see the problem with the app tabs.

The following errors appeared in the Error Console:

Error: uncaught exception: [Exception... "Component returned failure code: 0x80570016 (NS_ERROR_XPC_GS_RETURNED_FAILURE) [nsIJSCID.getService]"  nsresult: "0x80570016 (NS_ERROR_XPC_GS_RETURNED_FAILURE)"  location: "JS frame :: chrome://perspectives/content/notaries.js :: <TOP_LEVEL> :: line 22"  data: no]

Error: Perspectives is undefined
Source File: chrome://perspectives/content/initialize.xul
Line: 7

Error: uncaught exception: [Exception... "Component returned failure code: 0x80570016 (NS_ERROR_XPC_GS_RETURNED_FAILURE) [nsIJSCID.getService]"  nsresult: "0x80570016 (NS_ERROR_XPC_GS_RETURNED_FAILURE)"  location: "JS frame :: resource:///components/nsUrlClassifierListManager.js :: PROT_ListManager :: line 81"  data: no]

I did this a few times with Beta and Aurora, with the same result. After installing, the first restart (when the add-on is installed) worked ok, but the next restart would trigger the error permanently, until the add-on is removed. The same errors appeared in the console. This doesn't happen in Firefox 4.

Any ideas behind these errors?
I reverted the compatibility upgrade for the add-on and notified the developer.
The line in the add-on the first error is pointing to has the following:

overrideService :
  Components.classes["@mozilla.org/security/certoverride;1"]
  .getService(Components.interfaces.nsICertOverrideService)

Trying to instantiate the component on Beta using the Error Console works as expected, so it may be something that only happens at startup.
Hi folks,  I'm one of the developers of Perspectives.  I had actually been running Perspectives fine with one of the previous 5.0 beta downloads that I got directly from the website, but the auto-update I got this morning actually broke things.  I also had a report of this issue from several other users, but until today had been unable to reproduce.  

I am traveling right now, but will try to reproduce or debug over the weekend.  Anyone who has ideas of likely causes, please let me know :)
no longer tracking for firefox 5
Attached file Minimal testcase
This bug is a regression in Firefox 5, at least to the extent that it wasn't the case that instantiating certain components at startup could break Firefox entirely. Looking at the commit log for this component, I suspect that this regression is caused by the fixes in bug 645263. That bug touches several components that could also be affected by this.

I'm attaching a minimal testcase. All this add-on does is instantiate the component. The bug is always reproduced in 5, but not in 4. Wrapping the statement in a load event handler fixes the problem. So, instantiating this component throws when the script is being loaded, but not after the window has loaded.

While I expect the occurrence of this bug to be rare, it should still be looked at. It's unclear to me how many components and add-ons are affected by this.
Assignee: jorge → nobody
Component: Compatibility Tools → XPCOM
Product: addons.mozilla.org → Core
QA Contact: compatibility → xpcom
Moving to XPCOM component.
Summary: problems after updating on aurora with the perspectives addon → Instantiating nsICertOverrideService at startup throws NS_ERROR_XPC_GS_RETURNED_FAILURE and makes Firefox unusable
What is the regression range, and why do you suspect bug 645263? It looks almost entirely unrelated.
I don't have a regression range.

This is the log of the implementation file for this component: https://hg.mozilla.org/releases/mozilla-beta/log/tip/security/manager/ssl/src/nsCertOverrideService.cpp. The only recent patches for it are from bug 644070 and bug 645263. Looking at both of them, I noticed the latter was the only one making changes to the constructor, so I thought that was the most likely candidate.
This doesn't appear to have anything to do directly with the cert override service: we end up calling nsPSMInitPanic::SetPanic in nsNSSComponent::InitializeNSS. More details to come.
Component: XPCOM → General
QA Contact: xpcom → general
Benjamin: Is this an unexpected regression? Should we wait on building beta until we know what caused this?
If this is only triggered by the perspectives addon, then I wouldn't worry about it.
I don't think we know that, it's the only one we've heard about but that doesn't mean it's the only on affected.
 	xul.dll!RealBreak()  Line 413	C++
 	xul.dll!Break(aMsg=0x004ab2b0)  Line 512	C++
 	xul.dll!NS_DebugBreak_P(aSeverity=0x00000001, aStr=0x68c43584, aExpr=0x68c4357c, aFile=0x68c43510, aLine=0x00000678)  Line 380	C++
 	xul.dll!nsComponentManagerImpl::GetServiceByContractID(aContractID=0x68957bb8, aIID={...}, result=0x004ab76c)  Line 1656	C++
 	xul.dll!CallGetService(aContractID=0x68957bb8, aIID={...}, aResult=0x004ab76c)  Line 95	C++
 	xul.dll!nsGetServiceByContractIDWithError::operator()(aIID={...}, aInstancePtr=0x004ab76c)  Line 288	C++
 	xul.dll!nsCOMPtr<nsICertOverrideService>::assign_from_gs_contractid_with_error(gs={...}, aIID={...})  Line 1262	C++
 	xul.dll!nsCOMPtr<nsICertOverrideService>::nsCOMPtr<nsICertOverrideService>(gs={...})  Line 636	C++
>	xul.dll!nsNSSComponent::InitializeNSS(showWarningBox=0x00000001)  Line 1697	C++
 	xul.dll!nsNSSComponent::Init()  Line 1980	C++
 	xul.dll!nsNSSComponentConstructor(aOuter=0x00000000, aIID={...}, aResult=0x004aba1c)  Line 212	C++
 	xul.dll!mozilla::GenericFactory::CreateInstance(aOuter=0x00000000, aIID={...}, aResult=0x004aba1c)  Line 48	C++
 	xul.dll!nsComponentManagerImpl::CreateInstanceByContractID(aContractID=0x68956b64, aDelegate=0x00000000, aIID={...}, aResult=0x004aba1c)  Line 1295	C++
 	xul.dll!nsComponentManagerImpl::GetServiceByContractID(aContractID=0x68956b64, aIID={...}, result=0x004aba74)  Line 1697	C++
 	xul.dll!CallGetService(aContractID=0x68956b64, aIID={...}, aResult=0x004aba74)  Line 95	C++
 	xul.dll!nsGetServiceByContractID::operator()(aIID={...}, aInstancePtr=0x004aba74)  Line 278	C++
 	xul.dll!nsCOMPtr<nsINSSComponent>::assign_from_gs_contractid(gs={...}, aIID={...})  Line 1252	C++
 	xul.dll!nsCOMPtr<nsINSSComponent>::nsCOMPtr<nsINSSComponent>(gs={...})  Line 628	C++
 	xul.dll!EnsureNSSInitialized(op=nssEnsure)  Line 352	C++
 	xul.dll!nsCertOverrideServiceConstructor(aOuter=0x00000000, aIID={...}, aResult=0x004abb94)  Line 250	C++
 	xul.dll!mozilla::GenericFactory::CreateInstance(aOuter=0x00000000, aIID={...}, aResult=0x004abb94)  Line 48	C++
 	xul.dll!nsComponentManagerImpl::CreateInstance(aClass={...}, aDelegate=0x00000000, aIID={...}, aResult=0x004abb94)  Line 1208	C++
 	xul.dll!nsComponentManagerImpl::GetService(aClass={...}, aIID={...}, result=0x004abc04)  Line 1501	C++
 	xul.dll!nsJSCID::GetService(_retval=0x004abccc)  Line 839	C++
 	xul.dll!NS_InvokeByIndex_P(that=0x07dd8148, methodIndex=0x0000000b, paramCount=0x00000001, params=0x004abccc)  Line 103	C++
 	xul.dll!CallMethodHelper::Invoke()  Line 3151	C++
 	xul.dll!CallMethodHelper::Call()  Line 2417	C++
 	xul.dll!XPCWrappedNative::CallMethod(ccx={...}, mode=CALL_METHOD)  Line 2381	C++
 	xul.dll!XPC_WN_CallMethod(cx=0x0792bdb8, argc=0x00000001, vp=0x06c10060)  Line 1607	C++
 	mozjs.dll!js::CallJSNative(cx=0x0792bdb8, native=0x6761ee00, argc=0x00000001, vp=0x06c10060)  Line 277	C++
 	mozjs.dll!js::Interpret(cx=0x0792bdb8, entryFrame=0x06c10030, interpMode=JSINTERP_NORMAL)  Line 4676	C++
 	mozjs.dll!js::RunScript(cx=0x0792bdb8, script=0x07e13c80, fp=0x06c10030)  Line 613	C++
 	mozjs.dll!js::Execute(cx=0x0792bdb8, chain={...}, script=0x07e13c80, prev=0x00000000, flags=0x00000000, result=0x004ad254)  Line 974	C++
 	mozjs.dll!JS_ExecuteScript(cx=0x0792bdb8, obj=0x0769c5b0, scriptObj=0x08597c90, rval=0x004ad254)  Line 4940	C++
 	xul.dll!nsJSContext::ExecuteScript(aScriptObject=0x08597c90, aScopeObject=0x0769c5b0, aRetValue=0x00000000, aIsUndefined=0x00000000)  Line 1612	C++
 	xul.dll!nsXULDocument::ExecuteScript(aContext=0x077d2f60, aScriptObject=0x08597c90)  Line 3641	C++
 	xul.dll!nsXULDocument::ExecuteScript(aScript=0x07e91538)  Line 3664	C++
 	xul.dll!nsXULDocument::ResumeWalk()  Line 3015	C++
 	xul.dll!nsXULDocument::OnPrototypeLoadDone(aResumeWalk=0x00000001)  Line 651	C++
 	xul.dll!nsXULDocument::EndLoad()  Line 635	C++
 	xul.dll!XULContentSinkImpl::DidBuildModel(aTerminated=0x00000000)  Line 278	C++
 	xul.dll!nsParser::DidBuildModel(anErrorCode=0x00000000)  Line 1524	C++
 	xul.dll!nsParser::ResumeParse(allowIteration=0x00000001, aIsFinalChunk=0x00000001, aCanInterrupt=0x00000001)  Line 2269	C++
 	xul.dll!nsParser::OnStopRequest(request=0x07d0ac68, aContext=0x00000000, status=0x00000000)  Line 2852	C++
 	xul.dll!nsJARChannel::OnStopRequest(req=0x07d7e078, ctx=0x00000000, status=0x00000000)  Line 909	C++
 	xul.dll!nsInputStreamPump::OnStateStop()  Line 579	C++
 	xul.dll!nsInputStreamPump::OnInputStreamReady(stream=0x07e13d70)  Line 403	C++
 	xul.dll!nsInputStreamReadyEvent::Run()  Line 115	C++
 	xul.dll!nsThread::ProcessNextEvent(mayWait=0x00000000, result=0x004ad5e0)  Line 618	C++
 	xul.dll!NS_ProcessNextEvent_P(thread=0x006f6290, mayWait=0x00000000)  Line 245	C++
 	xul.dll!mozilla::ipc::MessagePump::Run(aDelegate=0x006fc4c0)  Line 110	C++
 	xul.dll!MessageLoop::RunInternal()  Line 219	C++
 	xul.dll!MessageLoop::RunHandler()  Line 203	C++
 	xul.dll!MessageLoop::Run()  Line 177	C++
 	xul.dll!nsBaseAppShell::Run()  Line 191	C++
 	xul.dll!nsAppShell::Run()  Line 249	C++
 	xul.dll!nsAppStartup::Run()  Line 222	C++
 	xul.dll!XRE_main(argc=0x00000004, argv=0x006e7db0, aAppData=0x006ef960)  Line 3699	C++
 	firefox.exe!NS_internal_main(argc=0x00000004, argv=0x006e7db0)  Line 158	C++

Recursive getservice because the NSS component gets the cert override service.
Component: General → Security: PSM
QA Contact: general → psm
This was caused by bug 619201.
I just did a search in the add-ons MXR for nsICertOverrideService. A couple of add-ons use it, but only Perspectives uses it in the way that produced this bug. Based on comment #33, I think we can remove the tracking flag.
Mobile is OK with backing out the patch in bug 619201 to "fix" this
We're going to leave bug 619201 in and just live with this for Firefox 5. We're reasonably confident the only affected add-on on AMO is Perspectives and there is a workaround
Discussed in beta meeting today - and we're concerned that breaking SSL has the potential to break updates or blocklist delivery and so we're going to reverse comment 39 and back out bug 619201. jst has volunteered to handle the backout.
Fixed in 5 by backout of bug 619201. Tracking this for 6 since the fix for bug 619201 is still in 6.
This is currently affecting Selenium WebDriver Browser Automation Framework from working. We need to override the certListener to allow people to test sites that don't have properly signed certificates.

Line in question that is affected is http://code.google.com/p/selenium/source/browse/trunk/javascript/firefox-driver/extension/components/badCertListener.js#87
I have tested this with the Fx6, Fx7 and Fx8 and all are failing with the same issue. 

This prevents people from checking their sites work with the new versions coming out and is also blocking WebQA, who use Selenium
Brian, can you help here. We backed out the offending change for 5 and may need to do the same for 6 and 7 if we don't have a solution.
Assignee: nobody → bsmith
Whiteboard: [may need backout like 5 got]
I think there is likely a simple fix for this. I will write a patch on Monday.
See bug 619201 comment 8. tl;dr: if backing out the patch for bug 619201 is unproblematic, then lets do that and reopen bug 619201, for which we have two possible alternative solutions that avoid this bug and are otherwise better.
I am writing a new patch that fixes bug 619201 and avoids causing this one.
Attachment #547667 - Attachment mime type: application/octet-stream → application/x-xpinstall
Comment on attachment 547667 [details]
test case for Bug 650858

(In reply to comment #27)
my experience shows that wrapping the nsICertOverrideService instantiation in a load event handler doesn't fix the problem. See test case attachment.
@Brian

Where are we on getting this patch to review/landed?
We'd like to back out bug 619201 for Mozilla-beta. Please do so asap
I backed bug 619201 out of beta6:

http://hg.mozilla.org/releases/mozilla-beta/rev/a9bc7596542b

So this bug doesn't affect it anymore. I have not backed it out of aurora or central.
Brian, do you have the patch from comment 47? We are probably going to back this out of mozilla-aurora (again). It seems like this should be backed out of mozilla-central as well?
My original fix used an XPCOM proxy, which will need to be changed since XPCOM proxies are no longer around. I know of an alternate solution and I will have time to have the patch ready for the next Aurora merge, probably Monday.
This will be fixed when bug 679036 is fixed. With bug 679036, all access to the cert override service is on the main thread.
Ok I backed out bug 619201 of aurora7 as well. Should we back out 619201 from mozilla-central and wait for bug 679036 instead (that is, does bug 679036 make 619201 irrelevant?)
Is there any update on this bug? Selenium WebDriver users would like to start testing their apps and have checked it is failing on Firefox 8+. I have updated the tracking flags
I will fixup the patch for bug 679140 which just got r+d and check it in tomorrow. That patch will fix this issue.

Long-term, I would like to remove all the socket transport thread <-> main thread synchronization that this fix requires. We can make the built-in implementation of the cert override service thread-safe so that it can be instantiated and used off the main. I don't know if/when this change will be made (not soon), but it seems like a good idea for Selenium developers to prepare a thread-safe version of their implementation of the interface.
"Their implementation of the interface" being "nsICertOverrideService"?
(In reply to Simon Stewart from comment #59)
> "Their implementation of the interface" being "nsICertOverrideService"?

Yes. I will reply privately to help you with this.
There are two ways I can resolve this for Firefox 8: We could either back out bug 619201 like we did previously, or I can apply the patches for bug 679140 to mozilla-beta. Backing out bug 619201 is the least risky.
We'd like the backout for beta, thanks!
https://hg.mozilla.org/releases/mozilla-beta/rev/dc9713bcaa93
Bug 650858: Back out changeset 999905af7783 (bug 619201). a=backout

The patch for bug 679140 fixes this "permanently."
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Verified the backout - bug is still reproducible:

STR:
1. Install Perspectives in Firefox 4.0
2. Opened some pages in new tabs.
3. Close and open the same profile using Firefox 8 beta 5

=>Tabs loaded correctly, but in error console I got:
Error: gBrowser.addProgressListener was called with a second argument, which is not supported. See bug 608628.
Source File: chrome://browser/content/tabbrowser.xml
Line: 1866

4. Restarted Firefox 8
=> Tabs show blank pages instead. In Error console I got:
Error: uncaught exception: [Exception... "Component returned failure code: 0x80570016 (NS_ERROR_XPC_GS_RETURNED_FAILURE) [nsIJSCID.getService]"  nsresult: "0x80570016 (NS_ERROR_XPC_GS_RETURNED_FAILURE)"  location: "JS frame :: chrome://perspectives/content/notaries.js :: <TOP_LEVEL> :: line 41"  data: no]

Error: Perspectives is undefined
Source File: chrome://perspectives/content/initialize.xul
Line: 7

Error: ERROR addons.manager: Exception calling provider getAddonsByTypes: [Exception... "Component returned failure code: 0x80570015 (NS_ERROR_XPC_CI_RETURNED_FAILURE) [nsIJSCID.createInstance]"  nsresult: "0x80570015 (NS_ERROR_XPC_CI_RETURNED_FAILURE)"  location: "JS frame :: resource:///modules/PluginProvider.jsm :: getIDHashForString :: line 32"  data: no]
Source File: resource:///modules/PluginProvider.jsm
Line: 32

Error: uncaught exception: [Exception... "Component returned failure code: 0x80570016 (NS_ERROR_XPC_GS_RETURNED_FAILURE) [nsIJSCID.getService]"  nsresult: "0x80570016 (NS_ERROR_XPC_GS_RETURNED_FAILURE)"  location: "JS frame :: resource:///components/nsUrlClassifierListManager.js :: PROT_ListManager :: line 81"  data: no]
Ignore my previous comment.

Verified the backout on 8 beta build 2 and the bug is not reproducible anymore, behaviour being the same as with Firefox 5.0:
1. Install Perspectives in Firefox 4.0
2. Opened some pages in new tabs.
3. Close and open the same profile using Firefox 8 beta 6
4. Restarted Firefox 8 beta 6
=> All tabs load correctly

Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0) Gecko/20100101 Firefox/8.0
You need to log in before you can comment on or make changes to this bug.