CatalystInstanceImpl.destroy AsyncTask fails to complete and blocks execution of other AsyncTasks #19895
Labels
Stale
There has been a lack of activity on this issue and it may be closed soon.
Environment
Environment:
OS: macOS High Sierra 10.13.5
Node: 8.3.0
Yarn: 1.3.2
npm: 6.0.1
Watchman: 4.9.0
Xcode: Xcode 9.3.1 Build version 9E501
Android Studio: 3.1 AI-173.4819257
Packages: (wanted => installed)
react: 16.3.1 => 16.3.1
react-native: 0.55.4 => 0.55.4
Description
During (Android) development I was noticing that sometimes my
AsyncTask
's were no longer executed. When analyzing the thread dump I noticed that at these times there was always anAsyncTask
from React Native'sCatalystInstanceImpl
alive & running:https://github.com/facebook/react-native/blob/0.56-stable/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstanceImpl.java#L351
Since this task is executed on the global / shared
AsyncTask.SERIAL_EXECUTOR
otherAsyncTask
will no longer execute.It seems like after reloading the bridge this
AsyncTask
is trying to clean up some (native / c++) resources asynchronously but starts hanging if the bridge is reloaded again while cleaning is still in-progress. I currently related this behavior only to rapid reloading but it might also happen at other moments.Note that I've only seen it happen when Debugging JS. Without debugging it reloads fine so far.
Reproducible Demo
react-native init BlockingAsyncTask
cd BlockingAsyncTask
react-native start
open http://localhost:8081/debugger-ui
react-native run-android
CMD+M
->Debug JS Remotely
adb logcat | grep CatalystInstanceImpl.destroy
Notice that the adb logcat will contain two lines:
Which is fine. The
start
andend
logs should be balanced.Again, nicely balanced
start
andend
logs:This time the log shows:
Notice that the last
start
log has not been balanced with anend
log.start
log but noend
log:The text was updated successfully, but these errors were encountered: