Closed Bug 1236643 Opened 8 years ago Closed 8 years ago

Revisit IME shutdown sequence on nsWindow closing

Categories

(Core Graveyard :: Widget: Android, defect)

All
Android
defect
Not set
normal

Tracking

(firefox44+ fixed, firefox45 fixed, firefox46 fixed, b2g-v2.5 fixed)

RESOLVED FIXED
mozilla46
Tracking Status
firefox44 + fixed
firefox45 --- fixed
firefox46 --- fixed
b2g-v2.5 --- fixed

People

(Reporter: jchen, Assigned: jchen)

References

Details

Attachments

(3 files)

Bug 1211704 tried to fix some of the bugs related to IME shutdown, but it's incomplete. In particular, after nsWindow closes and GeckoEditable shuts down, GeckoView can be left in an indeterminate state that can lead to crashes.
To guarantee that GeckoInputConnection and GeckoEditable are not used by
GeckoView after GeckoEditable has been destroyed, we need to make sure a
certain sequence is followed. We should first unset the
InputConnectionListener in GeckoView on the UI thread; then unset the
GeckoEditableListener on the IC thread; and finally finish destroying
the GeckoEditable instance through disposeNative. This patch merges this
logic with the initialization logic in GeckoEditable.onViewChange, so
that onViewChange can be used for both initialization and destruction.
Attachment #8703774 - Flags: review?(esawin)
Right now GeckoInputConnection uses GeckoAppShell to get its view, but
it should be keeping its own View reference to support multiple
GeckoViews.
Attachment #8703775 - Flags: review?(esawin)
Comment on attachment 8703774 [details] [diff] [review]
Reorder GeckoEditable destruction sequence (v1)

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

::: mobile/android/base/java/org/mozilla/gecko/GeckoEditable.java
@@ +420,5 @@
>                      Log.d(LOGTAG, "onViewChange (set listener)");
>                  }
> +
> +                if (newListener != null) {
> +                    // Make sure there are no other things going on

.
Attachment #8703774 - Flags: review?(esawin) → review+
Attachment #8703775 - Flags: review?(esawin) → review+
https://hg.mozilla.org/mozilla-central/rev/ef20ed15509b
https://hg.mozilla.org/mozilla-central/rev/a7af5278a657
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
Comment on attachment 8703774 [details] [diff] [review]
Reorder GeckoEditable destruction sequence (v1)

Requesting uplift for both patches. (Asking for Aurora now; I think Beta may be affected but I'm not sure of the impact at the moment. We should uplift to Beta if we see lots of shutdown/restart crashes.)

Approval Request Comment
[Feature/regressing bug #]: Bug 1051556
[User impact if declined]: Possible crash when shutting down / restarting Fennec (e.g. after installing an addon)
[Describe test coverage new/current, TreeHerder]: Locally, m-c
[Risks and why]: Small. There is some risk in introducing new code, but it only affects shutdown, so the overall risk is limited.
[String/UUID change made/needed]: None
Attachment #8703774 - Flags: approval-mozilla-aurora?
Comment on attachment 8703774 [details] [diff] [review]
Reorder GeckoEditable destruction sequence (v1)

Fix some potential crashes, taking it.
Attachment #8703774 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
[Tracking Requested - why for this release]: Crash regression on 44
Attached patch Patch for BetaSplinter Review
Approval Request Comment
[Feature/regressing bug #]: Bug 1051556
[User impact if declined]: Top-crash for beta
[Describe test coverage new/current, TreeHerder]: Locally, m-c
[Risks and why]: Small; patch only affects shutdown path so impact is limited
[String/UUID change made/needed]: None
Attachment #8708016 - Flags: review+
Attachment #8708016 - Flags: approval-mozilla-beta?
Jim, Kevin: Do we have data from Aurora/Nightly that supports the fact that these patches do fix these crashes? Given the size of the patches here, I am being extra cautious and want to make sure we are not making rushed decisions. Thoughts?
Flags: needinfo?(nchen)
Flags: needinfo?(kbrosnan)
Comment on attachment 8708016 [details] [diff] [review]
Patch for Beta

As such the size of this patches gives me a lot of anxiety but I trust Margaret's judgement on the risk involved. Let's uplift to Beta44 with the hopes that this helps improve Fennec stability.
Attachment #8708016 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
I haven't looked at the overall numbers. I did look at a few Beta crash reports, and this patch will definitely fix some of them, or even most of them (the quality of the crash reports is not good enough to say for sure).
Flags: needinfo?(nchen)
(In reply to Jim Chen [:jchen] [:darchons] from comment #14)
> I haven't looked at the overall numbers. I did look at a few Beta crash
> reports, and this patch will definitely fix some of them, or even most of
> them (the quality of the crash reports is not good enough to say for sure).

Great! Thanks for the prompt reply and I am really glad we are taking a fix that is already showing good signs of fixing the crash.
This signature does not appear on 46.0a1 or 45.0a2 after the fix was applied.
Flags: needinfo?(kbrosnan)
(In reply to Kevin Brosnan [:kbrosnan] from comment #16)
> This signature does not appear on 46.0a1 or 45.0a2 after the fix was applied.

Nice! Thanks Kevin.
Could not verify this since no crashes were encountered in our today's test session.
Will verify after more data from the crash stats is gathered.
Depends on: 1240506
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: