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

Add a character before the picture in demo app crashes Aztec #729

Closed
daniloercoli opened this issue Jun 21, 2018 · 17 comments
Closed

Add a character before the picture in demo app crashes Aztec #729

daniloercoli opened this issue Jun 21, 2018 · 17 comments

Comments

@daniloercoli
Copy link
Contributor

daniloercoli commented Jun 21, 2018

This is weird.
I tried to add some character before the first picture in demo app and Aztec crashed with the following stack trace:

                  java.lang.ArrayIndexOutOfBoundsException: length=39; index=-1
                      at android.text.DynamicLayout.getBlockIndex(DynamicLayout.java:646)
                      at android.widget.Editor.drawHardwareAccelerated(Editor.java:1787)
                      at android.widget.Editor.onDraw(Editor.java:1756)
                      at android.widget.TextView.onDraw(TextView.java:7723)
                      at android.view.View.draw(View.java:20338)
                      at android.view.View.updateDisplayListIfDirty(View.java:19283)
                      at android.view.View.draw(View.java:20061)
                      at android.view.ViewGroup.drawChild(ViewGroup.java:4421)
                      at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4207)
                      at android.view.View.updateDisplayListIfDirty(View.java:19274)
                      at android.view.View.draw(View.java:20061)
                      at android.view.ViewGroup.drawChild(ViewGroup.java:4421)
                      at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4207)
                      at android.view.View.draw(View.java:20341)
                      at android.widget.ScrollView.draw(ScrollView.java:2731)
                      at android.view.View.updateDisplayListIfDirty(View.java:19283)
                      at android.view.View.draw(View.java:20061)
                      at android.view.ViewGroup.drawChild(ViewGroup.java:4421)
                      at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4207)
                      at android.view.View.updateDisplayListIfDirty(View.java:19274)
                      at android.view.View.draw(View.java:20061)
                      at android.view.ViewGroup.drawChild(ViewGroup.java:4421)
                      at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4207)
                      at android.view.View.updateDisplayListIfDirty(View.java:19274)
                      at android.view.View.draw(View.java:20061)
                      at android.view.ViewGroup.drawChild(ViewGroup.java:4421)
                      at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4207)
                      at android.view.View.updateDisplayListIfDirty(View.java:19274)
                      at android.view.View.draw(View.java:20061)
                      at android.view.ViewGroup.drawChild(ViewGroup.java:4421)
                      at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4207)
                      at android.view.View.updateDisplayListIfDirty(View.java:19274)
                      at android.view.View.draw(View.java:20061)
                      at android.view.ViewGroup.drawChild(ViewGroup.java:4421)
                      at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4207)
                      at android.view.View.updateDisplayListIfDirty(View.java:19274)
                      at android.view.View.draw(View.java:20061)
                      at android.view.ViewGroup.drawChild(ViewGroup.java:4421)
                      at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4207)
                      at android.view.View.draw(View.java:20341)
                      at com.android.internal.policy.DecorView.draw(DecorView.java:979)
                      at android.view.View.updateDisplayListIfDirty(View.java:19283)
                      at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:686)
                      at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:692)
                      at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:800)
                      at android.view.ViewRootImpl.draw(ViewRootImpl.java:3451)
                      at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:3238)
                      at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2773)
                      at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1742)
                      at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7763)
                      at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
                      at android.view.Choreographer.doCallbacks(Choreographer.java:723)
                      at android.view.Choreographer.doFrame(Choreographer.java:658)
                      at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
                      at android.os.Handler.handleCallback(Handler.java:789)
                      at android.os.Handler.dispatchMessage(Handler.java:98)
                      at android.os.Looper.loop(Looper.java:164)
                      at android.app.ActivityThread.main(ActivityThread.java:6938)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

I've been able to reproduce the issue on Android 8.0 on both emulators, and real devices.

Steps to repro:

  • Start the demo app
  • Tap at the beginning of the document to show the keyboard up
  • Tap a key
  • Crash

Would be cool if someone else can verify this report, since looking at crash report it seems something internal to Android.

Tested on develop running on Android 8.0.

@koke
Copy link
Member

koke commented Jun 21, 2018

