Closed Bug 791419 Opened 12 years ago Closed 11 years ago

Firefox for Android crashes on start on Kindle Fire HD 7": Couldn't get a handle to libmozsqlite3.so

Categories

(Firefox for Android Graveyard :: General, defect, P2)

ARM
Android
defect

Tracking

(firefox15 affected, firefox16- affected, firefox17 affected, firefox18 affected, firefox19 affected, firefox20 fixed, fennec19+)

RESOLVED FIXED
Firefox 20
Tracking Status
firefox15 --- affected
firefox16 - affected
firefox17 --- affected
firefox18 --- affected
firefox19 --- affected
firefox20 --- fixed
fennec 19+ ---

People

(Reporter: M8R-7hrw9m, Assigned: rafael)

References

Details

(Keywords: crash, Whiteboard: [native-crash][startupcrash])

Crash Data

Attachments

(6 files, 1 obsolete file)

Attached file FF_crash.txt
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:15.0) Gecko/20100101 Firefox/15.0.1
Build ID: 20120905151427

Steps to reproduce:

Attempted to install and start Firefox 15 on the Kindle Fire HD 7"


Actual results:

The application started, but crashed after a few seconds. This behavior is 100% reproducible after every start of Firefox, so the application is unusable.


Expected results:

Expected to be able to use Firefox for Android without it crashing a few seconds after start up.
OS: Mac OS X → Android
Hardware: x86 → ARM
Thanks for the bug report.

We don't officially support Amazon's Android Appstore yet, so we haven't tested the new Kindle Fire HD tablets yet. I have an original Kindle Fire I will retest.

The log file is a huge help! Firefox is failing to load our SQLite database library:

E/GeckoLinker(10618): /data/app/org.mozilla.firefox-1.apk!/libmozsqlite3.so: Warning: relocation to NULL @0x00054d10
E/GeckoLinker(10618): /data/app/org.mozilla.firefox-1.apk!/libmozsqlite3.so: Error: relocation to NULL @0x00054bf8 for symbol "memmove"
E/GeckoLibLoad(10618): Couldn't get a handle to libmozsqlite3!
E/GeckoLibLoad(10618): Throw
E/GeckoLibLoad(10618): Load sqlite done
W/dalvikvm(10618): threadid=11: thread exiting with uncaught exception (group=0x40aa11f8)
E/GeckoAppShell(10618): >>> REPORTING UNCAUGHT EXCEPTION FROM THREAD 388 ("Gecko")
E/GeckoAppShell(10618): java.lang.Exception: Error loading sqlite libraries
E/GeckoAppShell(10618): 	at org.mozilla.gecko.GeckoAppShell.loadSQLiteLibsNative(Native Method)
E/GeckoAppShell(10618): 	at org.mozilla.gecko.GeckoAppShell.loadSQLiteLibs(GeckoAppShell.java:415)
E/GeckoAppShell(10618): 	at org.mozilla.gecko.GeckoThread.run(GeckoThread.java:46)
F/libc    (10618): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1)
Priority: -- → P2
Summary: Firefox for Android crashes on start on Kindle Fire HD 7" → Firefox for Android crashes on start on Kindle Fire HD 7": Couldn't get a handle to libmozsqlite3.so
Severity: normal → critical
Status: UNCONFIRMED → NEW
tracking-fennec: --- → ?
Crash Signature: [@ java.lang.Exception: Error loading sqlite libraries at org.mozilla.gecko.GeckoAppShell.loadSQLiteLibsNative(Native Method)]
Ever confirmed: true
Keywords: crash
Whiteboard: [native-crash][startupcrash]
Please renominate if this issue with libmozsqlite3.so is reproducible on devices we do support and there is a sign of significant user impact for this issue.
Firefox 18 works on my old Kindle Fire.
btw, I have seen similar mozglue UnsatisfiedLinkError crashes (on my Kindle Fire and other devices), but I was installing a recent Firefox build over a very old build. Uninstalling and reinstalling the new build made the problem "go away".
tracking-fennec: ? → 19+
M8R-7hrw9m

Are you installing over an old build? Can you make sure any old install has been removed and try it again?
Mark, I am not installing over an old build. I tried clearing data for Firefox as well and it didn't help.

Chris, Firefox 15 does indeed work on my old Kindle Fire as well, so this seems specific to the Kindle Fire HD os. Although, I suspect the same issue will be found on the Kindle Fire 2.

I also neglected to mention I tried Firefox 17 and 18 as well they would not start as well.
I have the same problem with Kindle Fire HD.
The new versions install ok, but when I run them I get Firefox running for 2-5 seconds and then it takes me be back to the app menu.
I tried older versions and the "newer" one that worked so far is Firefox 10.0, all the others fail in the same way.
I have the same problem with Kindle Fire HD. It is unrooted, I sideload and it crashes almost right away.
I get the same problem on my Kindle Fire HD with fennec-15.0.multi.android-arm.apk and also fennec-18.0a2.en-US.android-arm.apk
I'm having the same problem launching Firefox (fennec-16.0.en-US.android-arm.apk)  on Kindle Fire HD 7.
v10 works well, but lacks flash support (Kindle fire HD)
Any version after 10 appears to close after a few seconds.
Just adding that I had the same experience with the latest build of the beta, updated via the Google play store. Hope this bug is squashed soon- I'd love to try out the mobile version!
Version: Firefox 15 → Trunk
This needs an owner for 19.
(In reply to Chris Peterson (:cpeterson) from comment #4)
> Firefox 18 works on my old Kindle Fire.

Just so you know, I tested Firefox 18 on my new Kindle Fire HD (8.9 in this case, instead of 7), but it still crashes.
(In reply to andrig.t.miller from comment #15)
> (In reply to Chris Peterson (:cpeterson) from comment #4)
> > Firefox 18 works on my old Kindle Fire.
> 
> Just so you know, I tested Firefox 18 on my new Kindle Fire HD (8.9 in this
> case, instead of 7), but it still crashes.

That was in reference to the older device.

If there is no patch here, assume it still crashes on every channel version.
(In reply to Aaron Train [:aaronmt] from comment #14)
> This needs an owner for 19.

It is a shame that we're crashing here, but it's not a supported device (we're not in the Appstore). Sending to mfinkle to see if he can find an assignee for this reproducible crash, but not tracking for release.
Assignee: nobody → mark.finkle
(In reply to Alex Keybl [:akeybl] from comment #17)
> (In reply to Aaron Train [:aaronmt] from comment #14)
> > This needs an owner for 19.
> Sending to mfinkle to see if he can find an assignee for this reproducible crash, but not tracking for release.

I only say that as it is currently 19+
Assignee: mark.finkle → blassey.bugs
Glandium, this log is from a build with MOZ_DEBUG_LINKER set. Do you see anything useful?
Flags: needinfo?(mh+mozilla)
The log in comment 1 was already pretty clear: memmove can't be found. The MOZ_DEBUG_LINKER log adds this:
E/GeckoLinker( 7104): dlsym(0xb000a190 ["liblog.so"], "memmove") = 0x0
E/GeckoLinker( 7104): dlsym(0xb000e678 ["libmozglue.so"], "memmove") = 0x0
E/GeckoLinker( 7104): dlsym(0xb000a2a8 ["libc.so"], "memmove") = 0x0
E/GeckoLinker( 7104): dlsym(0xb00095b0 ["libdl.so"], "memmove") = 0x0

In the NDK, memmove is found in libc.so... That would seem to indicate the device's libc is broken.
Flags: needinfo?(mh+mozilla)
I grabbed libc.so from the Kindle Fire HD 7" software update package. When I dump the symbol tables, memmove does have an address, although it is a weak symbol.
> 0001677c  w   DF .text	00000044 memmove
Looking at the verbose log in comment 19, all the successful calls to dlsym() are for strong symbols, and the call for memmove is the first call for a weak symbol. Could it be that dlsym() has an issue with weak symbols?
(In reply to ssssmemyself from comment #21)
> Could it be that dlsym() has an issue with weak symbols?

Indeed, it has.
(In reply to Mike Hommey [:glandium] from comment #22)
> (In reply to ssssmemyself from comment #21)
> > Could it be that dlsym() has an issue with weak symbols?
> 
> Indeed, it has.

so what's the solution here?
Add an implementation of memmove in libmozglue.
Well, there are 48 weak, non-global symbols for important functions in libc.so. (i.e. malloc, free, strcmp...) Also, the symbols do point to real function bodies.

Would it be easier to replace dlsym(...) with code that ignores the global flag? (see https://github.com/android/platform_bionic/blob/master/linker/dlfcn.cpp#L100)
(In reply to ssssmemyself from comment #25)
> Well, there are 48 weak, non-global symbols for important functions in
> libc.so. (i.e. malloc, free, strcmp...) Also, the symbols do point to real
> function bodies.
> 
> Would it be easier to replace dlsym(...) with code that ignores the global
> flag? (see
> https://github.com/android/platform_bionic/blob/master/linker/dlfcn.cpp#L100)

You can't replace the libc on android. The only way this would work is to allow our custom linker to resolve symbols in system libraries, which is not trivial to implement. We may want to do that on the long run, but in the meanwhile, it's just simpler to copy/paste a memmove implementation.
Good news! I added all the missing functions to libmozglue.so (copied from the Android libc source) and that did the trick! I tested out the build on a Kindle Fire HD 7 device, and it seems to work well. The device wasn't rooted, so I couldn't get the test suites to run on it unfortunately.

I'll work on packaging the changes into a patch over the next couple days.
As mentioned to blassey on irc, you don't need to copy the functions source. Just add wrapper functions, like:
void *__wrap_memmove(void *dest, const void *src, size_t n) { return memmove(dest, src, n); }
somewhere in mozglue/build/BionicGlue.cpp (you may want to make them conditional to building for android but *not* b2g), and add -Wl,--wrap=memmove to WRAP_FLAGS in configure.in.
Of these functions, bcopy, and bzero (from strings.h), strtotimeval (from time.h), and mallinfo (from malloc.h) are not used in Fennec.

malloc, calloc, realloc, free, memalign, and valloc (from malloc.h) and strdup and strndup (from string.h) already get wrapped on Android ( http://lxr.mozilla.org/mozilla-central/source/configure.in#7324 ).
copied from Android NDK's include files
The patch as generated by the Perl script, pasted into Fennec's source code. Compiles and runs fine on Kindle Fire HD.
Comment on attachment 696200 [details] [diff] [review]
patch to fix Fennec on Kindle Fire HD

Okay, thanks, I'll try.
Attachment #696200 - Flags: review?(mh+mozilla)
Comment on attachment 696200 [details] [diff] [review]
patch to fix Fennec on Kindle Fire HD

Review of attachment 696200 [details] [diff] [review]:
-----------------------------------------------------------------

::: mozglue/build/BionicGlue.cpp
@@ +126,5 @@
>  }
> +
> +/* Amazon Kindle Fire HD's libc provides most of the 
> + * functions in string.h as weak symbols, which dlsym 
> + * cannot resolve. Thus, we must wrap these functions. 

Please remove the trailing whitespaces.
Attachment #696200 - Flags: review?(mh+mozilla) → review+
Attachment #696200 - Attachment is obsolete: true
Attachment #696251 - Flags: review?(mh+mozilla)
Comment on attachment 696251 [details] [diff] [review]
patch to fix Fennec on Kindle Fire HD - trailing whitespaces removed

Review of attachment 696251 [details] [diff] [review]:
-----------------------------------------------------------------

No need to request another review when the previous was +ed, provided you do the mentioned changes :)
Attachment #696251 - Flags: review?(mh+mozilla) → review+
Target Milestone: --- → Firefox 20
Assignee: blassey.bugs → rafael
Guys, my knowlodge in Java or whatever Programming Language is being used is near zero. However I have a KFD (rooted). I can test if you want me to.

Thanks for the effort.
https://hg.mozilla.org/mozilla-central/rev/b99d9b422a3d
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Anyone who is interested in testing this fix you can download tomorrow's (Dec-30) nightly build. It should be available for download mid-day pacific time at http://nightly.mozilla.org
This build works fine for me on my Kindle Fire HD 8.9.  In fact, I am adding this comment with it right now.  Also, a side comment.  This build of Firefox is faster then both Silk and Chrome.  Very nice.
I've tested today's nightly build and can verify that it runs on both Kindle Fire HD 7 and Kindle Fire HD 8.9 models. Thanks for the good work, it looks like the issue has been resolved.
Reporter here; I'm happy to add my own confirmation that the issue is fixed!

Thanks for resolving this. I don't know what I would do without Firefox on my tablet.
The fix should be uplifted to Aurora.
Working great for me!  Sadly, seems like Flash Player is becoming impossible to use.  Does anyone have a copy of the Flash Player for Android Firefox?
You can find archived versions of the Flash Player at http://helpx.adobe.com/flash-player/kb/archived-flash-player-versions.html#flash_player_archives (scroll down to the Android sections)
The above link is provided in Mozilla's support forum: https://support.mozilla.org/kb/how-do-i-watch-flash-videos-firefox-android
Thank you all- everything seems to be working, now!
I've tested 19.0b2 (latest beta) and the issue is not fixed there - still crashes on launch. Tested on Kindle Fire HD 7.0 and 8.9 devices.

Other testing is good, the fix has been in Aurora since early January and working well on the KF HD. 20.0 alpha launches and runs fine: http://www.mozilla.org/en-US/mobile/aurora/

Can anyone verify whether this fix will make it into a future 19.0 beta or 19.0 stable release?
(In reply to Tom H from comment #50)
> I've tested 19.0b2 (latest beta) and the issue is not fixed there - still
> crashes on launch. Tested on Kindle Fire HD 7.0 and 8.9 devices.
> 
> Other testing is good, the fix has been in Aurora since early January and
> working well on the KF HD. 20.0 alpha launches and runs fine:
> http://www.mozilla.org/en-US/mobile/aurora/
> 
> Can anyone verify whether this fix will make it into a future 19.0 beta or
> 19.0 stable release?

The fix is on Nightly (21), Aurora (20). The target release milestone for fixing the issue will be Firefox 20. At this point it is too late for Beta testing as we're nearing Firefox 19 release in the coming weeks. I think a fix like this benefits from longer Beta testing.
(wont-fix 19?)
Blocks: 1001703
Attachment #696197 - Attachment mime type: application/octet-stream → text/plain
Blocks: 1081034
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: