Crash in [@ org.mozilla.geckoview.GeckoResult$UncaughtException: at org.mozilla.geckoview.GeckoResult.dispatchLocked] "Must have a Handler"
Categories
(GeckoView :: Extensions, defect, P3)
Tracking
(Not tracked)
People
(Reporter: agi, Unassigned)
References
Details
(Keywords: crash, Whiteboard: [geckoview:m88])
Crash Data
Crash report: https://crash-stats.mozilla.org/report/index/2cd0b068-2f67-48b2-b2db-4b08c0210309
Java stack trace:
org.mozilla.geckoview.GeckoResult$UncaughtException
at org.mozilla.geckoview.GeckoResult.dispatchLocked(GeckoResult.java:4)
at org.mozilla.geckoview.GeckoResult.completeExceptionally(GeckoResult.java:4)
at org.mozilla.geckoview.GeckoResult.lambda$thenInternal$4$GeckoResult(GeckoResult.java:10)
at org.mozilla.geckoview.-$$Lambda$GeckoResult$-hYJKiV7OmgfRN8NZFvKg9ij7nk.run(Unknown Source:8)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8506)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
Reporter | ||
Comment 1•4 years ago
|
||
Lots of these seem to be in extension code, e.g.: https://crash-stats.mozilla.org/report/index/da0213cd-e44a-4f6a-87b4-5fff30210308
org.mozilla.geckoview.GeckoResult$UncaughtException: java.lang.IllegalThreadStateException: Must have a Handler
at org.mozilla.geckoview.GeckoResult.dispatchLocked(GeckoResult.java:4)
at org.mozilla.geckoview.GeckoResult.completeExceptionally(GeckoResult.java:4)
at org.mozilla.geckoview.GeckoResult.lambda$thenInternal$4$GeckoResult(GeckoResult.java:10)
at org.mozilla.geckoview.-$$Lambda$GeckoResult$-hYJKiV7OmgfRN8NZFvKg9ij7nk.run(lambda)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7224)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: java.lang.IllegalThreadStateException: Must have a Handler
at org.mozilla.geckoview.GeckoResult.then(GeckoResult.java:4)
at org.mozilla.geckoview.GeckoResult.map(GeckoResult.java:4)
at org.mozilla.geckoview.GeckoResult.map(GeckoResult.java:1)
at org.mozilla.geckoview.WebExtensionController.closeTab(WebExtensionController.java:5)
at org.mozilla.geckoview.WebExtensionController.lambda$handleMessage$1$WebExtensionController(WebExtensionController.java:6)
at org.mozilla.geckoview.-$$Lambda$WebExtensionController$cy4tUfKhvCERfC7glVoFTwHAvqU.accept(lambda)
at org.mozilla.geckoview.GeckoResult.lambda$accept$2(GeckoResult.java:1)
at org.mozilla.geckoview.-$$Lambda$GeckoResult$jOTMkpkhFSpBCw69vbWxDq7m7Tw.onValue(lambda)
at org.mozilla.geckoview.GeckoResult.lambda$thenInternal$4$GeckoResult(GeckoResult.java:2)
... 8 more
Reporter | ||
Comment 2•4 years ago
|
||
or https://crash-stats.mozilla.org/report/index/9e63fcfe-4fba-414f-bae8-dcf680210309
org.mozilla.geckoview.GeckoResult$UncaughtException: java.lang.IllegalThreadStateException: Must have a Handler
at org.mozilla.geckoview.GeckoResult.dispatchLocked(GeckoResult.java:4)
at org.mozilla.geckoview.GeckoResult.completeExceptionally(GeckoResult.java:4)
at org.mozilla.geckoview.GeckoResult.lambda$thenInternal$4$GeckoResult(GeckoResult.java:10)
at org.mozilla.geckoview.-$$Lambda$GeckoResult$-hYJKiV7OmgfRN8NZFvKg9ij7nk.run(Unknown Source:8)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7660)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by: java.lang.IllegalThreadStateException: Must have a Handler
at org.mozilla.geckoview.GeckoResult.then(GeckoResult.java:4)
at org.mozilla.geckoview.GeckoResult.map(GeckoResult.java:4)
at org.mozilla.geckoview.GeckoResult.map(GeckoResult.java:1)
at org.mozilla.geckoview.WebExtensionController.updateTab(WebExtensionController.java:9)
at org.mozilla.geckoview.WebExtensionController.lambda$handleMessage$1$WebExtensionController(WebExtensionController.java:4)
at org.mozilla.geckoview.-$$Lambda$WebExtensionController$cy4tUfKhvCERfC7glVoFTwHAvqU.accept(Unknown Source:17)
at org.mozilla.geckoview.GeckoResult.lambda$accept$2(GeckoResult.java:1)
at org.mozilla.geckoview.-$$Lambda$GeckoResult$jOTMkpkhFSpBCw69vbWxDq7m7Tw.onValue(Unknown Source:2)
at org.mozilla.geckoview.GeckoResult.lambda$thenInternal$4$GeckoResult(GeckoResult.java:2)
... 8 more
Reporter | ||
Comment 4•4 years ago
|
||
At first glance, this doesn't make any sense. We should always run these handlers in the UI thread, so how do we not have a Handler there?
Updated•4 years ago
|
Reporter | ||
Comment 5•4 years ago
|
||
Turns out this signature has many causes, one of these was the one in Comment 2 which was fixed by Bug 1697270 (and AC's patch: https://github.com/mozilla-mobile/android-components/commit/3d378508505d9c1d51a4fb6bb61243a90243eb47 )
Opened Bug 1698823 for another one that's GeckoView-related.
Reporter | ||
Comment 6•4 years ago
|
||
Also willkg is looking into improving the signature in socorro (long term)
Comment 7•4 years ago
|
||
Signature generation for Java crashes is pretty mediocre in Socorro currently. I've been working on improving that.
Tracker bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1541120
I could use more help finding signatures that are unhelpful and figuring out better signatures so we can hone in on a better algorithm.
Reporter | ||
Comment 8•4 years ago
|
||
From what I can see the remaining crashes in this signature are generic OOMs. Not sure what we can do about those.
Caused by: java.lang.OutOfMemoryError: OutOfMemoryError thrown while trying to throw OutOfMemoryError; no stack trace available
Reporter | ||
Updated•4 years ago
|
Updated•4 years ago
|
Comment 9•4 years ago
|
||
I saw this Must have a Handler
exception when installing an extension from a Kotlin coroutine running on other the Main Dispatcher.
And fixed it by switching to using Main (here).
The Main thread has a Looper / Handler. Other threads used by coroutines do not.
I imagine there's some Handler Message communication in GV related to GeckoResult
s ?
If all these reports stem from code called in a coroutine we probably don't want that to be on a background thread that can be shutdown at any time.
Updated•4 years ago
|
Updated•3 years ago
|
Updated•2 years ago
|
Comment 10•2 years ago
|
||
I don't see any recent crash reports with "Must have a Handler" in the "java stack trace raw" field
Updated•2 years ago
|
Comment 11•1 year ago
•
|
||
Some related discussion to this root issue may have happened in bug 1877588. Linking it to this one in case the crash ever comes back. The discussion on this bug helped me understand what was happening in my case too.
Description
•