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

[Android] [DialogModule] IllegalStateException #6228

Closed
grabbou opened this issue Mar 1, 2016 · 16 comments
Closed

[Android] [DialogModule] IllegalStateException #6228

grabbou opened this issue Mar 1, 2016 · 16 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@grabbou
Copy link
Contributor

grabbou commented Mar 1, 2016

Hey,

Again, not sure how to reproduce - ~20 crashes so it's still a super small percentage of overall app install.

IllegalStateException: Can not perform this action after onSaveInstanceState
  Module "android.app.FragmentManagerImpl", line 1343, in checkStateLoss
  Module "android.app.FragmentManagerImpl", line 1361, in enqueueAction
  Module "android.app.BackStackRecord", line 729, in commitInternal
  Module "android.app.BackStackRecord", line 705, in commit
  Module "android.app.DialogFragment", line 292, in dismissInternal
  Module "android.app.DialogFragment", line 258, in dismiss
  Module "com.facebook.react.modules.dialog.DialogModule$FragmentManagerHelper", line 115, in dismissExisting
  Module "com.facebook.react.modules.dialog.DialogModule$FragmentManagerHelper", line 121, in showNewAlert
  Module "com.facebook.react.modules.dialog.DialogModule", line 234, in showAlert
  Module "java.lang.reflect.Method", in invoke
  Module "java.lang.reflect.Method", line 372, in invoke
  Module "com.facebook.react.bridge.BaseJavaModule$JavaMethod", line 249, in invoke
  Module "com.facebook.react.bridge.NativeModuleRegistry$ModuleDefinition", line 158, in call
  Module "com.facebook.react.bridge.NativeModuleRegistry", line 58, in call
  Module "com.facebook.react.bridge.CatalystInstanceImpl$NativeModulesReactCallback", line 428, in call
  Module "com.facebook.react.bridge.queue.NativeRunnableDeprecated", in run
  Module "android.os.Handler", line 739, in handleCallback
  Module "android.os.Handler", line 95, in dispatchMessage
  Module "com.facebook.react.bridge.queue.MessageQueueThreadHandler", line 31, in dispatchMessage
  Module "android.os.Looper", line 145, in loop
  Module "com.facebook.react.bridge.queue.MessageQueueThreadImpl$3", line 184, in run
  Module "java.lang.Thread", line 818, in run
@mkonicek
Copy link
Contributor

mkonicek commented Mar 1, 2016

Looks like a bug in the Android Dialog module, in the dismissExisting method.

@mkonicek
Copy link
Contributor

mkonicek commented Mar 1, 2016

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.

@grabbou
Copy link
Contributor Author

grabbou commented Mar 1, 2016

Yeah, or I could look into that as well just to get some Java 🔥

@DoingLiaw
Copy link

For reducing crashs,I use the Dialog module that is written by myself.😢

@mkonicek
Copy link
Contributor

@DoingLiaw since you've written your own module, would you be up for sending a bugfix for the React Native one?

@mkonicek mkonicek removed their assignment Mar 20, 2016
@mkonicek
Copy link
Contributor

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.
It is easy to use - just login with GitHub. GitHub issues have voting too, nevertheless
Product Pains has been very useful in highlighting the top bugs and feature requests:
https://productpains.com/product/react-native?tab=top

Also, if this issue is a bug, please consider sending a pull request with a fix.
We're a small team and rely on the community for bug fixes of issues that don't affect fb apps.

@willmcclellan
Copy link

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
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)

#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)

#1. HeapTaskDaemon
at dalvik.system.VMRuntime.runHeapTasks(VMRuntime.java)
at java.lang.Daemons$HeapTaskDaemon.run(Daemons.java:370)
at java.lang.Thread.run(Thread.java:818)

#2. Queue
at java.lang.Object.wait(Object.java)
at java.lang.Thread.parkFor$(Thread.java:1220)
at sun.misc.Unsafe.park(Unsafe.java:299)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2013)
at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:510)
at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.performOperation(DependencyPriorityBlockingQueue.java:197)
at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.get(DependencyPriorityBlockingQueue.java:236)
at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take(DependencyPriorityBlockingQueue.java:65)
at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take(DependencyPriorityBlockingQueue.java:46)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1036)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)

#3. Answers Events Handler1
at java.lang.Object.wait(Object.java)
at java.lang.Thread.parkFor$(Thread.java:1220)
at sun.misc.Unsafe.park(Unsafe.java:299)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:198)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2053)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1090)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:806)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1036)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at io.fabric.sdk.android.services.common.ExecutorUtils$1$1.onRun(ExecutorUtils.java:75)
at io.fabric.sdk.android.services.common.BackgroundPriorityRunnable.run(BackgroundPriorityRunnable.java:30)
at java.lang.Thread.run(Thread.java:818)

