Closed Bug 837379 Opened 7 years ago Closed 2 years ago

java.lang.IllegalArgumentException: invalid span offsets at org.mozilla.gecko.GeckoEditable$Action.newSetSpan(GeckoEditable.java)

Categories

(Firefox for Android :: Keyboards and IME, defect, critical)

ARM
Android
defect
Not set
critical

Tracking

()

RESOLVED DUPLICATE of bug 1384829
Tracking Status
firefox20 --- affected
firefox21 --- affected
firefox22 --- affected
firefox23 --- affected
firefox24 --- affected
firefox25 --- affected

People

(Reporter: scoobidiver, Assigned: jchen)

Details

(Keywords: crash, Whiteboard: [native-crash][leave open])

Crash Data

Attachments

(2 files)

There are one crash in 20.0a1 and five in 21.0a1, including bp-6e1e3d8c-6f77-4730-b883-829c42130202.

java.lang.IllegalArgumentException: invalid span offsets
	at org.mozilla.gecko.GeckoEditable$Action.newSetSpan(GeckoEditable.java:148)
	at org.mozilla.gecko.GeckoEditable.setSpan(GeckoEditable.java:802)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:511)
	at org.mozilla.gecko.GeckoEditable.invoke(GeckoEditable.java:733)
	at $Proxy0.setSpan(Native Method)
	at android.text.method.QwertyKeyListener.onKeyDown(QwertyKeyListener.java:256)
	at android.text.method.TextKeyListener.onKeyDown(TextKeyListener.java:132)
	at org.mozilla.gecko.GeckoInputConnection.processKeyDown(GeckoInputConnection.java:439)
	at org.mozilla.gecko.GeckoInputConnection.onKeyDown(GeckoInputConnection.java:412)
	at org.mozilla.gecko.gfx.LayerView.onKeyDown(LayerView.java:224)
	at android.view.KeyEvent.dispatch(KeyEvent.java:2687)
	at android.view.View.dispatchKeyEvent(View.java:5515)
	at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1242)
	at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1246)
	at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1246)
	at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1246)
	at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1246)
	at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1246)
	at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1246)
	at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchKeyEvent(PhoneWindow.java:1907)
	at com.android.internal.policy.impl.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1380)
	at android.app.Activity.dispatchKeyEvent(Activity.java:2374)
	at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1834)
	at android.view.ViewRootImpl.deliverKeyEventPostIme(ViewRootImpl.java:3454)
	at android.view.ViewRootImpl.handleFinishedEvent(ViewRootImpl.java:3427)
	at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2576)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loop(Looper.java:137)
	at android.app.ActivityThread.main(ActivityThread.java:4697)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:511)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
	at dalvik.system.NativeStart.main(Native Method)

More reports at:
https://crash-stats.mozilla.com/report/list?signature=java.lang.IllegalArgumentException%3A+invalid+span+offsets+at+org.mozilla.gecko.GeckoEditable%24Action.newSetSpan%28GeckoEditable.java%29
There's another stack trace more frequent:
java.lang.IllegalArgumentException: invalid span offsets
	at org.mozilla.gecko.GeckoEditable$Action.newSetSpan(GeckoEditable.java:167)
	at org.mozilla.gecko.GeckoEditable.setSpan(GeckoEditable.java:1043)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:511)
	at org.mozilla.gecko.GeckoEditable.invoke(GeckoEditable.java:972)
	at $Proxy0.setSpan(Native Method)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:511)
	at org.mozilla.gecko.GeckoInputConnection$InputThreadUtils$3$1.run(GeckoInputConnection.java:159)
	at org.mozilla.gecko.GeckoInputConnection$InputThreadUtils.waitForUiThread(GeckoInputConnection.java:120)
	at org.mozilla.gecko.GeckoInputConnection.sendKeyEvent(GeckoInputConnection.java:718)
	at com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:364)
	at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:77)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loop(Looper.java:137)
	at org.mozilla.gecko.GeckoInputConnection$1.run(GeckoInputConnection.java:486)
	at java.lang.Thread.run(Thread.java:856)
Jim any thoughts on what is going on here?
Jim, we should update GeckoEditable's IllegalArgumentExceptions to include the invalid arguments' actual values. This will make debugging much easier. <:)
(In reply to Kevin Brosnan [:kbrosnan] from comment #2)
> Jim any thoughts on what is going on here?

The stack is not very clear to me. Could be a bug on our end or IME's end.

(In reply to Chris Peterson (:cpeterson) from comment #3)
> Jim, we should update GeckoEditable's IllegalArgumentExceptions to include
> the invalid arguments' actual values. This will make debugging much easier.
> <:)

Good idea!
Assignee: nobody → nchen
Patch to have better exception messages
Attachment #759117 - Flags: review?(cpeterson)
Whiteboard: [native-crash] → [native-crash][leave open]
Comment on attachment 759117 [details] [diff] [review]
Log better exception messages in GeckoEditable (v1)

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

LGTM! :D
Attachment #759117 - Flags: review?(cpeterson) → review+
Here is a crash report with more info: bp-1f617790-53c8-4c8a-8720-4ca202130618.

java.lang.IllegalArgumentException: invalid span offsets: -1 to 0
	at org.mozilla.gecko.GeckoEditable$Action.newSetSpan(GeckoEditable.java:169)
	at org.mozilla.gecko.GeckoEditable.setSpan(GeckoEditable.java:1049)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:511)
	at org.mozilla.gecko.GeckoEditable.invoke(GeckoEditable.java:978)
	at $Proxy0.setSpan(Native Method)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:511)
	at org.mozilla.gecko.GeckoInputConnection$InputThreadUtils$3$1.run(GeckoInputConnection.java:161)
	at org.mozilla.gecko.GeckoInputConnection$InputThreadUtils.waitForUiThread(GeckoInputConnection.java:122)
	at org.mozilla.gecko.GeckoInputConnection.sendKeyEvent(GeckoInputConnection.java:717)
	at com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:364)
	at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:77)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loop(Looper.java:137)
	at org.mozilla.gecko.GeckoInputConnection$1.run(GeckoInputConnection.java:485)
	at java.lang.Thread.run(Thread.java:856)
Crash Signature: [@ java.lang.IllegalArgumentException: invalid span offsets at org.mozilla.gecko.GeckoEditable$Action.newSetSpan(GeckoEditable.java)] → [@ java.lang.IllegalArgumentException: invalid span offsets at org.mozilla.gecko.GeckoEditable$Action.newSetSpan(GeckoEditable.java)] [@ java.lang.IllegalArgumentException: invalid span offsets: -1 to 0 at org.mozilla.gecko.GeckoEditable$Action.newSetSpa…
I think we still need more information. This exception is happening off the main thread, but it's based on something that's happening on the main thread, so I think for off-main-thread exceptions, we should log the main thread stack also. This may help with other threading bugs too.
Attachment #764757 - Flags: review?(cpeterson)
Comment on attachment 764757 [details] [diff] [review]
Log main thread stack for off-main-thread exceptions (v1)

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

LGTM!

::: mobile/android/base/GeckoAppShell.java
@@ +196,5 @@
> +                    Thread mainThread = ThreadUtils.getUiThread();
> +                    if (mainThread != null && thread != mainThread) {
> +                        Log.e(LOGTAG, "Main thread stack:");
> +                        for (StackTraceElement ste : mainThread.getStackTrace()) {
> +                            Log.e(LOGTAG, ste.toString());

It would be nice if we could reuse or refactor the existing getStackTraceString(Throwable e) code so our exception logging is always consistent. But not a deal breaker. :)
Attachment #764757 - Flags: review?(cpeterson) → review+
Here is a post-investigation-patch crash report: bp-534e168b-06a9-4810-81eb-b53212130713.
Crash Signature: org.mozilla.gecko.GeckoEditable$Action.newSetSpan(GeckoEditable.java) ] → org.mozilla.gecko.GeckoEditable$Action.newSetSpan(GeckoEditable.java) ] [@ java.lang.IllegalArgumentException: invalid span offsets at org.mozilla.gecko.GeckoEditable$Action.newSetSpan] [@ java.lang.IllegalArgumentException: invalid span offsets: -1 to…
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1384829
You need to log in before you can comment on or make changes to this bug.