Closed
Bug 660500
Opened 14 years ago
Closed 14 years ago
Preference observer behavior is different in Ubuntu x64. Can cause stack overflow/infinite loop
Categories
(Core :: Preferences: Backend, defect)
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: kevin.a.jacobs, Unassigned)
References
()
Details
Attachments
(1 file)
5.24 KB,
application/octet-stream
|
Details |
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:2.0) Gecko/20100101 Firefox/4.0
Build Identifier: Mozilla/5.0 (X11; Linux x86_64; rv:2.0) Gecko/20100101 Firefox/4.0
I found a bug/discrepancy in the way preference observers work in Ubuntu x64 vs all other operating systems.
Here's some code that will reproduce the bug:
............. (init() function above..)
this.prefs.addObserver("", this, false);
},
observe: function(subject, topic, data){
if (topic != "nsPref:changed")
return;
this.count++;
Application.console.log("Observer code executed. Setting test to false " +
this.count + " times");
this.prefs.setBoolPref("test", false);
},
onMenuItemCommand: function() {
this.prefs.setBoolPref("test", true);
},
So after clicking the menu button and setting the pref to True, here are the results for Windows 7, XP (32 and 64 bit), Mac OS X Leopard, Fedora 15 x64, OpenSUSE x64, and Ubuntu 11.04 x86, and a couple other distros:
http://i.imgur.com/Egt0o.png.
Note that it calls the observer once when I change from false to true, and again after it changes itself from true back to false. The observer is not called again, as the preference is not changing values.
Now, here's what you get running the exact same code in Ubuntu 10.10 (FF3.6) and Ubuntu 11.04 (FF 4.0.1):
http://i.imgur.com/1TS52.png
Basically, the 'normal' behavior is to not call the observer code if the preference is changed to the same value it was previously. For some reason Ubuntu x64 does this differently and calls every time. (causing an infinite loop).
If you want to try it yourself, here's the file: https://rapidshare.com/files/1684150596/OverflowDemo.xpi. Just click Tools > OverflowDemo and watch the Error Console message log.
I'm not sure if this is an Ubuntu bug or Firefox bug, but figured it was worth reporting.
Reproducible: Always
Steps to Reproduce:
1. Download/install https://rapidshare.com/files/1684150596/OverflowDemo.xpi
2. Open Error Console > Messages
3. Click Tools > Overflow demo in any OS other than Ubuntu x64, then try in Ubuntu x64. Note the difference..
Actual Results:
In all other OSes, the observer is called twice. In Ubuntu x64, it's called anywhere from 150-180 times before Firefox cuts it off.
In my real extension that had the bug, I was reading in SQLite data from the observer.. The result was a completely unresponsive UI, 100% cpu usage, and high memory usage. If that preference is changed at all in startup code, your Firefox profile can become unusable as the loop will be triggered (you have to delete the extension manually from your profile directory).
In my extension (not in the OverflowDemo.xpi) "Too much recursion" errors were being logged in the console.
Expected Results:
Preferably not keep calling the observer code... It was sloppy refactoring on my part that found it, but the behavior should be consistent across OSes.
Reporter | ||
Comment 1•14 years ago
|
||
Install, then open the Error Console to Messages.
Click Tools > Overflow Demo
![]() |
||
Comment 2•14 years ago
|
||
First of all are you using a version of Firefox from the Ubuntu repositories or from the official Mozilla download site?
Secondly please test with Firefox 4.0.1 and if possible with Firefox 5.0a.
Component: Developer Tools → Preferences: Backend
Product: Firefox → Core
QA Contact: developer.tools → preferences-backend
Version: unspecified → 2.0 Branch
Reporter | ||
Comment 3•14 years ago
|
||
So I tried 4.0.1 and 5.0b2 and it looks like it's fixed (4.0.1 from the Ubuntu repository, and 5.0b2 from Mozilla.org).
Sorry about the unnecessary bug report.
![]() |
||
Updated•14 years ago
|
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•