Starting from April we have StackOverflowError from compose. We didn't have compose or Kotlin version update.
The issue only happens on Android 8.
We cannot reproduce locally and according to our logs, the crash comes when different fragments are open. We have single activity with multiple fragments and we don't have any log to point out root cause.
How can we mitigate the crash, it is something internal for compose?
What can be the root cause of the crash?
Fatal Exception: java.lang.StackOverflowError: stack size 8MB
at androidx.compose.ui.platform.CalculateMatrixToWindowApi21.transformMatrixToWindow-EL8BTi8(AndroidComposeView.android.kt:1827)
at androidx.compose.ui.platform.CalculateMatrixToWindowApi21.transformMatrixToWindow-EL8BTi8(AndroidComposeView.android.kt:1822)
at androidx.compose.ui.platform.CalculateMatrixToWindowApi21.transformMatrixToWindow-EL8BTi8(AndroidComposeView.android.kt:1822)
at androidx.compose.ui.platform.CalculateMatrixToWindowApi21.transformMatrixToWindow-EL8BTi8(AndroidComposeView.android.kt:1822)
at androidx.compose.ui.platform.CalculateMatrixToWindowApi21.transformMatrixToWindow-EL8BTi8(AndroidComposeView.android.kt:1822)
at androidx.compose.ui.platform.CalculateMatrixToWindowApi21.transformMatrixToWindow-EL8BTi8(AndroidComposeView.android.kt:1822)
at androidx.compose.ui.platform.CalculateMatrixToWindowApi21.transformMatrixToWindow-EL8BTi8(AndroidComposeView.android.kt:1822)
at androidx.compose.ui.platform.CalculateMatrixToWindowApi21.transformMatrixToWindow-EL8BTi8(AndroidComposeView.android.kt:1822)
at androidx.compose.ui.platform.CalculateMatrixToWindowApi21.transformMatrixToWindow-EL8BTi8(AndroidComposeView.android.kt:1822)
at androidx.compose.ui.platform.CalculateMatrixToWindowApi21.transformMatrixToWindow-EL8BTi8(AndroidComposeView.android.kt:1822)
at androidx.compose.ui.platform.CalculateMatrixToWindowApi21.transformMatrixToWindow-EL8BTi8(AndroidComposeView.android.kt:1822)
at androidx.compose.ui.platform.CalculateMatrixToWindowApi21.calculateMatrixToWindow-EL8BTi8(AndroidComposeView.android.kt:1816)
at androidx.compose.ui.platform.AndroidComposeView.recalculateWindowViewTransforms(AndroidComposeView.android.kt:1446)
at androidx.compose.ui.platform.AndroidComposeView.recalculateWindowPosition(AndroidComposeView.android.kt:1410)
at androidx.compose.ui.platform.AndroidComposeView.localToScreen-MK-Hz9U(AndroidComposeView.android.kt:1390)
at androidx.compose.ui.platform.AndroidComposeViewAccessibilityDelegateCompat.createNodeInfo(AndroidComposeViewAccessibilityDelegateCompat.android.kt:366)
at androidx.compose.ui.platform.AndroidComposeViewAccessibilityDelegateCompat.access$sendScrollEventIfNeeded(AndroidComposeViewAccessibilityDelegateCompat.android.kt)
at androidx.compose.ui.platform.AndroidComposeViewAccessibilityDelegateCompat.access$createNodeInfo(AndroidComposeViewAccessibilityDelegateCompat.android.kt)
at androidx.compose.ui.platform.AndroidComposeViewAccessibilityDelegateCompat$MyNodeProvider.createAccessibilityNodeInfo(AndroidComposeViewAccessibilityDelegateCompat.android.kt:2424)
at android.view.View.populateVirtualStructure(View.java:8103)
at android.view.View.populateVirtualStructure(View.java:8106)
at android.view.View.populateVirtualStructure(View.java:8106)
at android.view.View.populateVirtualStructure(View.java:8106)
at android.view.View.populateVirtualStructure(View.java:8106)
at android.view.View.populateVirtualStructure(View.java:8106)
at android.view.View.populateVirtualStructure(View.java:8106)
at android.view.View.populateVirtualStructure(View.java:8106)
at android.view.View.populateVirtualStructure(View.java:8106)
at android.view.View.populateVirtualStructure(View.java:8106)
at android.view.View.populateVirtualStructure(View.java:8106)
at android.view.View.onProvideVirtualStructure(View.java:7667)
at android.view.View.dispatchProvideStructureForAssistOrAutofill(View.java:8171)
at android.view.View.dispatchProvideStructure(View.java:8118)
at android.view.ViewGroup.dispatchProvideStructure(ViewGroup.java:3415)
at android.view.ViewGroup.dispatchProvideStructure(ViewGroup.java:3486)
at android.view.ViewGroup.dispatchProvideStructure(ViewGroup.java:3486)
at android.view.ViewGroup.dispatchProvideStructure(ViewGroup.java:3486)
at android.view.ViewGroup.dispatchProvideStructure(ViewGroup.java:3486)
at android.view.ViewGroup.dispatchProvideStructure(ViewGroup.java:3486)
at android.view.ViewGroup.dispatchProvideStructure(ViewGroup.java:3486)
at android.view.ViewGroup.dispatchProvideStructure(ViewGroup.java:3486)
at android.view.ViewGroup.dispatchProvideStructure(ViewGroup.java:3486)
at android.view.ViewGroup.dispatchProvideStructure(ViewGroup.java:3486)
at android.view.ViewGroup.dispatchProvideStructure(ViewGroup.java:3486)
at android.app.assist.AssistStructure$WindowNode.<init>(AssistStructure.java:512)
at android.app.assist.AssistStructure.<init>(AssistStructure.java:1912)
at android.app.ActivityThread.handleRequestAssistContextExtras(ActivityThread.java:3599)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2254)
at android.os.Handler.dispatchMessage(Handler.java:109)
at android.os.Looper.loop(Looper.java:166)
at android.app.ActivityThread.main(ActivityThread.java:7555)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:469)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:963)