Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Live Markdown] Crash with MarkdownUtils.removeSpans #41867

Closed
thienlnam opened this issue May 8, 2024 · 12 comments
Closed

[Live Markdown] Crash with MarkdownUtils.removeSpans #41867

thienlnam opened this issue May 8, 2024 · 12 comments
Assignees
Labels

Comments

@thienlnam
Copy link
Contributor

Crash logs

Fatal Exception: java.lang.IndexOutOfBoundsException: charAt: 21 >= length 21
       at android.text.SpannableStringBuilder.charAt(SpannableStringBuilder.java:126)
       at android.text.CharSequenceCharacterIterator.current(CharSequenceCharacterIterator.java:58)
       at android.text.CharSequenceCharacterIterator.setIndex(CharSequenceCharacterIterator.java:83)
       at android.icu.text.RuleBasedBreakIterator.CISetIndex32(RuleBasedBreakIterator.java:1055)
       at android.icu.text.RuleBasedBreakIterator.isBoundary(RuleBasedBreakIterator.java:549)
       at android.text.method.WordIterator.isBoundary(WordIterator.java:102)
       at android.widget.Editor$SelectionHandleView.positionAtCursorOffset(Editor.java:7885)
       at android.widget.Editor$HandleView.invalidate(Editor.java:5998)
       at android.widget.Editor$SelectionModifierCursorController.invalidateHandles(Editor.java:8845)
       at android.widget.Editor.invalidateHandlesAndActionMode(Editor.java:2527)
       at android.widget.TextView.spanChange(TextView.java:12114)
       at android.widget.TextView$ChangeWatcher.onSpanRemoved(TextView.java:15309)
       at android.text.SpannableStringBuilder.sendSpanRemoved(SpannableStringBuilder.java:1310)
       at android.text.SpannableStringBuilder.removeSpan(SpannableStringBuilder.java:515)
       at android.text.SpannableStringBuilder.removeSpan(SpannableStringBuilder.java:815)
       at android.text.SpannableStringBuilder.removeSpan(SpannableStringBuilder.java:803)
       at androidx.emoji2.text.SpannableBuilder.removeSpan(SpannableBuilder.java:179)
       at com.expensify.livemarkdown.MarkdownUtils.removeSpans(MarkdownUtils.java:182)
       at com.expensify.livemarkdown.MarkdownUtils.applyMarkdownFormatting(MarkdownUtils.java:76)
       at com.expensify.livemarkdown.MarkdownTextWatcher.onTextChanged(MarkdownTextWatcher.java:29)
       at com.facebook.react.views.textinput.ReactEditText$TextWatcherDelegator.onTextChanged(ReactEditText.java:1271)
       at android.widget.TextView.sendOnTextChanged(TextView.java:11881)
       at android.widget.TextView.handleTextChanged(TextView.java:12010)
       at android.widget.TextView$ChangeWatcher.onTextChanged(TextView.java:15271)
       at android.text.SpannableStringBuilder.sendTextChanged(SpannableStringBuilder.java:1281)
       at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:590)
       at androidx.emoji2.text.SpannableBuilder.replace(SpannableBuilder.java:315)
       at android.text.SpannableStringBuilder.delete(SpannableStringBuilder.java:232)
       at androidx.emoji2.text.SpannableBuilder.delete(SpannableBuilder.java:337)
       at androidx.emoji2.text.SpannableBuilder.delete(SpannableBuilder.java:49)
       at android.text.method.BaseKeyListener.deleteSelection(BaseKeyListener.java:439)
       at android.text.method.BaseKeyListener.backspaceOrForwardDelete(BaseKeyListener.java:334)
       at android.text.method.BaseKeyListener.backspace(BaseKeyListener.java:71)
       at android.text.method.BaseKeyListener.onKeyDown(BaseKeyListener.java:485)
       at android.text.method.QwertyKeyListener.onKeyDown(QwertyKeyListener.java:362)
       at com.facebook.react.views.textinput.ReactEditText$InternalKeyListener.onKeyDown(ReactEditText.java:1323)
       at androidx.emoji2.viewsintegration.EmojiKeyListener.onKeyDown(EmojiKeyListener.java:58)
       at android.widget.TextView.doKeyDown(TextView.java:9503)
       at android.widget.TextView.onKeyDown(TextView.java:9275)
       at android.view.KeyEvent.dispatch(KeyEvent.java:3508)
       at android.view.View.dispatchKeyEvent(View.java:15395)
       at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
       at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
       at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
       at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
       at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
       at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
       at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
       at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
       at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
       at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
       at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
       at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
       at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
       at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
       at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
       at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
       at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
       at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
       at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
       at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
       at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
       at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
       at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
       at com.facebook.react.ReactRootView.dispatchKeyEvent(ReactRootView.java:302)
       at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
       at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
       at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
       at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
       at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
       at com.android.internal.policy.DecorView.superDispatchKeyEvent(DecorView.java:1104)
       at com.android.internal.policy.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1961)
       at android.app.Activity.dispatchKeyEvent(Activity.java:4342)
       at androidx.core.app.ComponentActivity.superDispatchKeyEvent(ComponentActivity.java:120)
       at androidx.core.view.KeyEventDispatcher.dispatchKeyEvent(KeyEventDispatcher.java:85)
       at androidx.core.app.ComponentActivity.dispatchKeyEvent(ComponentActivity.java:138)
       at androidx.appcompat.app.AppCompatActivity.dispatchKeyEvent(AppCompatActivity.java:604)
       at androidx.appcompat.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:60)
       at androidx.appcompat.app.AppCompatDelegateImpl$AppCompatWindowCallback.dispatchKeyEvent(AppCompatDelegateImpl.java:3413)
       at com.android.internal.policy.DecorView.dispatchKeyEvent(DecorView.java:928)
       at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:8056)
       at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:7864)
       at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:7213)
       at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:7270)
       at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:7236)
       at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:7434)
       at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:7244)
       at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:7491)
       at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:7217)
       at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:7270)
       at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:7236)
       at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:7244)
       at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:7217)
       at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:10788)
       at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:10676)
       at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:10632)
       at android.view.ViewRootImpl$ViewRootHandler.handleMessageImpl(ViewRootImpl.java:6822)
       at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:6697)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loopOnce(Looper.java:226)
       at android.os.Looper.loop(Looper.java:313)
       at android.app.ActivityThread.main(ActivityThread.java:8762)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)

