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

Recurrent crash (reported by Play Store): java.lang.RuntimeException: at com.otaliastudios.zoom.ZoomLayout.onMeasure #225

Open
nathanfallet opened this issue Apr 4, 2022 · 3 comments

Comments

@nathanfallet
Copy link

Describe the bug

Please add a clear description of what the bug is, and fill the list below.

  • Library version: 1.9.0
  • Reproducible in official demo app: unknown
  • Device / Android version: POCO F3 - Android 12 (SDK 31), Samsung Galaxy A51 - Android 11 (SDK 30), Umidigi BISON - Android 10 (SDK 29), Realme realme C21 - Android 11 (SDK 30), ... (75 crashes on last 30 days for 300 active users, so it's a lot)

Additional information

This library is used via https://github.com/markusressel/KodeEditor that we use in our app

Logs

java.lang.RuntimeException: 
  at com.otaliastudios.zoom.ZoomLayout.onMeasure (ZoomLayout.kt:121)
  at android.view.View.measure (View.java:26207)
  at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:7020)
  at android.widget.LinearLayout.measureChildBeforeLayout (LinearLayout.java:1552)
  at android.widget.LinearLayout.measureHorizontal (LinearLayout.java:1204)
  at android.widget.LinearLayout.onMeasure (LinearLayout.java:723)
  at android.view.View.measure (View.java:26207)
  at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:7020)
  at android.widget.FrameLayout.onMeasure (FrameLayout.java:194)
  at android.view.View.measure (View.java:26207)
  at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:7020)
  at android.widget.FrameLayout.onMeasure (FrameLayout.java:194)
  at android.view.View.measure (View.java:26207)
  at android.widget.LinearLayout.measureHorizontal (LinearLayout.java:1185)
  at android.widget.LinearLayout.onMeasure (LinearLayout.java:723)
  at android.view.View.measure (View.java:26207)
  at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:7020)
  at android.widget.FrameLayout.onMeasure (FrameLayout.java:194)
  at androidx.appcompat.widget.ContentFrameLayout.onMeasure (ContentFrameLayout.java:145)
  at android.view.View.measure (View.java:26207)
  at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:7020)
  at androidx.appcompat.widget.ActionBarOverlayLayout.onMeasure (ActionBarOverlayLayout.java:496)
  at android.view.View.measure (View.java:26207)
  at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:7020)
  at android.widget.FrameLayout.onMeasure (FrameLayout.java:194)
  at android.view.View.measure (View.java:26207)
  at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:7020)
  at android.widget.LinearLayout.measureChildBeforeLayout (LinearLayout.java:1552)
  at android.widget.LinearLayout.measureVertical (LinearLayout.java:842)
  at android.widget.LinearLayout.onMeasure (LinearLayout.java:721)
  at android.view.View.measure (View.java:26207)
  at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:7020)
  at android.widget.FrameLayout.onMeasure (FrameLayout.java:194)
  at com.android.internal.policy.DecorView.onMeasure (DecorView.java:820)
  at android.view.View.measure (View.java:26207)
  at android.view.ViewRootImpl.performMeasure (ViewRootImpl.java:3770)
  at android.view.ViewRootImpl.measureHierarchy (ViewRootImpl.java:2544)
  at android.view.ViewRootImpl.performTraversals (ViewRootImpl.java:2823)
  at android.view.ViewRootImpl.doTraversal (ViewRootImpl.java:2259)
  at android.view.ViewRootImpl$TraversalRunnable.run (ViewRootImpl.java:8961)
  at android.view.Choreographer$CallbackRecord.run (Choreographer.java:1142)
  at android.view.Choreographer.doCallbacks (Choreographer.java:946)
  at android.view.Choreographer.doFrame (Choreographer.java:875)
  at android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:1127)
  at android.os.Handler.handleCallback (Handler.java:938)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loopOnce (Looper.java:210)
  at android.os.Looper.loop (Looper.java:299)
  at android.app.ActivityThread.main (ActivityThread.java:8087)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:556)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1045)

APK

From app: https://github.com/GroupeMINASTE/OCaml (available on the store at https://play.google.com/store/apps/details?id=me.nathanfallet.ocaml)

@stale
Copy link

stale bot commented Apr 27, 2022

This issue has been automatically marked as stale because it has not had activity in the last 20 days. It will be closed if no further activity occurs within the next seven days. Thank you for your contributions.

@stale stale bot added the status:stale label Apr 27, 2022
@nathanfallet
Copy link
Author

The issue is still happening

@prathimode
Copy link

This issue is due that a GL variable is getting updated in OnMeasure (which is running on the main thread) and onDraw( which is getting called on the GLRenderer Thread) Race condition for updating this variable is causing this issue.
In my case I was getting this crash when I was doing the resizing of the GLSurfaceView. 1 out of 3 time doing resizing it is hitting this window. And was getting this crash.

java.nio.BufferOverflowException at java.nio.Buffer.nextPutIndex(Buffer.java:536) at java.nio.ByteBufferAsFloatBuffer.put(ByteBufferAsFloatBuffer.java:109) at com.otaliastudios.opengl.draw.GlRect.setRect(GlRect.kt:63) at com.otaliastudios.opengl.draw.GlRect.setRect(GlRect.kt:47) at com.otaliastudios.zoom.ZoomSurfaceView.onContentOrContainerSizeChanged(ZoomSurfaceView.kt:238) at com.otaliastudios.zoom.ZoomSurfaceView.onMeasure(ZoomSurfaceView.kt:215) at android.view.View.measure(View.java:27129) at androidx.constraintlayout.widget.ConstraintLayout$Measurer.measure(ConstraintLayout.java:811)

    The variable which is causing this is :
    ` glTextureRect.setRect(rect)` -> it is getting modified in onContentOrContainerSizeChanged() and also in the onDraw.
    
    One solution that comes to my mind is to thread safe this variable. if writer of this lib can make this change, it will be very much beneficial.

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

3 participants