-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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] [DialogModule] IllegalStateException #6228
Comments
Looks like a bug in the Android Dialog module, in the |
I'll try to find some time to take a look in the next two weeks or so (is that soon enough?). I've refactored the Dialog module when open sourcing it. |
Yeah, or I could look into that as well just to get some Java 🔥 |
For reducing crashs,I use the Dialog module that is written by myself.😢 |
@DoingLiaw since you've written your own module, would you be up for sending a bugfix for the React Native one? |
Hi there! This issue is being closed because it has been inactive for a while. But don't worry, it will live on with ProductPains! Check out its new home: https://productpains.com/post/react-native/android-dialogmodule-illegalstateexception ProductPains helps the community prioritize the most important issues thanks to its voting feature. Also, if this issue is a bug, please consider sending a pull request with a fix. |
We're also seeing this and it's crashing our app on a fairly regular basis. Here's that stack trace if it helps. I don't have much experience with Java otherwise I would contribute a fix: Stack Trace for `require('does.not.exist')````shell #0. Crashed: mqt_native_modules: 0 0 0x0000000000000000 at android.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1433) at android.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1451) at android.app.BackStackRecord.commitInternal(BackStackRecord.java:687) at android.app.BackStackRecord.commit(BackStackRecord.java:663) at android.app.DialogFragment.dismissInternal(DialogFragment.java:301) at android.app.DialogFragment.dismiss(DialogFragment.java:267) at com.facebook.react.modules.dialog.DialogModule$FragmentManagerHelper.dismissExisting(DialogModule.java:119) at com.facebook.react.modules.dialog.DialogModule$FragmentManagerHelper.showNewAlert(DialogModule.java:125) at com.facebook.react.modules.dialog.DialogModule.showAlert(DialogModule.java:255) at java.lang.reflect.Method.invoke(Method.java) at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:322) at com.facebook.react.cxxbridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:158) at com.facebook.react.bridge.queue.NativeRunnable.run(NativeRunnable.java) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31) at android.os.Looper.loop(Looper.java:148) at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196) at java.lang.Thread.run(Thread.java:818)-- Fatal Exception: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState #0. Crashed: mqt_native_modules: 0 0 0x0000000000000000 #1. HeapTaskDaemon #2. Queue #3. Answers Events Handler1 #4. AsyncTask #3 #5. pool-6-thread-1 #6. Crashlytics Exception Handler1 #7. AsyncTask #4 #8. FinalizerDaemon #9. Queue #10. mqt_native_modules #11. ReferenceQueueDaemon #12. Queue #13. OkHttp Dispatcher #14. Thread-3039 #15. pool-5-thread-1 #16. pool-6-thread-2 #17. pool-6-thread-3 #18. AsyncTask #2 #19. Thread-3036 #20. pool-6-thread-4 #21. pool-4-thread-1 #22. OkHttp ConnectionPool #23. Queue #24. AsyncTask #1 #25. pool-6-thread-5 #26. pool-5-thread-2 #27. main #28. Queue #29. AsyncTask #5 #30. Okio Watchdog #31. FinalizerWatchdogDaemon #32. OkHttp ConnectionPool #33. mqt_js
|
We are also seeing this. Its fairly infrequent (but regularly). I'd say about once or twice every release cycle for just one or two users, tops. I absolutely cannot reproduce it. Here is my stack trace.FragmentManager.java:1415android.app.FragmentManagerImpl.checkStateLoss FragmentManager.java:1433android.app.FragmentManagerImpl.enqueueAction BackStackRecord.java:687android.app.BackStackRecord.commitInternal BackStackRecord.java:663android.app.BackStackRecord.commit DialogFragment.java:301android.app.DialogFragment.dismissInternal DialogFragment.java:267android.app.DialogFragment.dismiss DialogModule.java:120com.facebook.react.modules.dialog.DialogModule$FragmentManagerHelper.dismissExisting DialogModule.java:126com.facebook.react.modules.dialog.DialogModule$FragmentManagerHelper.showNewAlert DialogModule.java:256com.facebook.react.modules.dialog.DialogModule.showAlert Method.java:-2java.lang.reflect.Method.invoke BaseJavaModule.java:319com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke JavaModuleWrapper.java:158com.facebook.react.cxxbridge.JavaModuleWrapper.invoke NativeRunnable.java:-2com.facebook.react.bridge.queue.NativeRunnable.run Handler.java:739android.os.Handler.handleCallback Handler.java:95android.os.Handler.dispatchMessage MessageQueueThreadHandler.java:31com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage Looper.java:168android.os.Looper.loop MessageQueueThreadImpl.java:196com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run Thread.java:818java.lang.Thread.run |
Same here. I have no way of reproducing the error for sure. |
same here, I am getting this crash
I am on react native version |
Test Plan: Check work with the dialogs. The original issue occurs in case of calling the showDialog after activity state has been saved. The mIsInForeground flag accessed from two different threads as result module doesnt' work as expected. Release Notes: Fixed race-condition in DialogModule on android platform. We had an access to the mIsInForeground flag on two different threads.
…his issue: facebook#6228. The mIsInForeground flag is set on UI thread but was used from the ReactMethod thread. I added asserts to make sure that FragmentManagerHelper wouldn't be used incorrectly. Make sure that dialogs work after this change. It will be nearly impossible to reproduce the issue manually but automatic regression tests should be able to catch this. At least our tests are crashing on some dialog scenarios from time to time. [ANDROID] [MINOR] [BUGFIX] - Race condition fix for Dialogs module.
I'm with this same error, anyone already fixed this? |
Observed on RN 0.51.0
|
Summary: Android dialog module has a race condition as a result of which it crashes. See this issue: #6228. The mIsInForeground flag is set on UI thread but was used from the ReactMethod thread. Now all public methods of FragmentManagerHelper called from UI thread only. Asserts are added in appropriate places to prevent future regressions. Make sure that dialogs work after this change. It will be nearly impossible to reproduce the issue manually but automatic regression tests should be able to catch this. At least our tests were crashing on some dialog scenarios from time to time. [ANDROID] [MINOR] [BUGFIX] - Race condition fix in Android Dialogs module. Closes #17392 Reviewed By: achen1 Differential Revision: D6708787 Pulled By: mdvacca fbshipit-source-id: 99beb3ea3046286cc973f7677e98ff36f162b09b
Same here on 0.51.0 |
@aemdy this has been fixed as seen by the commit above your comment, update RN. |
Upgraded to 0.55.4 but still got the error. |
Upgraded to 0.55.4 but still got the error. |
Hey,
Again, not sure how to reproduce - ~20 crashes so it's still a super small percentage of overall app install.
The text was updated successfully, but these errors were encountered: