Fennec Native crashes upon startup when android is run in safe mode

RESOLVED WONTFIX

Status

()

Firefox for Android
General
P1
critical
RESOLVED WONTFIX
6 years ago
2 years ago

People

(Reporter: jaws, Assigned: jaws)

Tracking

({crash})

Trunk
ARM
Android
crash
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [native-crash])

Attachments

(2 attachments)

str with htc sensation 4g: take battery out of phone. put battery back in phone. turn phone on when the htc logo appears, hold the volume down button. don't release the volume down button until the phone vibrates (may take 60 seconds).  open fennec native.

I don't think many/any users will run android in safe mode, but we should investigate what is causing the crashes.
A logcat of the startup crash would be helpful. If you need help with this find me on the 3rd floor MV desk #74 or in the Mobile war room (c3po/r2d2) 2nd floor.

Updated

6 years ago
Severity: normal → critical
Keywords: crash
OS: Other → Android
Hardware: Other → ARM
Whiteboard: [native-crash]

Updated

6 years ago
Priority: -- → P1
Created attachment 601497 [details]
Log of the crash

This is a logcat dump of the crash.

I think this is the relevant part of the log, but I have included the full log just in case there is something else that is of importance:

> I/ActivityManager(  244): Start proc org.mozilla.fennec for activity org.mozilla.fennec/.App: pid=4970 uid=10127 gids={3003, 1015, 1006}
> W/InputManagerService(  244): [unbindCurrentClientLocked] Disable input method client.
> W/InputManagerService(  244): [startInputLocked] Enable input method client.
> I/ActivityManager(  244): No longer want com.google.android.apps.maps:LocationFriendService (pid 1424): hidden #16
> I/ActivityManager(  244): No longer want com.tmobile.vvm.application (pid 1157): hidden #16
> E/ActivityThread( 4970): Failed to find provider info for org.mozilla.fennec.db.browser
> E/AndroidRuntime( 4970): FATAL EXCEPTION: GeckoLooper Thread
> E/AndroidRuntime( 4970): java.lang.NullPointerException
> E/AndroidRuntime( 4970): 	at org.mozilla.gecko.db.LocalBrowserDB.updateVisitedHistory(LocalBrowserDB.java:203)
> E/AndroidRuntime( 4970): 	at org.mozilla.gecko.db.BrowserDB.updateVisitedHistory(BrowserDB.java:119)
> E/AndroidRuntime( 4970): 	at org.mozilla.gecko.GlobalHistory.add(GlobalHistory.java:119)
> E/AndroidRuntime( 4970): 	at org.mozilla.gecko.Tab$7.run(Tab.java:480)
> E/AndroidRuntime( 4970): 	at android.os.Handler.handleCallback(Handler.java:587)
> E/AndroidRuntime( 4970): 	at android.os.Handler.dispatchMessage(Handler.java:92)
> E/AndroidRuntime( 4970): 	at android.os.Looper.loop(Looper.java:150)
> E/AndroidRuntime( 4970): 	at org.mozilla.gecko.GeckoAppShell$LooperThread.run(GeckoAppShell.java:193)
> W/ActivityManager(  244):   Force finishing activity org.mozilla.fennec/.App
> I/ActivityManager(  244): No longer want com.google.android.apps.maps:FriendService (pid 1163): hidden #16
> I/ActivityManager(  244): No longer want com.qiktmobile.android (pid 700): hidden #16
> E/ActivityThread( 4970): Failed to find provider info for org.mozilla.fennec.db.browser
> E/AndroidRuntime_2_crash( 4970): crash in the same process: AsyncTask #1
> E/AndroidRuntime_2_crash( 4970): java.lang.RuntimeException: An error occured while executing doInBackground()
> E/AndroidRuntime_2_crash( 4970): 	at android.os.AsyncTask$3.done(AsyncTask.java:200)
> E/AndroidRuntime_2_crash( 4970): 	at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:274)
> E/AndroidRuntime_2_crash( 4970): 	at java.util.concurrent.FutureTask.setException(FutureTask.java:125)
> E/AndroidRuntime_2_crash( 4970): 	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:308)
> E/AndroidRuntime_2_crash( 4970): 	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> E/AndroidRuntime_2_crash( 4970): 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
> E/AndroidRuntime_2_crash( 4970): 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
> E/AndroidRuntime_2_crash( 4970): 	at java.lang.Thread.run(Thread.java:1027)
> E/AndroidRuntime_2_crash( 4970): Caused by: java.lang.NullPointerException
> E/AndroidRuntime_2_crash( 4970): 	at org.mozilla.gecko.db.LocalBrowserDB.isBookmark(LocalBrowserDB.java:332)
> E/AndroidRuntime_2_crash( 4970): 	at org.mozilla.gecko.db.BrowserDB.isBookmark(BrowserDB.java:156)
> E/AndroidRuntime_2_crash( 4970): 	at org.mozilla.gecko.Tab$CheckBookmarkTask.doInBackground(Tab.java:517)
> E/AndroidRuntime_2_crash( 4970): 	at org.mozilla.gecko.Tab$CheckBookmarkTask.doInBackground(Tab.java:508)
> E/AndroidRuntime_2_crash( 4970): 	at android.os.AsyncTask$2.call(AsyncTask.java:185)
> E/AndroidRuntime_2_crash( 4970): 	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
> E/AndroidRuntime_2_crash( 4970): 	... 4 more
> I/ActivityManager(  244): No longer want com.android.defcontainer (pid 4835): hidden #16
> E/ActivityThread( 4970): Activity org.mozilla.fennec.App has leaked IntentReceiver android.accounts.AccountManager$12@40588ed8 that was originally registered here. Are you missing a > all to unregisterReceiver()?
> E/ActivityThread( 4970): android.app.IntentReceiverLeaked: Activity org.mozilla.fennec.App has leaked IntentReceiver android.accounts.AccountManager$12@40588ed8 that was originally registered here. Are you missing a call to unregisterReceiver()?
> E/ActivityThread( 4970): 	at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:799)
> E/ActivityThread( 4970): 	at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:575)
> E/ActivityThread( 4970): 	at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:855)
> E/ActivityThread( 4970): 	at android.app.ContextImpl.registerReceiver(ContextImpl.java:842)
> E/ActivityThread( 4970): 	at android.app.ContextImpl.registerReceiver(ContextImpl.java:836)
> E/ActivityThread( 4970): 	at android.accounts.AccountManager.addOnAccountsUpdatedListener(AccountManager.java:1730)
> E/ActivityThread( 4970): 	at org.mozilla.gecko.AboutHomeContent.init(AboutHomeContent.java:142)
> E/ActivityThread( 4970): 	at org.mozilla.gecko.GeckoApp$AboutHomeRunnable.run(GeckoApp.java:1159)
> E/ActivityThread( 4970): 	at android.os.Handler.handleCallback(Handler.java:587)
> E/ActivityThread( 4970): 	at android.os.Handler.dispatchMessage(Handler.java:92)
> E/ActivityThread( 4970): 	at android.os.Looper.loop(Looper.java:150)
> E/ActivityThread( 4970): 	at org.mozilla.gecko.GeckoApp$35.run(GeckoApp.java:1819)
> E/ActivityThread( 4970): 	at android.os.Handler.handleCallback(Handler.java:587)
> E/ActivityThread( 4970): 	at android.os.Handler.dispatchMessage(Handler.java:92)
> E/ActivityThread( 4970): 	at android.os.Looper.loop(Looper.java:150)
> E/ActivityThread( 4970): 	at android.app.ActivityThread.main(ActivityThread.java:4293)
> E/ActivityThread( 4970): 	at java.lang.reflect.Method.invokeNative(Native Method)
> E/ActivityThread( 4970): 	at java.lang.reflect.Method.invoke(Method.java:507)
> E/ActivityThread( 4970): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
> E/ActivityThread( 4970): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
> E/ActivityThread( 4970): 	at dalvik.system.NativeStart.main(Native Method)
> I/ActivityManager(  244): No longer want android.process.media (pid 670): hidden #16
> W/InputManagerService(  244): [unbindCurrentClientLocked] Disable input method client.
> W/InputManagerService(  244): [startInputLocked] Enable input method client.
> I/ActivityManager(  244): Process org.mozilla.fennec (pid 4970) has died.

Looking at this, it seems that we are missing a null check here:
> E/AndroidRuntime_2_crash( 4970): Caused by: java.lang.NullPointerException
> E/AndroidRuntime_2_crash( 4970): 	at org.mozilla.gecko.db.LocalBrowserDB.isBookmark(LocalBrowserDB.java:332)

According to this documentation, the Cursor object may be null:
http://developer.android.com/reference/android/content/ContentResolver.html#query%28android.net.Uri,%20java.lang.String[],%20java.lang.String,%20java.lang.String[],%20java.lang.String%29
Created attachment 601499 [details] [diff] [review]
Patch for bug (untested)

This patch is untested because I don't have a full Android environment set up yet.

This just adds a null check on the cursor and logs a debug message in this event. 

There is a bigger question on why the cursor is null in this case, but in either case we should probably check for null here.
Assignee: nobody → jwein
Status: NEW → ASSIGNED
Attachment #601499 - Flags: review?(mark.finkle)
Comment on attachment 601499 [details] [diff] [review]
Patch for bug (untested)

Passing to Lucas. Do we know why this could happen? The null check looks OK to me, but Lucas might have more insight.
Attachment #601499 - Flags: review?(mark.finkle)
Attachment #601499 - Flags: review?(lucasr.at.mozilla)
Attachment #601499 - Flags: feedback+
Comment on attachment 601499 [details] [diff] [review]
Patch for bug (untested)

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

