Closed Bug 884590 Opened 11 years ago Closed 8 years ago

stale requestIds in Gecko _prefsObserver not being removed

Categories

(Firefox for Android Graveyard :: General, defect)

ARM
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: liuche, Unassigned, Mentored)

Details

(Whiteboard: [lang=java][good first bug])

We get a lot of log debug output indicating Gecko has very stale prefsObservers, but continues to notify them.

06-18 15:26:12.330: D/GeckoPrefsHelper(14234): Preferences:Data message had an unknown requestId; ignoring

Something is going wrong in the prefs observers chain (PrefsHelper.removeObserver, removePreferenceObservers in mobile/android/chrome/browser.js).
How do I see the debug log?
If you have the Android SDK, you can find adb [1] in platform-tools/, and running adb logcat in-terminal while you have a device attached will display the log. Alternatively, if you have Eclipse set up with the Android SDK, you can also see (colored) adb debug output from the DDMS [2] pane.

[1] http://developer.android.com/tools/help/adb.html
[2] http://developer.android.com/tools/debugging/ddms.html
I could take this bug on and see what is going on with the prefsObservers if this bug is still needs work.
Sure! I believe this bug is still present, but you can try to verify it as well (see comment #2).

You'll need a dev environment set up to build Firefox for Android and an Android phone to test on, and I can help mentor you through writing a patch for this bug.

If you haven't seen it already, this wiki is really helpful for getting started with building and everything: https://wiki.mozilla.org/Mobile/Fennec/Android

Once you have your dev environment set up, you'll want to take a look in mobile/android/base/PrefsHelper.java and mobile/android/chrome/content/browser.js. We're sending messages between Java (the Android part of our app) and JS (the Gecko part), and something is being dropped along the way, resulting in the Java-side complaining about "unknown requestId".
Sounds good. I already have an environment set up from a previous bug that I worked on. I'll get started on looking through the adb output for when PrefsHelper is communicating with Gecko. Can I get assigned to this bug? Could I also reach you on IRC if I have some more questions?
Great, come find me on irc in #mobile if you have any questions. If I'm not responsive, just leave me a message (I'm on PST but have a remote irc session running) or feel free to comment in this bug.

As for assigning, I believe you can just "take" this bug in the assignee section, right?
If you "needinfo" me, this will also show up in my bugzilla, so I'll be faster about responding. (See checkbox below comment form.)
Oh, that makes sense. Thanks for the extra information. I am also on PST so time-wise things should match up. Right now I am a little busy in school so I might not be able to get a lot of work done until the weekend, but I'll try to do my best to stay on top of this bug. Also, I don't seem to be able to assign myself to the bug (maybe it has something to do with permissions).
Assignee: nobody → timstullich
Mentor: liuche
Whiteboard: [mentor=liuche][lang=java] → [lang=java]
Assignee: timstullich → nobody
Whiteboard: [lang=java] → [lang=java][good first bug]
If no one else wants this but, I think I'd be interested in taking it. I'd need to set up an environment though.
Oops, I meant 'bug' XD
Hi Jonathon, glad you're interested in this bug!

We have instructions on how to get a build set up here: https://wiki.mozilla.org/Mobile/Fennec/Android#Building_Fennec

If you run into any problems, feel free to drop into #mobile and ask for help, or needinfo me (with the checkbox below the comment box).

Once you get a build working, you should try to verify that this is still happening, and then investigate what's going on with the PrefsObserver flow as mentioned in comment 0, and why notifications for dead preferences are still being sent. The files of interest should be mobile/android/base/PrefsHelper and also found in mobile/android/base/preferences.

Try adding Log statements or using breakpoints in an IDE if you get that set up, and get an idea for what's happening and write a fix that removes notifications to dead observers from being sent.

If you run into any problems, feel free to ping me!
hey Chenxia,

Sounds good! I'm cloning the repo right now. If I run into any issues, I'll let you know. Hopefully I'll have a working build by tomorrow or Wednesday.
hey Chenxia,

Ok, I checked out the source code, but I'm having trouble creating an AVD that uses Android 5.0.1 x86_64 as a target. My current dev environment is as follows: Java 1.8.0_31 JDK (Oracle), IntelliJ IDEA 14.0.3, and Linux Mint 17 64-bit. All of that runs on top of a Intel i5-3570K. I figured I should run on a x86_64 image for better performance since I'm using a 64-bit Intel CPU. What do you think? If that isn't right or unnecessary, please let me know.
Firefox for Android is a 32 bit app. Using a 32 bit vm is suggested. See https://developer.android.com/tools/devices/emulator.html#vm-linux for some additional performance enhancements.
Thanks, Kevin. After a few days of wrestling with configuration issues, I got my local copy up & running :)

Now to find out what's causing this bug. I have to admit that I'm still a junior developer, so it might take me some time (although this bug is marked as a 'good first bug', so I felt it was appropriate for me).
hey Chenxia,

I set a breakpoint at line 83 in PrefsHelper.java (right where we check to see if the callback is null), and I only seem to hit it when I check & uncheck "Show search suggestions" in Settings > Customize > Search. However, I don't see the logs being flooded as mentioned earlier. Do you have any suggestions on how I should proceed? Maybe I should see how I could fix the one way I have been able to reproduce the null callback issue.
Mr. Chenxia,
I have cloned the repo to my pc, built it and installed it on my phone. I want to squash my first bug. can you help me get started? also I was wondering if I could use something like Android Studio for debugging this code.
Flags: needinfo?(liuche)
I realized that this bug doesn't have a specific steps to reproduce!

1. Go to Fennec Settings, change a pref that is managed by Gecko (e.g., Privacy > Remember Logins)
2. Click back, or otherwise leave that Preference screen
3. Return to the Preference screen and change the same pref

Expected: No "Unknown pref id" log messages
Actual: We've changed the message name for the pref, and there will be messages about "Unknown pref id".
Flags: needinfo?(liuche)
Hi, I'd like to work on this bug as my first bug. Can someone help me get started?
Hi Chenxia, I tried reproducing the bug with the steps you mentioned. I don't see any such logging.

Maybe the bug is already fixed?

https://pastebin.mozilla.org/8864173
I can not reproduce it too.
Chenxia check comments 20 and 21.
Flags: needinfo?(liuche)
Status: NEW → RESOLVED
Closed: 8 years ago
Flags: needinfo?(liuche)
Resolution: --- → WORKSFORME
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.