-
-
Notifications
You must be signed in to change notification settings - Fork 507
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
Android crashes when resuming from background AND navigation occurs using fragments. #819
Comments
Looks like this line is quite crucial: |
@WoLewicki - I've tested the change suggested but unfortunately it also ends in the same crash. |
Can you post stacktraces of the crashes in the changed flows? |
Using
For this second stackTrace I've added `private void removeMyFragments() {
}` And the crash seems to happen when we do
Now the interesting thing is - if I do the change suggested:
And I remove Adding back |
Hmm you can try and keep the configuration that causes no crashes, and see if the new issues arise from this. This implementation was for sure like this for a reason so deleting |
Cool - I'll get in touch with the team and see if we can try this and give the app a good shake. |
I have a closed source code base I can reproduce this with consistently. The latest has not fixed it, Let me see if I can troubleshoot the issue against my code base and PR. As a work around one can not use the enableScreens on the RN side and this does not occur. We are trying to avoid that |
Not using |
@WoLewicki Unfortunately the app is so large we do not have a good single source to boil it down to. I did make a minor change to ScreenContainer similar to what was outlined above. We have this in testing with our QA team and if everything continues to look good I will get a PR up. |
Thank you! Please comment here also with the results. |
The Application is being hit hard by the release testing teams this week and the automation teams this week. We have closed out most of the crashes related to this bug. I will update and PR later this week. |
@WoLewicki The testing is continuing to go good on this PR, I'll be getting that PR setup this week. |
I was able to consistently get this to happen by The crash happens every single time. |
I haven't forgotten about this issue, I'm monitoring our production crashes as we roll out to make sure my changes have this resolved. |
@amutschBBY any first insights already? 🙏 |
@LcTwisk We are investigating some additional similar issues in onUpdate, onPause calls from native. I will start getting a fork prepped to PR back but likely won't create the PR until we work through some additional fragment manager issues. So far the onResume issues seem to be working well. |
This update fixes an issue where android is crashing on resume from background when using using react native module inside a native page. resolves: software-mansion#819
Hopefully this issue should be solved by #1066. Could you check if it does not introduce any new problems? It certainly needs much testing and we would like to add it to the next release. |
We are seeing the same error reported here and here and none of the solutions provided have worked for us.
Our setup is slightly different though:
The use case that crashes the app 100% of the time is a deeplink IF we are previously on a react native screen. After some investigation we think the following occurs:
Libraries:
We have tried one thing: IF "react-native-screens": "2.10.1" and we don't force that version, ie change other dependencies to use that version, the resulting app has
react-native-screens 2.10.1
AND2.9.0
and the issue seems to be gone. However though this doesn't sound like a very reliable thing to do.The concerning lines are the following:
at com.swmansion.rnscreens.ScreenContainer.removeMyFragments(ScreenContainer.java:238) at com.swmansion.rnscreens.ScreenContainer.onDetachedFromWindow(ScreenContainer.java:250)
The stack trace we have is the following
java.lang.RuntimeException: Unable to resume activity {com.company.package.flavour.debug/com.company.MainActivity}: java.lang.IllegalStateException: FragmentManager is already executing transactions at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4219) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4251) at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52) at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2019) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7410) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935) Caused by: java.lang.IllegalStateException: FragmentManager is already executing transactions at androidx.fragment.app.FragmentManager.ensureExecReady(FragmentManager.java:1790) at androidx.fragment.app.FragmentManager.execSingleAction(FragmentManager.java:1826) at androidx.fragment.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:303) at com.swmansion.rnscreens.ScreenContainer.removeMyFragments(ScreenContainer.java:238) at com.swmansion.rnscreens.ScreenContainer.onDetachedFromWindow(ScreenContainer.java:250) at android.view.View.dispatchDetachedFromWindow(View.java:19626) at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3814) at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3806) at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3806) at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3806) at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3806) at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3806) at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3806) at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3806) at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3806) at android.view.ViewGroup.removeViewInternal(ViewGroup.java:5431) at android.view.ViewGroup.removeViewInternal(ViewGroup.java:5402) at android.view.ViewGroup.removeView(ViewGroup.java:5333) at androidx.fragment.app.FragmentContainerView.removeView(FragmentContainerView.java:317) at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1262) at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1368) at androidx.fragment.app.FragmentManager.moveFragmentToExpectedState(FragmentManager.java:1446) at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1516) at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2019) at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1965) at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1861) at androidx.fragment.app.Fragment.performResume(Fragment.java:2745) at androidx.fragment.app.FragmentStateManager.resume(FragmentStateManager.java:373) at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1211) at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1368) at androidx.fragment.app.FragmentManager.moveFragmentToExpectedState(FragmentManager.java:1446) at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1509) at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:2637) at androidx.fragment.app.FragmentManager.dispatchResume(FragmentManager.java:2601) at androidx.fragment.app.FragmentController.dispatchResume(FragmentController.java:269) at androidx.fragment.app.FragmentActivity.onResumeFragments(FragmentActivity.java:478) at androidx.fragment.app.FragmentActivity.onPostResume(FragmentActivity.java:467) at androidx.appcompat.app.AppCompatActivity.onPostResume(AppCompatActivity.java:204) at android.app.Activity.performResume(Activity.java:7964) at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4209)
The text was updated successfully, but these errors were encountered: