Opened 10 months ago

Closed 8 months ago

#29238 closed defect (fixed)

TBA: Prevent crash following upgrade

Reported by: sysrqb Owned by: tbb-team
Priority: High Milestone:
Component: Applications/Tor Browser Version:
Severity: Normal Keywords: tbb-mobile, TBA-a3, TorBrowserTeam201904R, tbb-8.5-must
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

For the last few releases (maybe all of them), TBA crashes after installing the update. I believe this only happens if the app was open and then the new apk is installed (therefore the app goes into the background). After the crash, opening the app again is successful and it doesn't crash (for the same reason) again.

01-30 11:32:58.544 22804 22804 D AndroidRuntime: Shutting down VM
01-30 11:32:58.545 22804 22804 E AndroidRuntime: FATAL EXCEPTION: main
01-30 11:32:58.545 22804 22804 E AndroidRuntime: Process: org.torproject.torbrowser_alpha, PID: 22804
01-30 11:32:58.545 22804 22804 E AndroidRuntime: java.lang.RuntimeException: Unable to start receiver org.mozilla.gecko.PackageReplacedReceiver: java.lang.IllegalStateException: Not allowed to start service Intent { act=load-libs cmp=org.torproject.torbrowser_alpha/org.mozilla.gecko.GeckoService }: app is in background uid UidRecord{982a65d u0a163 RCVR idle change:uncached procs:1 seq(0,0,0)}
01-30 11:32:58.545 22804 22804 E AndroidRuntime:        at android.app.ActivityThread.handleReceiver(ActivityThread.java:3194)
01-30 11:32:58.545 22804 22804 E AndroidRuntime:        at android.app.ActivityThread.-wrap17(Unknown Source:0)
01-30 11:32:58.545 22804 22804 E AndroidRuntime:        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1672)
01-30 11:32:58.545 22804 22804 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:106)
01-30 11:32:58.545 22804 22804 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:164)
01-30 11:32:58.545 22804 22804 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:6494)
01-30 11:32:58.545 22804 22804 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
01-30 11:32:58.545 22804 22804 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
01-30 11:32:58.545 22804 22804 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
01-30 11:32:58.545 22804 22804 E AndroidRuntime: Caused by: java.lang.IllegalStateException: Not allowed to start service Intent { act=load-libs cmp=org.torproject.torbrowser_alpha/org.mozilla.gecko.GeckoService }: app is in background uid UidRecord{982a65d u0a163 RCVR idle change:uncached procs:1 seq(0,0,0)}
01-30 11:32:58.545 22804 22804 E AndroidRuntime:        at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1521)
01-30 11:32:58.545 22804 22804 E AndroidRuntime:        at android.app.ContextImpl.startService(ContextImpl.java:1477)
01-30 11:32:58.545 22804 22804 E AndroidRuntime:        at android.content.ContextWrapper.startService(ContextWrapper.java:650)
01-30 11:32:58.545 22804 22804 E AndroidRuntime:        at android.content.ContextWrapper.startService(ContextWrapper.java:650)
01-30 11:32:58.545 22804 22804 E AndroidRuntime:        at org.mozilla.gecko.PackageReplacedReceiver.onReceive(PackageReplacedReceiver.java:29)
01-30 11:32:58.545 22804 22804 E AndroidRuntime:        at android.app.ActivityThread.handleReceiver(ActivityThread.java:3187)
01-30 11:32:58.545 22804 22804 E AndroidRuntime:        ... 8 more
01-30 11:32:58.546 22804 22804 E GeckoCrashHandler: >>> REPORTING UNCAUGHT EXCEPTION FROM THREAD 2 ("main")
01-30 11:32:58.546 22804 22804 E GeckoCrashHandler: java.lang.IllegalStateException: Not allowed to start service Intent { act=load-libs cmp=org.torproject.torbrowser_alpha/org.mozilla.gecko.GeckoService }: app is in background uid UidRecord{982a65d u0a163 RCVR idle change:uncached procs:1 seq(0,0,0)}
01-30 11:32:58.546 22804 22804 E GeckoCrashHandler:     at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1521)
01-30 11:32:58.546 22804 22804 E GeckoCrashHandler:     at android.app.ContextImpl.startService(ContextImpl.java:1477)
01-30 11:32:58.546 22804 22804 E GeckoCrashHandler:     at android.content.ContextWrapper.startService(ContextWrapper.java:650)
01-30 11:32:58.546 22804 22804 E GeckoCrashHandler:     at android.content.ContextWrapper.startService(ContextWrapper.java:650)
01-30 11:32:58.546 22804 22804 E GeckoCrashHandler:     at org.mozilla.gecko.PackageReplacedReceiver.onReceive(PackageReplacedReceiver.java:29)
01-30 11:32:58.546 22804 22804 E GeckoCrashHandler:     at android.app.ActivityThread.handleReceiver(ActivityThread.java:3187)
01-30 11:32:58.546 22804 22804 E GeckoCrashHandler:     at android.app.ActivityThread.-wrap17(Unknown Source:0)
01-30 11:32:58.546 22804 22804 E GeckoCrashHandler:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1672)
01-30 11:32:58.546 22804 22804 E GeckoCrashHandler:     at android.os.Handler.dispatchMessage(Handler.java:106)
01-30 11:32:58.546 22804 22804 E GeckoCrashHandler:     at android.os.Looper.loop(Looper.java:164)
01-30 11:32:58.546 22804 22804 E GeckoCrashHandler:     at android.app.ActivityThread.main(ActivityThread.java:6494)
01-30 11:32:58.546 22804 22804 E GeckoCrashHandler:     at java.lang.reflect.Method.invoke(Native Method)
01-30 11:32:58.546 22804 22804 E GeckoCrashHandler:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
01-30 11:32:58.546 22804 22804 E GeckoCrashHandler:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

The cause of the crash being: java.lang.RuntimeException: Unable to start receiver org.mozilla.gecko.PackageReplacedReceiver: java.lang.IllegalStateException: Not allowed to start service Intent { act=load-libs cmp=org.torproject.torbrowser_alpha/org.mozilla.gecko.GeckoService }: app is in background uid UidRecord{982a65d u0a163 RCVR idle change:uncached procs:1 seq(0,0,0)}

Child Tickets

Change History (12)

comment:1 Changed 10 months ago by sysrqb

This is coming from PackageReplacedReceiver which is declared in the manifest. There's also WhatsNew, but that doesn't crash, at least.

comment:2 Changed 10 months ago by sysrqb

Right. I had a feeling this was added so Fennec would load Gecko in the background after upgrade. This provides a pre-loaded Gecko runtiime, ready when the user opens the browser.

commit 60a646160ef9cba38952e0d4d6175bc16e7797ae
Author: Jim Chen <nchen@mozilla.com>
Date:   Wed Feb 15 17:13:05 2017 -0500

    Bug 1339160 - 4. Use GeckoService to extract libs on update; r=esawin
    
    Use the GeckoService load-libs action to load and extract new libraries
    when we receive the update broadcast. This makes us not block the UI
    thread to extract libs, and lets Fennec run normally if the user
    launches Fennec right after updating.

comment:3 Changed 10 months ago by sysrqb

I think we should disable this. We don't need it, it's simply a nice feature. Mozilla changed how they handle this in 63. Bug 1467840. Upstream patch.

This came from a run-time limitation introduced in Android 8.

comment:4 Changed 10 months ago by gk

Keywords: TorBrowserTeam201901 added
Priority: MediumHigh

comment:5 Changed 10 months ago by gk

Keywords: TorBrowserTeam201902 added; TorBrowserTeam201901 removed

Moving tickets to February.

comment:6 Changed 9 months ago by gk

Keywords: TorBrowserTeam201903 added; TorBrowserTeam201902 removed

Moving remaining tickets to March.

comment:7 Changed 9 months ago by gk

Keywords: tbb-8.5 added

Tickets on our radar for 8.5

comment:8 Changed 9 months ago by gk

Keywords: tbb-8.5-must added; tbb-8.5 removed

Marking blockers for Tor Browser 8.5.

comment:9 Changed 8 months ago by sysrqb

Status: newneeds_review

Branch bug29238 for review.

comment:10 in reply to:  9 Changed 8 months ago by gk

Keywords: TorBrowserTeam201904R added; TorBrowserTeam201903 removed
Status: needs_reviewneeds_information

Replying to sysrqb:

Branch bug29238 for review.

The patch looks good. Do you have some instructions on how to test whether that's actually fixing the problem?

comment:11 Changed 8 months ago by sysrqb

Yes, install a previous version of the app and run it, then install this patched version. It should not crash after installation and opening the app again.

comment:12 Changed 8 months ago by gk

Resolution: fixed
Status: needs_informationclosed

Okay, I tried quite a bit but was not able to reproduce the original issue. :( However, the patch works for me and the change is simple enough, thus I cherry-picked it onto tor-browser-60.6.1esr-8.5-1 as commit bfa54eb8ac5dc923527f07e48d0a390314991fd3.

Note: See TracTickets for help on using tickets.