Closed Bug 404205 Opened 14 years ago Closed 14 years ago

Gmail Notifier hangs on exit if master password dialog canceled at start up

Categories

(Toolkit :: Password Manager, defect)

x86
All
defect
Not set
critical

Tracking

()

VERIFIED INVALID

People

(Reporter: whimboo, Unassigned)

References

Details

(Keywords: hang, regression)

This bug can be seen if you have installed add-ons which have auto-login
implemented (e.g. gmail notifier) and are asking for a password on startup. If
you cancel the master password dialog following exception is thrown:

[Exception... "'User canceled Master Password entry' when calling method:
[nsILoginManagerStorage::findLogins]"  nsresult: "0x8057001e
(NS_ERROR_XPC_JS_THREW_STRING)"  location: "JS frame ::
file:///Users/henrik/mozilla/bin/Firefox.app/Contents/MacOS/components/nsLoginManager.js
:: anonymous :: line 441"  data: no]

After you close the dialog the main menu stays empty. Only "Firefox" is visible. You have to switch the applications and come back to have the whole menu visible. But anything is working as expected.

But more important is the hang of the whole application while closing Firefox afterwards. I got 100% cpu usage and after a while a dialog pops up telling me about an unresponsive script. I used my debug build to come closer to this
issue:

We are running in an endless loop here:
http://bonsai.mozilla.org/cvsblame.cgi?file=/mozilla/js/src/jsopcode.c&rev=3.268&#1801

A full backtrace is shown with attachment 289122 [details].

The identical profile used with Firefox 2 doesn't show all this issues. A regression has to be happend on trunk. I need some further testing to get the regression range. I'm able to reproduce it on Windows and OS X with different profiles.

Steps:
1. Install Gmail Notifier Add-on
2. Set master password
3. Setup Gmail Notifier to use auto login
4. Use gmail notifier to log into your gmail account and save the password
5. Restart Firefox
6. When master password dialog is shown hit cancel
7. You get a dialog with an exception
8. Click ok
9. Close Firefox

I'm not sure if Firefox/Password Manager is the right component therefor.

I think its worth asking for blocking-firefox3.
Flags: blocking-firefox3?
Regression range is between builds of 2007-05-15-04-trunk and 2007-05-16-04-trunk.

Bonsai search results:
http://bonsai.mozilla.org/cvsquery.cgi?treeid=default&module=all&branch=HEAD&branchtype=match&dir=&file=&filetype=match&who=&whotype=match&sortby=Date&hours=2&date=explicit&mindate=2007-05-15+03%3A00%3A00&maxdate=2007-05-16+05%3A00%3A00&cvsroot=%2Fcvsroot

In this time-frame the re-design of the password manager (bug 374723) has landed on trunk and has probably raised this issue.
Depends on: 374723
Blocks: 374723
No longer depends on: 374723
The alert is coming from the Gmail Notifer extension (gm-notifier.js), it has a try/catch block and does a |alert (e)| when it catches the exception. As noted in bug 394452, this exception is expected when you click the Cancel button.

The "hang" is caused by a bug in Gmail Notifier.

In components/nsGMNotifierService.js:

nsNotifierService.prototype.removeListener = function(aListener) {
  var found = false;
  var run = 0;

  while (!found || (run < this.listeners.length)) {
    if (this.listeners[run] == aListener) {
      this.listeners[run] = null;
      found = true;
    }
    run++;
  }
}

This function is invoked at shutdown, and |this.listeners.length| is 0. The while() loop this never terminates.

The author should be able to fix this by changing the while conditional from |!found || (...)| to |!found && (...)|
Status: NEW → RESOLVED
Closed: 14 years ago
Flags: blocking-firefox3?
Resolution: --- → INVALID
Doron, I think this is you?
Summary: If master password dialog on startup is canceled while add-ons asking for a password an exception is thrown and Firefox hangs on exit → Gmail Notifier hangs on exit if master password dialog canceled at start up
Justin, thank you! That solved this issue. But one question to you. Which tool have you used to get find this endless loop? Venkman?
Status: RESOLVED → VERIFIED
No, just gdb. I attached while the process was 'stuck', took at look at the stack [and JS stack with DumpJSStack()], then looked at what the last caller was doing.
(In reply to comment #5)
> No, just gdb. I attached while the process was 'stuck', took at look at the
> stack [and JS stack with DumpJSStack()], then looked at what the last caller
> was doing.

Got this with 'call DumpJSStack()'. Thanks for this information. I'll remember for the future. The current unresponsive script dialog also shows this script now.
Product: Firefox → Toolkit
You need to log in before you can comment on or make changes to this bug.