#4. AsyncTask #3
at java.lang.Object.wait(Object.java)
at java.lang.Thread.parkFor$(Thread.java:1220)
at sun.misc.Unsafe.park(Unsafe.java:299)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2013)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:410)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1036)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)

#5. pool-6-thread-1
at java.lang.Object.wait(Object.java)
at java.lang.Thread.parkFor$(Thread.java:1220)
at sun.misc.Unsafe.park(Unsafe.java:299)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2013)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:410)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1036)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)

#6. Crashlytics Exception Handler1
at dalvik.system.VMStack.getThreadStackTrace(VMStack.java)
at java.lang.Thread.getStackTrace(Thread.java:580)
at java.lang.Thread.getAllStackTraces(Thread.java:522)
at com.crashlytics.android.core.CrashlyticsUncaughtExceptionHandler.writeSessionEvent(CrashlyticsUncaughtExceptionHandler.java:1078)
at com.crashlytics.android.core.CrashlyticsUncaughtExceptionHandler.writeFatal(CrashlyticsUncaughtExceptionHandler.java:812)
at com.crashlytics.android.core.CrashlyticsUncaughtExceptionHandler.handleUncaughtException(CrashlyticsUncaughtExceptionHandler.java:278)
at com.crashlytics.android.core.CrashlyticsUncaughtExceptionHandler.access$100(CrashlyticsUncaughtExceptionHandler.java:55)
at com.crashlytics.android.core.CrashlyticsUncaughtExceptionHandler$5.call(CrashlyticsUncaughtExceptionHandler.java:254)
at com.crashlytics.android.core.CrashlyticsUncaughtExceptionHandler$5.call(CrashlyticsUncaughtExceptionHandler.java:251)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at io.fabric.sdk.android.services.common.ExecutorUtils$1$1.onRun(ExecutorUtils.java:75)
at io.fabric.sdk.android.services.common.BackgroundPriorityRunnable.run(BackgroundPriorityRunnable.java:30)
at java.lang.Thread.run(Thread.java:818)

#7. AsyncTask #4
at java.lang.Object.wait(Object.java)
at java.lang.Thread.parkFor$(Thread.java:1220)
at sun.misc.Unsafe.park(Unsafe.java:299)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2013)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:410)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1036)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)

#8. FinalizerDaemon
at java.lang.Object.wait(Object.java)
at java.lang.Object.wait(Object.java:423)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:101)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:72)
at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:200)
at java.lang.Thread.run(Thread.java:818)

#9. Queue
at java.lang.Object.wait(Object.java)
at java.lang.Thread.parkFor$(Thread.java:1220)
at sun.misc.Unsafe.park(Unsafe.java:299)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2013)
at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:510)
at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.performOperation(DependencyPriorityBlockingQueue.java:197)
at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.get(DependencyPriorityBlockingQueue.java:236)
at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take(DependencyPriorityBlockingQueue.java:65)
at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take(DependencyPriorityBlockingQueue.java:46)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1036)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)

#10. mqt_native_modules
at java.lang.Object.wait(Object.java)
at java.lang.Thread.parkFor$(Thread.java:1220)
at sun.misc.Unsafe.park(Unsafe.java:299)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
at java.util.concurrent.FutureTask.awaitDone(FutureTask.java:421)
at java.util.concurrent.FutureTask.get(FutureTask.java:163)
at com.crashlytics.android.core.CrashlyticsExecutorServiceWrapper.executeSyncLoggingException(CrashlyticsExecutorServiceWrapper.java:47)
at com.crashlytics.android.core.CrashlyticsUncaughtExceptionHandler.uncaughtException(CrashlyticsUncaughtExceptionHandler.java:251)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)

#11. ReferenceQueueDaemon
at java.lang.Object.wait(Object.java)
at java.lang.Daemons$ReferenceQueueDaemon.run(Daemons.java:162)
at java.lang.Thread.run(Thread.java:818)

#12. Queue
at java.lang.Object.wait(Object.java)
at java.lang.Thread.parkFor$(Thread.java:1220)
at sun.misc.Unsafe.park(Unsafe.java:299)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2013)
at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:510)
at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.performOperation(DependencyPriorityBlockingQueue.java:197)
at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.get(DependencyPriorityBlockingQueue.java:236)
at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take(DependencyPriorityBlockingQueue.java:65)
at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take(DependencyPriorityBlockingQueue.java:46)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1036)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)

#13. OkHttp Dispatcher
at java.lang.Object.wait(Object.java)
at java.lang.Thread.parkFor$(Thread.java:1220)
at sun.misc.Unsafe.park(Unsafe.java:299)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:198)
at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:430)
at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:332)
at java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:911)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1036)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)

