Main thread waiting for session parsing to finish isn't released after parsing has terminated

RESOLVED FIXED in Firefox 49

Status

()

Firefox for Android
General
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: nalexander, Assigned: JanH)

Tracking

49 Branch
Firefox 50
All
Android
Points:
---

Firefox Tracking Flags

(firefox47 unaffected, firefox48 unaffected, firefox49 fixed, fennec49+, firefox50 fixed)

Details

MozReview Requests

()

Submitter Diff Changes Open Issues Last Updated
Loading...
Error loading review requests:

Attachments

(3 attachments)

(Reporter)

Description

2 years ago
I am unable to start Nightly for some time (weeks) and have accepted perhaps half a dozen updates in this time.  Starting Nightly shows a white screen with no UI before the system prompts to kill the App.

I finally attached my device and grabbed two logcats, which I will attach.
(Reporter)

Comment 1

2 years ago
Created attachment 8761692 [details]
|adb logcat| while trying to start Gecko
(Reporter)

Comment 2

2 years ago
Created attachment 8761693 [details]
|adb logcat| while trying to start Gecko
(Reporter)

Comment 3

2 years ago
Further investigation reveals this to be a catastrophic failure during session restore.  I'm not comfortable posting my sessionstore.js publicly, but I've emailed it to Sebastian and JanH.

Updated

2 years ago
tracking-fennec: --- → ?
(Assignee)

Comment 4

2 years ago
What happens is that if the main thread arrives here (https://dxr.mozilla.org/mozilla-central/rev/b6f7d0eb61b1878d3d906bd231edf225463ece3f/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java#1539) before the background thread has finished parsing the session data, it will never be released again even though the background thread is calling notifyAll() (https://dxr.mozilla.org/mozilla-central/rev/b6f7d0eb61b1878d3d906bd231edf225463ece3f/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java#1304).

The problem is that the session data parsing is running from within a Runnable, so the "this" there is not the same "this" as on the main thread, so notifyAll() naturally won't work.
Assignee: nobody → jh+bugzilla
Blocks: 905223
No longer blocks: 1233799
status-firefox47: --- → unaffected
status-firefox48: --- → unaffected
status-firefox49: --- → affected
status-firefox50: --- → affected
Summary: Timeout executing service: ServiceRecord{... ... org.mozilla.fennec/org.mozilla.gecko.dlc.DownloadContentService} → Main thread waiting for session parsing to finish isn't released after parsing has terminated
(Assignee)

Updated

2 years ago
OS: Unspecified → Android
Hardware: Unspecified → All
Version: unspecified → 49 Branch
(Assignee)

Comment 5

2 years ago
Created attachment 8762403 [details]
Bug 1279273 - Use correct synchronization object for session data parsing.

If the main thread has to wait for the session data parsing to finish - which is more likely when you've got many tabs open, meaning a large sessionstore.js file - it does so on "this", i.e. GeckoApp.
The session data parsing itself is done from within a Runnable, so we need to qualify "this" there if we want it to refer to GeckoApp itself, so we can successfully release any waiting threads through notifyAll().

Review commit: https://reviewboard.mozilla.org/r/59094/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/59094/
Attachment #8762403 - Flags: review?(s.kaspari)
Attachment #8762403 - Flags: review?(s.kaspari) → review+
Comment on attachment 8762403 [details]
Bug 1279273 - Use correct synchronization object for session data parsing.

https://reviewboard.mozilla.org/r/59094/#review56230

Ah, nice!
(Assignee)

Comment 8

2 years ago
Comment on attachment 8762403 [details]
Bug 1279273 - Use correct synchronization object for session data parsing.

Approval Request Comment
[Feature/regressing bug #]: Mobile session restoring, bug 905223
[User impact if declined]: Firefox might hang during startup, especially for users with lots of open tabs.
[Describe test coverage new/current, TreeHerder]: manual
[Risks and why]: Low, this just ensures that waiting and notifying threads are actually using the same synchronization object.
[String/UUID change made/needed]: none
Attachment #8762403 - Flags: approval-mozilla-aurora?

Comment 9

2 years ago
Pushed by cbook@mozilla.com:
https://hg.mozilla.org/integration/fx-team/rev/53f5b5c289fb
Use correct synchronization object for session data parsing. r=sebastian
Keywords: checkin-needed

Comment 10

2 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/53f5b5c289fb
Status: NEW → RESOLVED
Last Resolved: 2 years ago
status-firefox50: affected → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 50

Updated

2 years ago
tracking-fennec: ? → 49+
Comment on attachment 8762403 [details]
Bug 1279273 - Use correct synchronization object for session data parsing.

Recent regression in session store, we definitely want to fix this on aurora 49.
Attachment #8762403 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+

Comment 12

2 years ago
bugherderuplift
https://hg.mozilla.org/releases/mozilla-aurora/rev/c83de296c78d
status-firefox49: affected → fixed
You need to log in before you can comment on or make changes to this bug.