The interesting bit of your logcat is: "Failed to find provider info for org.mozilla.fennec.db.browser". AFAIK, Android's safe mode is meant to disable any third-party apps and disallows any use of third-party content providers (that includes Fennec's). This means Fennec can't really run when safe mode is on (which is the expected behaviour).

::: mobile/android/base/db/LocalBrowserDB.java
@@ +327,5 @@
>                                   new String[] { Bookmarks._ID },
>                                   Bookmarks.URL + " = ?",
>                                   new String[] { uri },
>                                   Bookmarks.URL);
> +        if (cursor == null) {

The query method will only return null when there's problem loading our Content Provider. Which means this is a bug somewhere else and doing a null check here would only hide the bug.
Attachment #601499 - Flags: review?(lucasr.at.mozilla) → review-
Fennec is not supposed to run on safe mode so closing as WONTFIX. Jared, let me know if you have any further questions.
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → WONTFIX
(In reply to Lucas Rocha (:lucasr) from comment #5)
> The interesting bit of your logcat is: "Failed to find provider info for
> org.mozilla.fennec.db.browser". AFAIK, Android's safe mode is meant to
> disable any third-party apps and disallows any use of third-party content
> providers (that includes Fennec's). This means Fennec can't really run when
> safe mode is on (which is the expected behaviour).

ESPN's ScoreCenter app runs fine in safe mode and uses the data connection to retrieve the latest scores and schedules.

With the caveat that probably none of us know their source code, wouldn't their app fail under the same circumstances that ours fails?
(In reply to Jared Wein [:jaws] from comment #7)
> (In reply to Lucas Rocha (:lucasr) from comment #5)
> > The interesting bit of your logcat is: "Failed to find provider info for
> > org.mozilla.fennec.db.browser". AFAIK, Android's safe mode is meant to
> > disable any third-party apps and disallows any use of third-party content
> > providers (that includes Fennec's). This means Fennec can't really run when
> > safe mode is on (which is the expected behaviour).
> 
> ESPN's ScoreCenter app runs fine in safe mode and uses the data connection
> to retrieve the latest scores and schedules.
> 
> With the caveat that probably none of us know their source code, wouldn't
> their app fail under the same circumstances that ours fails?

My wild guess is that they don't implement/use any third-party content provider. In theory, we'd be able to run Fennec without being able to read/write anything from/to our history/bookmarks content provider but that would be a bit pointless I think.
(In reply to Lucas Rocha (:lucasr) from comment #8)
> (In reply to Jared Wein [:jaws] from comment #7)
> > (In reply to Lucas Rocha (:lucasr) from comment #5)
> > > The interesting bit of your logcat is: "Failed to find provider info for
> > > org.mozilla.fennec.db.browser". AFAIK, Android's safe mode is meant to
> > > disable any third-party apps and disallows any use of third-party content
> > > providers (that includes Fennec's). This means Fennec can't really run when
> > > safe mode is on (which is the expected behaviour).
> > 
> > ESPN's ScoreCenter app runs fine in safe mode and uses the data connection
> > to retrieve the latest scores and schedules.
> > 
> > With the caveat that probably none of us know their source code, wouldn't
> > their app fail under the same circumstances that ours fails?
> 
> My wild guess is that they don't implement/use any third-party content
> provider. In theory, we'd be able to run Fennec without being able to
> read/write anything from/to our history/bookmarks content provider but that
> would be a bit pointless I think.

Private browsing mode?
(In reply to Jared Wein [:jaws] from comment #9)
> (In reply to Lucas Rocha (:lucasr) from comment #8)
> > (In reply to Jared Wein [:jaws] from comment #7)
> > > (In reply to Lucas Rocha (:lucasr) from comment #5)
> > > > The interesting bit of your logcat is: "Failed to find provider info for
> > > > org.mozilla.fennec.db.browser". AFAIK, Android's safe mode is meant to
> > > > disable any third-party apps and disallows any use of third-party content
> > > > providers (that includes Fennec's). This means Fennec can't really run when
> > > > safe mode is on (which is the expected behaviour).
> > > 
> > > ESPN's ScoreCenter app runs fine in safe mode and uses the data connection
> > > to retrieve the latest scores and schedules.
> > > 
> > > With the caveat that probably none of us know their source code, wouldn't
> > > their app fail under the same circumstances that ours fails?
> > 
> > My wild guess is that they don't implement/use any third-party content
> > provider. In theory, we'd be able to run Fennec without being able to
> > read/write anything from/to our history/bookmarks content provider but that
> > would be a bit pointless I think.
> 
> Private browsing mode?

Fair enough. But still wonder if it would be worth the effort (likely not a trivial task) for such rare use case.
Duplicate of this bug: 1087508
You need to log in before you can comment on or make changes to this bug.