Tested on a Nexus 5 with 10.1 and it didn't crash

@daniloercoli
Copy link
Contributor Author

Reproduced on Aztec 1.3.6.

@daniloercoli
Copy link
Contributor Author

daniloercoli commented Jun 22, 2018

This is related to #516

Fabric.io reports:
5a04a91461b02d480d160132 , 5a86f7f48cb3c2fa632d5149 , and 59b55f70be077a4dcc699371

@daniloercoli
Copy link
Contributor Author

We can try to follow the suggestion reported in the Google bug report and disable Hardware acceleration. editText.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
Not quite sure if disabling HW Acceleration could open other potential problems.

@hypest
Copy link
Contributor

hypest commented Jun 22, 2018

Just commenting on the potential fix by using software rendering, I'd consider dropping hardware acceleration quite an extreme measure, one that would most probably harm Aztec's performance even more.

@daniloercoli
Copy link
Contributor Author

Unfortunately doesn't seem other options are available to fix the issue. Except waiting until Google fixes it in the platform. We're waiting since 2017 anyway.
In the meantime the number of crashes is raising (if you sum all the HardwareAccelerated crashes in fabric.io the number is going to be consistent).

@hypest
Copy link
Contributor

hypest commented Jun 22, 2018

Will assign this issue to myself and try to investigate as well.

@hypest hypest self-assigned this Jun 22, 2018
@koke
Copy link
Member

koke commented Jun 22, 2018

Even if there is no other solution, this crash seems to be affecting less than 0.07% of our users (if I counted this right). I'd imagine disabling hardware acceleration could potentially have worse effects on a much bigger set of users.

@daniloercoli
Copy link
Contributor Author

I'm counting 11.22% of crashes in 10.2 due to this problem. Didn't count the #of users.

@koke
Copy link
Member

koke commented Jun 22, 2018

That's right, but 10.2 has had 99.63% of crash-free sessions, so that's 11% of the 0.4% of crashed sessions, or ~0.04% of the total number of sessions.

It is one of the top Android crashes, and if we can find a way to fix it let's do it. Just not at the expense of degrading performance for the other 99%.

@daniloercoli
Copy link
Contributor Author

daniloercoli commented Jun 22, 2018

Well, if we want to have a clear picture we should only count those sessions that involved open_editor event. Without that, those numbers don't have much meaning IMO.

Or we can deduct it in another way...calculate the % of all the total sessions that called open_editor and use it to properly calculate the free-sessions with editor.

@khaykov
Copy link
Member

khaykov commented Oct 3, 2018

Based on the discussions about similar (same?) same issue in Aztec repo this might be the OS that was tracked by Google and fixed in newer OS version.

If someone else can confirm this we can probably close this issue (I assmue we are not going to disable HWA).

@drakeet
Copy link

drakeet commented Oct 14, 2018

The Oreo bug
I also encountered this problem in my application, I tried to follow the "turn off hardware acceleration" method discussed in the Google issue, but it will cause the page to not render completely (it seems to be blank), so that it is a method that does not work for me.

@drakeet
Copy link

drakeet commented Oct 16, 2018

I found a better workaround: if we remove all values < 0 of DynamicLayout before onDraw(), the crash will be fixed, and the text view can perform well.
I can reproduce it on my app Pure Writer, so I am sure the workaround works for it.

@drakeet
Copy link

drakeet commented Oct 16, 2018

If it is acceptable, I can create a PR or gist for it.

@hypest hypest removed their assignment Oct 16, 2018
@hypest
Copy link
Contributor

hypest commented Oct 17, 2018

👋 @drakeet !

values < 0 of DynamicLayout

I'm kinda confused about what that means, can you elaborate? Also, are those an indication that there's a bug somewhere else? It would be awesome if you could continue investigating towards finding the root cause of the crash here or maybe offer some insight if you have it from your experience with your own app.

I'd say that the suggestion in #729 (comment) feels a bit more hacky than we'd ideally want so, perhaps a PR with that won't get enough traction. That said, since I don't quite understand the suggestion so far, happy to revise after you expand it. Thanks!

@mzorz
Copy link
Contributor

mzorz commented Apr 2, 2019

Closing via #801

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants