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 device log shows reanimated related message every milisecond then crashes #1932

Closed
1 task done
andreialecu opened this issue Apr 13, 2021 · 19 comments
Closed
1 task done
Labels
Bug bug-bash-jan22 Issues visited during Bug Bash Jan 2022 🏠 Reanimated 2

Comments

@andreialecu
Copy link
Contributor

Description

Been troubleshooting some Android performance issues and crashes, and I noticed in the device log (using Flipper), that there's a message being logged every milisecond:

Screenshot 2021-04-13 at 13 46 36

Not sure if this is normal or what is causing it, but it mentions reanimated.

Expected behavior

No log spam.

Actual behavior & steps to reproduce

See screenshot above

Package versions

  • React Native: 0.64
  • React Native Reanimated: 2.1.0

Affected platforms

  • Android
@github-actions
Copy link

Issue validator

The issue is valid!

@andreialecu
Copy link
Contributor Author

andreialecu commented Apr 13, 2021

These could be related, as they appear to be logged immediately prior to the log spam mentioned above:

Screenshot 2021-04-13 at 13 50 07

The app also crashes few seconds later.

Edit: It doesn't seem to be directly related. I was able to see the two separate log anomalies logged independently of one another. The warning in the screenshot above does not seem to cause the app to crash.

Also Flipper's Logs screen crashes because of the massive amount of logging, so I'm not sure yet what the actual crash is. I'll try to debug with Android Studio.

@andreialecu
Copy link
Contributor Author

Even Android Studio has problems keeping up with the amount of log spam:

2021-04-13 14:07:44.624 15644-15644/? I/MessageQueue: searched 10000messages,recent msg is { when=-886ms callback=com.swmansion.reanimated.Scheduler$1 target=com.facebook.react.bridge.queue.MessageQueueThreadHandler }head message is { when=-1s444ms callback=com.swmansion.reanimated.Scheduler$1 target=com.facebook.react.bridge.queue.MessageQueueThreadHandler }
    
    logcat: Unexpected EOF!
    
    This means that either the device shut down, logd crashed, or this instance of logcat was unable to read log
    messages as quickly as they were being produced.
    
    If you have enabled significant logging, look into using the -G option to increase log buffer sizes.

@andreialecu
Copy link
Contributor Author

After setting adb logcat -G 10M I was able to see the reason of the crash:

2021-04-13 14:11:29.932 1716-16416/? E/ActivityManager: ANR in the.app (the.app/.MainActivity)
    PID: 16169
    Reason: Input dispatching timed out (fdbbf7a the.app/the.app.MainActivity (server) is not responding. Waited 5005ms for MotionEvent)
    Parent: the.app/.MainActivity
    Load: 96.19 / 95.59 / 95.09
    ----- Output from /proc/pressure/memory -----
    some avg10=0.01 avg60=0.05 avg300=0.01 total=80656542
    full avg10=0.00 avg60=0.01 avg300=0.00 total=33205078
    ----- End output from /proc/pressure/memory -----

Seems that the OS just force closes it because it doesn't respond for 5 seconds.

@andreialecu andreialecu changed the title Android device log shows reanimated related message every milisecond Android device log shows reanimated related message every milisecond then crashes Apr 13, 2021
@jakub-gonet
Copy link
Member

Could you search for MessageQueue string in your app and your dependencies (outside of react-native package) sources?

Something like:

grep -r 'MessageQueue' --include='*.java' --exclude-dir='node_modules/react-native' .

in your project root.

@andreialecu
Copy link
Contributor Author

Here's a repro:

https://github.com/andreialecu/rnctv-react-native-bare-test/tree/android-reanimated-crash
Run yarn android to run it, and press the blue button, then try swiping left/right to switch between tabs.

Notice that it only occurs on a physical Oppo A72 device (I don't have any other Android device to test). I wasn't able to get it to reproduce in the emulator. Might be related to #1912 which mentions Oppo as well.

@andreialecu
Copy link
Contributor Author

andreialecu commented Apr 13, 2021

@jakub-gonet I can't find anything relevant from that search. It reproduces with the repository I linked in the previous comment, so you could run your own search in it. But there are no other native dependencies except reanimated in the project.

Make sure to use the android-reanimated-crash branch.

Attaching output below:

➜ grep -r 'MessageQueue' --include='*.java' --exclude-dir='node_modules/react-native' .
./node_modules/react-native/ReactAndroid/src/test/java/com/facebook/react/bridge/ReactTestHelper.java:import com.facebook.react.bridge.queue.MessageQueueThreadSpec;
./node_modules/react-native/ReactAndroid/src/test/java/com/facebook/react/bridge/ReactTestHelper.java:            .setJSQueueThreadSpec(MessageQueueThreadSpec.mainThreadSpec())
./node_modules/react-native/ReactAndroid/src/test/java/com/facebook/react/bridge/ReactTestHelper.java:            .setNativeModulesQueueThreadSpec(MessageQueueThreadSpec.mainThreadSpec())
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstanceImpl.java:import com.facebook.react.bridge.queue.MessageQueueThread;
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstanceImpl.java:  private final MessageQueueThread mNativeModulesQueueThread;
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstanceImpl.java:      MessageQueueThread jsQueue,
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstanceImpl.java:      MessageQueueThread moduleQueue,
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java:import com.facebook.react.bridge.queue.MessageQueueThread;
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java:  private @Nullable MessageQueueThread mUiMessageQueueThread;
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java:  private @Nullable MessageQueueThread mNativeModulesMessageQueueThread;
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java:  private @Nullable MessageQueueThread mJSMessageQueueThread;
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java:    initializeMessageQueueThreads(queueConfig);
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java:  public void initializeMessageQueueThreads(ReactQueueConfiguration queueConfig) {
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java:    if (mUiMessageQueueThread != null
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java:        || mNativeModulesMessageQueueThread != null
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java:        || mJSMessageQueueThread != null) {
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java:    mUiMessageQueueThread = queueConfig.getUIQueueThread();
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java:    mNativeModulesMessageQueueThread = queueConfig.getNativeModulesQueueThread();
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java:    mJSMessageQueueThread = queueConfig.getJSQueueThread();
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java:    if (mNativeModulesMessageQueueThread != null) {
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java:      mNativeModulesMessageQueueThread.resetPerfStats();
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java:    if (mJSMessageQueueThread != null) {
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java:      mJSMessageQueueThread.resetPerfStats();
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java:    Assertions.assertNotNull(mUiMessageQueueThread).assertIsOnThread();
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java:    return Assertions.assertNotNull(mUiMessageQueueThread).isOnThread();
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java:    Assertions.assertNotNull(mUiMessageQueueThread).runOnQueue(runnable);
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java:    Assertions.assertNotNull(mNativeModulesMessageQueueThread).assertIsOnThread();
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java:    Assertions.assertNotNull(mNativeModulesMessageQueueThread).assertIsOnThread(message);
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java:    return Assertions.assertNotNull(mNativeModulesMessageQueueThread).isOnThread();
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java:    Assertions.assertNotNull(mNativeModulesMessageQueueThread).runOnQueue(runnable);
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java:    Assertions.assertNotNull(mJSMessageQueueThread).assertIsOnThread();
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java:    return Assertions.assertNotNull(mJSMessageQueueThread).isOnThread();
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java:    Assertions.assertNotNull(mJSMessageQueueThread).runOnQueue(runnable);
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadImpl.java:public class MessageQueueThreadImpl implements MessageQueueThread {
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadImpl.java:  private final MessageQueueThreadHandler mHandler;
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadImpl.java:  private MessageQueueThreadPerfStats mPerfStats;
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadImpl.java:  private MessageQueueThreadImpl(
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadImpl.java:  private MessageQueueThreadImpl(
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadImpl.java:      MessageQueueThreadPerfStats stats) {
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadImpl.java:    mHandler = new MessageQueueThreadHandler(looper, exceptionHandler);
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadImpl.java:   * @return whether the current Thread is also the Thread associated with this MessageQueueThread.
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadImpl.java:  public MessageQueueThreadPerfStats getPerfStats() {
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadImpl.java:  private static void assignToPerfStats(MessageQueueThreadPerfStats stats, long wall, long cpu) {
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadImpl.java:  public static MessageQueueThreadImpl create(
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadImpl.java:      MessageQueueThreadSpec spec, QueueThreadExceptionHandler exceptionHandler) {
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadImpl.java:  /** @return a MessageQueueThreadImpl corresponding to Android's main UI thread. */
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadImpl.java:  private static MessageQueueThreadImpl createForMainThread(
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadImpl.java:    final MessageQueueThreadImpl mqt =
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadImpl.java:        new MessageQueueThreadImpl(name, mainLooper, exceptionHandler);
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadImpl.java:   * Creates and starts a new MessageQueueThreadImpl encapsulating a new Thread with a new Looper
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadImpl.java:   * this method exits, the new MessageQueueThreadImpl is ready to receive events.
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadImpl.java:  private static MessageQueueThreadImpl startNewBackgroundThread(
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadImpl.java:    final SimpleSettableFuture<Pair<Looper, MessageQueueThreadPerfStats>> dataFuture =
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadImpl.java:                MessageQueueThreadPerfStats stats = new MessageQueueThreadPerfStats();
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadImpl.java:    Pair<Looper, MessageQueueThreadPerfStats> pair = dataFuture.getOrThrow();
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadImpl.java:    return new MessageQueueThreadImpl(name, pair.first, exceptionHandler, pair.second);
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/QueueThreadExceptionHandler.java: * submitted via {@link MessageQueueThread#runOnQueue}.
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadSpec.java:/** Spec for creating a MessageQueueThread. */
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadSpec.java:public class MessageQueueThreadSpec {
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadSpec.java:  private static final MessageQueueThreadSpec MAIN_UI_SPEC =
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadSpec.java:      new MessageQueueThreadSpec(ThreadType.MAIN_UI, "main_ui");
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadSpec.java:  public static MessageQueueThreadSpec newUIBackgroundTreadSpec(String name) {
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadSpec.java:    return new MessageQueueThreadSpec(ThreadType.NEW_BACKGROUND, name);
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadSpec.java:  public static MessageQueueThreadSpec newBackgroundThreadSpec(String name) {
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadSpec.java:    return new MessageQueueThreadSpec(ThreadType.NEW_BACKGROUND, name);
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadSpec.java:  public static MessageQueueThreadSpec newBackgroundThreadSpec(String name, long stackSize) {
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadSpec.java:    return new MessageQueueThreadSpec(ThreadType.NEW_BACKGROUND, name, stackSize);
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadSpec.java:  public static MessageQueueThreadSpec mainThreadSpec() {
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadSpec.java:  private MessageQueueThreadSpec(ThreadType threadType, String name) {
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadSpec.java:  private MessageQueueThreadSpec(ThreadType threadType, String name, long stackSize) {
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationSpec.java: * Exception handlers on the MessageQueueThreads it uses and it would not be super clean if the
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationSpec.java:  private final MessageQueueThreadSpec mNativeModulesQueueThreadSpec;
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationSpec.java:  private final MessageQueueThreadSpec mJSQueueThreadSpec;
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationSpec.java:      MessageQueueThreadSpec nativeModulesQueueThreadSpec,
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationSpec.java:      MessageQueueThreadSpec jsQueueThreadSpec) {
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationSpec.java:  public MessageQueueThreadSpec getNativeModulesQueueThreadSpec() {
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationSpec.java:  public MessageQueueThreadSpec getJSQueueThreadSpec() {
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationSpec.java:    MessageQueueThreadSpec spec = MessageQueueThreadSpec.newBackgroundThreadSpec("native_modules");
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationSpec.java:        .setJSQueueThreadSpec(MessageQueueThreadSpec.newBackgroundThreadSpec("js"))
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationSpec.java:    private @Nullable MessageQueueThreadSpec mNativeModulesQueueSpec;
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationSpec.java:    private @Nullable MessageQueueThreadSpec mJSQueueSpec;
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationSpec.java:    public Builder setNativeModulesQueueThreadSpec(MessageQueueThreadSpec spec) {
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationSpec.java:    public Builder setJSQueueThreadSpec(MessageQueueThreadSpec spec) {
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThread.java:public interface MessageQueueThread {
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThread.java:   * @return whether the current Thread is also the Thread associated with this MessageQueueThread.
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThread.java:   * Quits this MessageQueueThread. If called from this MessageQueueThread, this will be the last
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThread.java:  MessageQueueThreadPerfStats getPerfStats();
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationImpl.java:  private final MessageQueueThreadImpl mUIQueueThread;
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationImpl.java:  private final MessageQueueThreadImpl mNativeModulesQueueThread;
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationImpl.java:  private final MessageQueueThreadImpl mJSQueueThread;
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationImpl.java:      MessageQueueThreadImpl uiQueueThread,
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationImpl.java:      MessageQueueThreadImpl nativeModulesQueueThread,
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationImpl.java:      MessageQueueThreadImpl jsQueueThread) {
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationImpl.java:  public MessageQueueThread getUIQueueThread() {
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationImpl.java:  public MessageQueueThread getNativeModulesQueueThread() {
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationImpl.java:  public MessageQueueThread getJSQueueThread() {
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationImpl.java:    Map<MessageQueueThreadSpec, MessageQueueThreadImpl> specsToThreads = MapBuilder.newHashMap();
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationImpl.java:    MessageQueueThreadSpec uiThreadSpec = MessageQueueThreadSpec.mainThreadSpec();
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationImpl.java:    MessageQueueThreadImpl uiThread = MessageQueueThreadImpl.create(uiThreadSpec, exceptionHandler);
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationImpl.java:    MessageQueueThreadImpl jsThread = specsToThreads.get(spec.getJSQueueThreadSpec());
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationImpl.java:      jsThread = MessageQueueThreadImpl.create(spec.getJSQueueThreadSpec(), exceptionHandler);
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationImpl.java:    MessageQueueThreadImpl nativeModulesThread =
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationImpl.java:          MessageQueueThreadImpl.create(spec.getNativeModulesQueueThreadSpec(), exceptionHandler);
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadHandler.java:public class MessageQueueThreadHandler extends Handler {
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadHandler.java:  public MessageQueueThreadHandler(Looper looper, QueueThreadExceptionHandler exceptionHandler) {
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadPerfStats.java:public class MessageQueueThreadPerfStats {
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfiguration.java: * Specifies which {@link MessageQueueThread}s must be used to run the various contexts of execution
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfiguration.java:  MessageQueueThread getUIQueueThread();
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfiguration.java:  MessageQueueThread getNativeModulesQueueThread();
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfiguration.java:  MessageQueueThread getJSQueueThread();
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/BaseJavaModule.java:  // taken from Libraries/Utilities/MessageQueue.js
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricJSIModuleProvider.java:import com.facebook.react.bridge.queue.MessageQueueThread;
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricJSIModuleProvider.java:    MessageQueueThread jsMessageQueueThread =
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricJSIModuleProvider.java:        jsMessageQueueThread,
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/Binding.java:import com.facebook.react.bridge.queue.MessageQueueThread;
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/Binding.java:      MessageQueueThread jsMessageQueueThread,
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/Binding.java:      @NonNull MessageQueueThread jsMessageQueueThread,
./node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/Binding.java:        jsMessageQueueThread,

@andreialecu
Copy link
Contributor Author

andreialecu commented Apr 13, 2021

The only other similar type of log that I can find is in this pastebin from 2019:
https://pastebin.com/mNyhtCqh

No idea what is logging it. I think it's related to doing sync work on the main thread, resulting in some sort of race condition.

@andreialecu
Copy link
Contributor Author

One note about the repro: It initially did excessive work, trying to load 1000 images. This resulted in the same issue just by itself.

I pushed a commit to it to load less, then you can see the crash occur while swiping between tabs.

It's possible that react-native-collapsible-tab-view does something it shouldn't, but I don't think it should produce a hang/crash.

@piaskowyk
Copy link
Member

Probably this issue is related with #1923

@andreialecu
Copy link
Contributor Author

andreialecu commented Apr 14, 2021

@piaskowyk do you have any information on why you think that?

I have just tried switching to reanimated 2.0.1 in the repro I linked above. The crash from #1923 does not happen with 2.0.1, but I can still reproduce the log spam even with that version.

@andreialecu
Copy link
Contributor Author

Just a note: I'm definitely able to reproduce this on 2.0.1, seems #1842 is only part of 2.1.0.

I ran gradle clean and everything.

@piaskowyk
Copy link
Member

Thanks for info. I will check this and let you know when I will know what happened.

@andreialecu
Copy link
Contributor Author

So this is interesting, I switched from Hermes to JSC on 2.1.0 and tested the repro and the same logs have appeared, but this time the app wasn't force closed. It was responsive from time to time, but mostly it was hung. It would respond every few seconds or so for just one frame.

It then suddenly stopped the logs and the app became responsive. Notice the OpenGLRenderer log immediately after.

Screenshot 2021-04-14 at 18 43 49

@andreialecu
Copy link
Contributor Author

@piaskowyk just wondering, because you didn't mention it.

Were you able to actually reproduce this issue with my repro?

@LadislavBohm
Copy link

I am having the same issue on OnePlus device when switching between BottomTabs using react-navigation. When

  1. start the animation with a button click
  2. wait for animation to finish
  3. navigate to another tab
  4. go back to previous tab

App will hang and after few seconds crash.

@piaskowyk piaskowyk self-assigned this May 26, 2021
@andreialecu
Copy link
Contributor Author

@piaskowyk if this helps, it appears that this happens more frequently when the main JS thread has a lot of work to do.

In our app, we're using @formatjs Intl polyfills which are very slow. It can take 20ms to format a single date on a real android device using Hermes.

If we have a FlatList and each item formats a date, the bigger the list is, the faster this bug occurs with reanimated.

It looks like it might be triggered by some race condition.

Regardless, the repro I attached in my earlier comment does show the issue more consistently. In the real app it occurs more randomly.

@andreialecu
Copy link
Contributor Author

andreialecu commented Jun 23, 2021

An update on this.

After optimizing everything as much as possible and reducing JS thread cpu usage to very low levels this stopped happening even on the lower end device.

I'll keep it open because the repro above still shows it.

@kacperkapusciak kacperkapusciak added the bug-bash-jan22 Issues visited during Bug Bash Jan 2022 label Jan 28, 2022
@piaskowyk piaskowyk removed their assignment Jan 28, 2022
@piaskowyk
Copy link
Member

Since this issue is opened I have never reproduced this problem :/ I hope that the many changes we made resolved this issue. Let me close this one 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug bug-bash-jan22 Issues visited during Bug Bash Jan 2022 🏠 Reanimated 2
Projects
None yet
Development

No branches or pull requests

5 participants