#14. Thread-3039
at java.lang.Object.wait(Object.java)
at java.lang.Thread.parkFor$(Thread.java:1220)
at sun.misc.Unsafe.park(Unsafe.java:299)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2013)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:410)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1036)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at com.facebook.imagepipeline.core.PriorityThreadFactory$1.run(PriorityThreadFactory.java:43)
at java.lang.Thread.run(Thread.java:818)

#15. pool-5-thread-1
at java.lang.Object.wait(Object.java)
at java.lang.Thread.parkFor$(Thread.java:1220)
at sun.misc.Unsafe.park(Unsafe.java:299)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2013)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:410)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1036)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)

#16. pool-6-thread-2
at java.lang.Object.wait(Object.java)
at java.lang.Thread.parkFor$(Thread.java:1220)
at sun.misc.Unsafe.park(Unsafe.java:299)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2013)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:410)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1036)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)

#17. pool-6-thread-3
at java.lang.Object.wait(Object.java)
at java.lang.Thread.parkFor$(Thread.java:1220)
at sun.misc.Unsafe.park(Unsafe.java:299)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2013)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:410)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1036)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)

#18. AsyncTask #2
at java.lang.Object.wait(Object.java)
at java.lang.Thread.parkFor$(Thread.java:1220)
at sun.misc.Unsafe.park(Unsafe.java:299)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2013)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:410)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1036)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)

#19. Thread-3036
at java.lang.Object.wait(Object.java)
at java.lang.Thread.parkFor$(Thread.java:1220)
at sun.misc.Unsafe.park(Unsafe.java:299)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2013)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:410)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1036)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at com.facebook.imagepipeline.core.PriorityThreadFactory$1.run(PriorityThreadFactory.java:43)
at java.lang.Thread.run(Thread.java:818)

#20. pool-6-thread-4
at java.lang.Object.wait(Object.java)
at java.lang.Thread.parkFor$(Thread.java:1220)
at sun.misc.Unsafe.park(Unsafe.java:299)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2013)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:410)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1036)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)

#21. pool-4-thread-1
at java.lang.Object.wait(Object.java)
at java.lang.Thread.parkFor$(Thread.java:1220)
at sun.misc.Unsafe.park(Unsafe.java:299)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2013)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:410)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1036)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)

#22. OkHttp ConnectionPool
at java.lang.Object.wait(Object.java)
at com.android.okhttp.ConnectionPool.performCleanup(ConnectionPool.java:319)
at com.android.okhttp.ConnectionPool.runCleanupUntilPoolIsEmpty(ConnectionPool.java:256)
at com.android.okhttp.ConnectionPool.access$000(ConnectionPool.java:59)
at com.android.okhttp.ConnectionPool$1.run(ConnectionPool.java:102)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)

#23. Queue
at java.lang.Object.wait(Object.java)
at java.lang.Thread.parkFor$(Thread.java:1220)
at sun.misc.Unsafe.park(Unsafe.java:299)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2013)
at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:510)
at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.performOperation(DependencyPriorityBlockingQueue.java:197)
at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.get(DependencyPriorityBlockingQueue.java:236)
at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take(DependencyPriorityBlockingQueue.java:65)
at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take(DependencyPriorityBlockingQueue.java:46)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1036)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)

#24. AsyncTask #1
at java.lang.Object.wait(Object.java)
at java.lang.Thread.parkFor$(Thread.java:1220)
at sun.misc.Unsafe.park(Unsafe.java:299)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2013)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:410)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1036)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)

#25. pool-6-thread-5
at java.lang.Object.wait(Object.java)
at java.lang.Thread.parkFor$(Thread.java:1220)
at sun.misc.Unsafe.park(Unsafe.java:299)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2013)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:410)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1036)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)

#26. pool-5-thread-2
at java.lang.Object.wait(Object.java)
at java.lang.Thread.parkFor$(Thread.java:1220)
at sun.misc.Unsafe.park(Unsafe.java:299)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2013)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:410)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1036)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)

#27. main
at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
at android.os.MessageQueue.next(MessageQueue.java:323)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:7325)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

#28. Queue
at java.lang.Object.wait(Object.java)
at java.lang.Thread.parkFor$(Thread.java:1220)
at sun.misc.Unsafe.park(Unsafe.java:299)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2013)
at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:510)
at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.performOperation(DependencyPriorityBlockingQueue.java:197)
at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.get(DependencyPriorityBlockingQueue.java:236)
at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take(DependencyPriorityBlockingQueue.java:65)
at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take(DependencyPriorityBlockingQueue.java:46)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1036)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)

#29. AsyncTask #5
at java.lang.Object.wait(Object.java)
at java.lang.Thread.parkFor$(Thread.java:1220)
at sun.misc.Unsafe.park(Unsafe.java:299)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2013)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:410)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1036)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)

