Nightly does not start up at first attempt

VERIFIED FIXED in Firefox 65

Status

()

defect
P1
normal
VERIFIED FIXED
6 months ago
6 months ago

People

(Reporter: levente.sacal, Assigned: droeh)

Tracking

({regression})

Firefox 65
Firefox 65
ARM
Android
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox63 unaffected, firefox64 unaffected, firefox65+ verified)

Details

Attachments

(1 attachment)

Reporter

Description

6 months ago
Device(s):
 -  Huawei M3 Tab (Android 7.0);
 -  Google Pixel C (Android 8.0);
 -  Sony Xperia Z5 (Android 7.0)
 -  Nexus 9 (Android 6.0.1)


Build(s):
 - Nightly 65.0a1 (2018-11-27);


Steps to reproduce:
 1. Start up Nightly
 2. Close Nightly 
 3. Try to open Nightly from the first tap

Expected result:
 
- Nightly should open from the first attempt

Actual result:

- Nightly only opens up from the second attempt

Notes:

- The issue happens at every second start up on 
- On Sony Xperia Z5 (Android 7.0) could not reproduce the issue constantly. It happens randomly
- The issue does not happen when force stopping the app

https://youtu.be/c_QizOzJ7jI
This sounds bad.
Flags: needinfo?(sdaswani)
Reporter

Comment 2

6 months ago
I have ran a regression window:

Last good revision: 2018-11-20  eeddcefcdad847bf8a5737153079e9619ee5aa66  Pushlog: https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=e44bb5b4bc79be613d29b3f95d7b508e68e3d128&tochange=7488645b27ac9b273d6785db04204684673b3657

First bad revision: 2018-11-21  7488645b27ac9b273d6785db04204684673b3657  Pushlog: https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=eeddcefcdad847bf8a5737153079e9619ee5aa66&tochange=76c1898f6b021986beccc1461b1800ebe9f9e251

Comment 3

6 months ago
Vlad can someone look at this ASAP?
Flags: needinfo?(sdaswani) → needinfo?(vlad.baicu)
Priority: -- → P1
Reporter

Comment 5

6 months ago
Thank you for your reply and for the Android change that might affect this issue.
Tested this extensively with Levente.
The issue seems to have been caused by the patch from bug 1494748.

For whatever reason (probably Android thinks the app has inadvertently crashed) ActivityManager starts a new process for us after `Process.killProcess(Process.myPid())`

> 14:38:30.885 3675-4846/? I/ActivityManager: Start proc 18617:org.mozilla.fennec_petru.lingurar/u0a475 for activity org.mozilla.fennec_petru.lingurar/org.mozilla.gecko.App
> 14:38:31.323 18617-18617/org.mozilla.fennec_petru.lingurar E/Levente: App started (BrowserApp - onCreate())
> 14:38:31.889 18617-18617/org.mozilla.fennec_petru.lingurar E/Levente: Will start FennecKiller from BrowserApp's onResume()
> 14:38:32.233 18617-18617/org.mozilla.fennec_petru.lingurar E/Levente: FennecKiller started (from BrowserApp's onStart())
> 14:38:40.164 18617-18617/org.mozilla.fennec_petru.lingurar E/Levente: BrowserApp's onDestroy() called
> 14:38:40.222 18617-18617/org.mozilla.fennec_petru.lingurar E/Levente: onTaskRemoved called with Intent: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=org.mozilla.fennec_petru.lingurar/org.mozilla.gecko.BrowserApp }
> 14:38:40.222 18617-18617/org.mozilla.fennec_petru.lingurar E/Levente: Will now kill process: 18617
>
> 14:38:41.311 3675-3694/? I/ActivityManager: Start proc 19184:org.mozilla.fennec_petru.lingurar/u0a475 for service org.mozilla.fennec_petru.lingurar/org.mozilla.gecko.FennecKiller
> 14:38:41.525 19184-19184/? E/Levente: onTaskRemoved called with Intent: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=org.mozilla.fennec_petru.lingurar/org.mozilla.gecko.BrowserApp }
> 14:38:41.525 19184-19184/? E/Levente: Will now kill process: 19184
>
> 14:38:41.547 3675-4562/? I/ActivityManager: Start proc 19203:org.mozilla.fennec_petru.lingurar/u0a475 for activity org.mozilla.fennec_petru.lingurar/org.mozilla.gecko.App
> 14:38:41.732 19203-19203/org.mozilla.fennec_petru.lingurar E/Levente: onTaskRemoved called with Intent: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=org.mozilla.fennec_petru.lingurar/org.mozilla.gecko.BrowserApp }
> 14:38:41.732 19203-19203/org.mozilla.fennec_petru.lingurar E/Levente: Will now kill process: 19203
>
> 14:38:41.757 3675-20070/? I/ActivityManager: Start proc 19222:org.mozilla.fennec_petru.lingurar/u0a475 for activity org.mozilla.fennec_petru.lingurar/org.mozilla.gecko.BrowserApp
> 14:38:41.913 19222-19222/org.mozilla.fennec_petru.lingurar E/Levente: App started (BrowserApp - onCreate())
> 14:38:42.296 19222-19222/org.mozilla.fennec_petru.lingurar E/Levente: Will start FennecKiller from BrowserApp's onResume()
> 14:38:42.566 19222-19222/org.mozilla.fennec_petru.lingurar E/Levente: FennecKiller started (from BrowserApp's onStart())

This logs can be found in a try build - https://hg.mozilla.org/try/rev/356eff1e62a03217f38a1ee84f2feff48df945ec

Trying to replace `Process.killProcess(Process.myPid())` with System.exit(0) causes
> W/ActivityManager: Scheduling restart of crashed service org.mozilla.fennec_petru.lingurar/org.mozilla.gecko.FennecKiller

Trying to replace `Process.killProcess(Process.myPid())` with ActivityManager#killBackgroundProcesses(getPackageName())
actually crashes the app with a user visible message - "xxx has stopped"

I this this should be backed out until we find a better solution.
Flags: needinfo?(vlad.baicu) → needinfo?(droeh)
The scenario for the above logs:
Started the app and removed it from recents, then press it's icon to start it again
- Fennec Killer kills our process
- ActivityManager restarts the app for FennecKiller and FennecKiller kills it
- ActivityManager restarts the app for App and FennecKiller kills it
- ActivityManager starts the app for BrowserApp (the launcher activity), as we requested. Everything works ok now.

If we are to just remove it from recents, without pressing the icon to start it again
we would see all but the last blocks of logs.
Assignee

Comment 8

6 months ago
(In reply to Petru-Mugurel Lingurar[:petru] from comment #6)
> I this this should be backed out until we find a better solution.

Agreed, I'm going to back out the patches for 1494748 and 1509342 here and look for another approach.
Flags: needinfo?(droeh)
Assignee

Comment 9

6 months ago
This just backs out patches for bug 1494748 and bug 1509342. Between this issue and startService() sometimes failing because we're somehow not foregrounded in BrowserApp.onResume(), it looks like we need a better approach here.
Assignee: nobody → droeh
Attachment #9028718 - Flags: review?(snorp)
Attachment #9028718 - Flags: review?(snorp) → review+

Comment 10

6 months ago
Pushed by droeh@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/e9a34518f078
Back out FennecKiller service for causing start-up crashes. r=snorp

Comment 11

6 months ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/e9a34518f078
Status: NEW → RESOLVED
Last Resolved: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 65
Devices:
 - OnePlus 5T (Android 8.1.0)
 - Galaxy Note 8 (Android 8)
 - HTC Desire 820 (Android 6.0.1)

Verified with the latest Nightly. The issue is no longer reproducible.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.