Device details
OS version: android13
Model:Galaxy A32 5G
1.4.71-0 (1001047100)

@thienlnam
Copy link
Contributor Author

@tomekzaw We saw this crash related to live markdown, it's only happened to a single device so far so it might not be that urgent but are you able to take a look to see if it's anything serious?

@tomekzaw
Copy link
Contributor

tomekzaw commented May 8, 2024

Sure, will take a look! Please assign me

@melvin-bot melvin-bot bot added the Overdue label May 13, 2024
@thienlnam thienlnam added Weekly KSv2 and removed Daily KSv2 labels May 13, 2024
@melvin-bot melvin-bot bot removed the Overdue label May 13, 2024
@thienlnam
Copy link
Contributor Author

SWM is out for conferences - I just checked and there still has only been the one crash with this so doesn't seem to be that urgent

@melvin-bot melvin-bot bot added the Overdue label May 22, 2024
@thienlnam
Copy link
Contributor Author

@tomekzaw Putting this back on your radar - seems like this happened again in a recent version so it's still here

OS version: android14
Model:Pixel 7
App version:1.4.74-6 (1001047406)
com.expensify.chat_issue_239b7128dc46892a6cb0a7442698cbd2_crash_session_66560C8C00EF00013D5FC09E54643F64_DNE_0_v2_stacktrace.txt

@melvin-bot melvin-bot bot removed the Overdue label May 29, 2024
@melvin-bot melvin-bot bot added the Overdue label Jun 6, 2024
@thienlnam
Copy link
Contributor Author

@tomekzaw Could we get someone to look into this if you're busy?

@melvin-bot melvin-bot bot removed the Overdue label Jun 7, 2024
@tomekzaw
Copy link
Contributor

tomekzaw commented Jun 7, 2024

@thienlnam I could take a look at it, but do we have any reproduction steps for this one?

@thienlnam
Copy link
Contributor Author

Nope, nothing reported as such - but I can get you more stack traces if you need

@tomekzaw
Copy link
Contributor

tomekzaw commented Jun 7, 2024

This reminds me of the Grammarly issue in React Native, do we have any more information about the devices?

@melvin-bot melvin-bot bot added the Overdue label Jun 17, 2024
@thienlnam
Copy link
Contributor Author

Just these two instances so far.

Model:Galaxy A32 5G
OS version: android13

OS version: android14
Model:Pixel 7

@melvin-bot melvin-bot bot removed the Overdue label Jun 18, 2024
@thienlnam
Copy link
Contributor Author

Given how infrequently this happens - I'm just going to put this on a monthly so we can track this, but perhaps not the best use of time right now

@thienlnam thienlnam added Monthly KSv2 and removed Weekly KSv2 labels Jun 18, 2024
@thienlnam thienlnam moved this to LOW in Live Markdown Jun 19, 2024
@melvin-bot melvin-bot bot added the Overdue label Jul 22, 2024
@thienlnam
Copy link
Contributor Author

Still happens infrequently, here's the latest for the most recent crash on
App version:9.0.7-4 (1009000704)
OS version: android14
Model:Galaxy Z Fold4
com.expensify.chat_issue_239b7128dc46892a6cb0a7442698cbd2_crash_session_66968E0E0041000140DEADCD5390456D_DNE_0_v2_stacktrace.txt

@melvin-bot melvin-bot bot removed the Overdue label Jul 23, 2024
@melvin-bot melvin-bot bot added the Overdue label Aug 23, 2024
@thienlnam
Copy link
Contributor Author

Going to close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

No branches or pull requests

2 participants