#30. Okio Watchdog
at java.lang.Object.wait(Object.java)
at okio.AsyncTimeout.awaitTimeout(AsyncTimeout.java:338)
at okio.AsyncTimeout$Watchdog.run(AsyncTimeout.java:313)

#31. FinalizerWatchdogDaemon
at java.lang.Object.wait(Object.java)
at java.lang.Daemons$FinalizerWatchdogDaemon.waitForObject(Daemons.java:270)
at java.lang.Daemons$FinalizerWatchdogDaemon.run(Daemons.java:242)
at java.lang.Thread.run(Thread.java:818)

#32. OkHttp ConnectionPool
at java.lang.Object.wait(Object.java)
at okhttp3.ConnectionPool$1.run(ConnectionPool.java:66)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)

#33. mqt_js
at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
at android.os.MessageQueue.next(MessageQueue.java:323)
at android.os.Looper.loop(Looper.java:135)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196)
at java.lang.Thread.run(Thread.java:818)

</details>

@the-simian
Copy link

the-simian commented May 6, 2017

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

@ancyrweb
Copy link

ancyrweb commented Jun 8, 2017

Same here. I have no way of reproducing the error for sure.

@naoyamakino
Copy link

same here, I am getting this crash

Fatal Exception: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
       at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1842)
       at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1860)
       at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:650)
       at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:609)
       at android.support.v4.app.DialogFragment.show(DialogFragment.java:143)
       at com.facebook.react.modules.dialog.DialogModule$FragmentManagerHelper.showNewAlert(DialogModule.java:137)
       at com.facebook.react.modules.dialog.DialogModule.showAlert(DialogModule.java:256)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:363)
       at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:166)
       at com.facebook.react.bridge.queue.NativeRunnable.run(NativeRunnable.java)
       at android.os.Handler.handleCallback(Handler.java:789)
       at android.os.Handler.dispatchMessage(Handler.java:98)
       at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
       at android.os.Looper.loop(Looper.java:164)
       at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:194)
       at java.lang.Thread.run(Thread.java:764)

I am on react native version 0.46.4

dryganets added a commit to dryganets/react-native that referenced this issue Dec 29, 2017
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.
dryganets added a commit to dryganets/react-native that referenced this issue Dec 29, 2017
…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.
@agrass
Copy link

agrass commented Jan 2, 2018

I'm with this same error, anyone already fixed this?

@MattyK14
Copy link

MattyK14 commented Jan 3, 2018

Observed on RN 0.51.0

java.lang.IllegalStateException Can not perform this action after onSaveInstanceState 
    FragmentManager.java:1434 android.app.FragmentManagerImpl.checkStateLoss
    FragmentManager.java:1452 android.app.FragmentManagerImpl.enqueueAction
    BackStackRecord.java:708 android.app.BackStackRecord.commitInternal
    BackStackRecord.java:672 android.app.BackStackRecord.commit
    DialogFragment.java:301 android.app.DialogFragment.dismissInternal
    DialogFragment.java:267 android.app.DialogFragment.dismiss
    DialogModule.java:120 com.facebook.react.modules.dialog.DialogModule$FragmentManagerHelper.dismissExisting
    DialogModule.java:126 com.facebook.react.modules.dialog.DialogModule$FragmentManagerHelper.showNewAlert
    DialogModule.java:256 com.facebook.react.modules.dialog.DialogModule.showAlert
    Method.java:-2 java.lang.reflect.Method.invoke
    JavaMethodWrapper.java:374 com.facebook.react.bridge.JavaMethodWrapper.invoke
    JavaModuleWrapper.java:162 com.facebook.react.bridge.JavaModuleWrapper.invoke
    NativeRunnable.java:-2 com.facebook.react.bridge.queue.NativeRunnable.run
    Handler.java:751 android.os.Handler.handleCallback
    Handler.java:95 android.os.Handler.dispatchMessage
    MessageQueueThreadHandler.java:31 com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage
    Looper.java:154 android.os.Looper.loop
    MessageQueueThreadImpl.java:194 com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run
    Thread.java:761 java.lang.Thread.run

facebook-github-bot pushed a commit that referenced this issue Jan 12, 2018
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
@aemdy
Copy link

aemdy commented Feb 15, 2018

Same here on 0.51.0

@MattyK14
Copy link

@aemdy this has been fixed as seen by the commit above your comment, update RN.

@volkansahin45
Copy link

Upgraded to 0.55.4 but still got the error.

@iamdurui
Copy link

iamdurui commented Jul 9, 2018

Upgraded to 0.55.4 but still got the error.

@facebook facebook locked as resolved and limited conversation to collaborators Jul 20, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests