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

RCTBridge required dispatch_sync to load RCTDevLoadingView. This may lead to deadlocks #16376

Open
antoinerousseau opened this Issue Oct 15, 2017 · 69 comments

Comments

Projects
None yet
@antoinerousseau
Copy link
Contributor

antoinerousseau commented Oct 15, 2017

I randomly get this warning at iOS app start (i.e. not always).

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

OS: macOS Sierra 10.12.6
Node: 6.10.2
Yarn: 1.0.2
npm: 5.4.2
Watchman: 4.7.0
Xcode: Xcode 9.0 Build version 9A235
Android Studio: 2.1 AI-143.2915827

Packages: (wanted => installed)
react: ^16.0.0 => 16.0.0
react-native: ^0.49.3 => 0.49.3

Steps to Reproduce

  1. Start the app

Expected Behavior

No warning

Actual Behavior

capture d ecran 2017-10-15 12 49 45

Reproducible Demo

N/A

Some packages I use

https://github.com/antoinerousseau/react-native-custom-components
https://github.com/rebeccahughes/react-native-device-info
https://github.com/evollu/react-native-fcm
https://github.com/gwmccull/react-native-polyfill
https://github.com/getsentry/react-native-sentry

@itchingpixels

This comment has been minimized.

Copy link

itchingpixels commented Oct 15, 2017

Same here!

@eggybot

This comment has been minimized.

Copy link

eggybot commented Oct 15, 2017

got this yellow issue for iOS

@rizzomichaelg

This comment has been minimized.

Copy link

rizzomichaelg commented Oct 15, 2017

I see this as well. Possibly related to #11196.
I believe this is what is also causing the app to crash when trying to reload; it fails with
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'This method must not be called before the JS thread is created'

@jozan

This comment has been minimized.

Copy link
Contributor

jozan commented Oct 16, 2017

I'm also getting this error from time to time on iOS 11 and I've got no idea how to debug this to give more information. Stacktrace doesn't help at all in this case.

@minikin

This comment has been minimized.

Copy link

minikin commented Oct 16, 2017

+1

1 similar comment
@mkozhukharenko

This comment has been minimized.

Copy link

mkozhukharenko commented Oct 17, 2017

+1

@antoinerousseau

This comment has been minimized.

Copy link
Contributor Author

antoinerousseau commented Oct 17, 2017

Please stop adding +1s, this is generating email notifications that don't add any information. Use the "add reaction" feature instead.

@dantman

This comment has been minimized.

Copy link
Contributor

dantman commented Nov 7, 2017

Same issue. Here are the packages I use:

  • react-native-device-info
  • react-native-interactable
  • react-native-sensitive-info
  • react-native-snackbar
  • react-native-splash-screen
  • react-native-svg
  • react-native-vector-icons

Given the intersection with @antoinerousseau's list, the possible locations for this bug are:

  • A bug in react-native itself
  • A bug in react-native-device-info
  • Multiple bugs in libraries other than react-native-device-info
@disjfa

This comment has been minimized.

Copy link

disjfa commented Nov 8, 2017

I just added react-native-device-info, and moved from rn 0.49 to 0.50. and now i found this bug. Don't know if it's the problem, but it's when i got this.

@MilkBiscuit

This comment has been minimized.

Copy link

MilkBiscuit commented Nov 9, 2017

Same issue...
So it was not my fault ?

@WhoJave

This comment has been minimized.

Copy link

WhoJave commented Nov 10, 2017

Same issue... Do u have any solutions ?

@SMJ93

This comment has been minimized.

Copy link

SMJ93 commented Nov 14, 2017

Same issue. The only package from the list above we use is react-native-sentry.

@bullantt

This comment has been minimized.

Copy link

bullantt commented Nov 15, 2017

Same issue here today i have started a brand new app and only package i have added
"native-base": "^2.3.3",
"react": "16.0.0",
"react-native": "0.50.3",
"react-native-fcm": "^10.0.3"

@fishmwei

This comment has been minimized.

Copy link

fishmwei commented Nov 16, 2017

@rizzomichaelg
+1
"react-native": "0.49.3",
app crashed when first load randomly.

anybody resolved it ??

@thejacobseely

This comment has been minimized.

Copy link

thejacobseely commented Nov 16, 2017

@dantman I started seeing the issue immediately after installing react-native-device-info, so I highly suspect the issue is related, at least in our case, to that specific package.

The only other package I am using react-native-keychain, which I installed quite a while ago without any issues, so it seems like a good bet.

@ahanriat

This comment has been minimized.

Copy link
Contributor

ahanriat commented Nov 19, 2017

@dantman

This comment has been minimized.

Copy link
Contributor

dantman commented Nov 20, 2017

rebeccahughes/react-native-device-info#260 seems to have a message referring to RNDeviceInfo while this bug refers to RCTDevLoadingView. So there may be more than one spot triggering this warning.

@mattijsf

This comment has been minimized.

Copy link
Contributor

mattijsf commented Nov 28, 2017

If you would put a breakpoint on the following line:

RCTLogWarn(@"RCTBridge required dispatch_sync to load %@. This may lead to deadlocks", _moduleClass);

You can see which module/stack is responsible for loading RCTDevLoadingView in my case it was RCTCxxBridge.mm which was loading the remote bundle and reporting the download progress on RCTDevLoadingView:

... onProgress:^(RCTLoadingProgress *progressData) {
#if RCT_DEV && __has_include("RCTDevLoadingView.h")
      RCTDevLoadingView *loadingView = [weakSelf moduleForClass:[RCTDevLoadingView class]];
      [loadingView updateProgress:progressData];
#endif
    }];

Here the RCTCxxBridge is using moduleForClass which will load an instance of the module if it is not yet available. Due to the queue used for the onProgress block RCTDevLoadingView would be loaded on a non-main queue, while RCTDevLoadingView requires a main-queue setup.

I was able to workaround the warning by optimistically load RCTDevLoadingView by returning an instance from my RCTBridgeDelegate using:
- (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge;

@devvitali

This comment has been minimized.

Copy link

devvitali commented Dec 10, 2017

I was able to workaround the warning by updating AppDelegate.m

#if RCT_DEV
#import <React/RCTDevLoadingView.h>
#endif
...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  ...
  RCTBridge *bridge = [[RCTBridge alloc] initWithBundleURL:jsCodeLocation
                                            moduleProvider:nil
                                             launchOptions:launchOptions];
#if RCT_DEV
  [bridge moduleForClass:[RCTDevLoadingView class]];
#endif
  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
                                                   moduleName:@"Test"
                                            initialProperties:nil];
  ...
}
@rskull

This comment has been minimized.

Copy link

rskull commented Dec 15, 2017

react-native: 0.50.4
same issue...

@6axter82

This comment has been minimized.

Copy link

6axter82 commented Dec 15, 2017

react-native: 0.51.0
same issue...

@pigflymoon

This comment has been minimized.

Copy link

pigflymoon commented Jan 10, 2018

"react": "16.2.0",
"react-native": "0.52.0",
same issue...

@berkcoker

This comment has been minimized.

Copy link

berkcoker commented Jan 17, 2018

"react": "16.2.0",
"react-native": "0.51.0",
"react-native-device-info": "0.13.0"

My solution here was to move react-native-device-info out of the pod file and link it manually in the project. That seemed to solve the issue. I think another approach could be to include CxxBridge as a subspec for React in the pod file, but that requires Folly (and so boost), and that whole setup is cumbersome / takes long time. If you want a quick fix, simply remove the packages that are causing the issue out of pod.

@leaphawk

This comment has been minimized.

Copy link

leaphawk commented Mar 17, 2018

No "react-native-device-info" installed:
Issue exists in 0.54.2 :

"react": "16.3.0-alpha.2",
"react-native": "0.54.2",
"react-native-action-button": "^2.8.4",
"react-native-admob": "^2.0.0-beta.4",
"react-native-animatable": "^1.2.4",
"react-native-awesome-alerts": "^1.0.7",
"react-native-elements": "^0.19.0",
"react-native-fbsdk": "^0.7.0",
"react-native-linear-gradient": "^2.4.0",
"react-native-parallax-scroll-view": "^0.21.0",
"react-native-photo-grid": "0.0.2",
"react-native-responsive-dimensions": "^1.0.2",
"react-native-snap-carousel": "^3.6.0",
"react-native-vector-icons": "^4.5.0",
"react-navigation": "^1.5.7"

@leaphawk

This comment has been minimized.

Copy link

leaphawk commented Mar 17, 2018

It was with the "react-native-action-button": "^2.8.4", Adding shadowStyle={{shadowOpacity: 0.9}} solved the warning..

@wellyshen

This comment has been minimized.

Copy link

wellyshen commented Mar 19, 2018

Same issue here.

@avinashwigroup

This comment has been minimized.

Copy link

avinashwigroup commented Apr 2, 2018

Same issue.
RN 0.54.4

@SkrewEverything

This comment has been minimized.

Copy link

SkrewEverything commented Apr 5, 2018

Anybody got the solution?

The error comes even for freshly/newly created project.

"react": "16.3.1",
"react-native": "0.54.4"

@yogu2017

This comment has been minimized.

Copy link

yogu2017 commented Apr 9, 2018

same

@MikeSilvis

This comment has been minimized.

Copy link

MikeSilvis commented Apr 13, 2018

+1

@antoinerousseau any update on this issue?

@carvingpixel

This comment has been minimized.

Copy link

carvingpixel commented Jul 20, 2018

Encountered this issue on OS11 as well.

  • react-navigation
  • react-native-vector-icons

I see a few people here that have mentioned using vector-icons.

@coder4affine

This comment has been minimized.

Copy link

coder4affine commented Aug 14, 2018

I also had the same issue for me i have unlink and remove react-native-device-info and now that warning is not appearing.

@tompark

This comment has been minimized.

Copy link

tompark commented Aug 16, 2018

I had the same issue after adding react-native-vector-icons, removed it and warning went away.

@mokriya

This comment has been minimized.

Copy link

mokriya commented Aug 26, 2018

FYI, this warning showed up today after reload with remote debugger on. Turned remote off, did reload, no warning. Turned remote back on, did reload, no warning.

@adam-s

This comment has been minimized.

Copy link

adam-s commented Aug 31, 2018

FYI, this warning showed up today after reload with remote debugger on. Turned remote off, did reload, no warning. Turned remote back on, did reload, no warning.

After reading @mokriya comment I reloaded the debugger and it stopped showing the warning. It is possible that moving between Android and IOS emulator / simulator with the debugger tab open in the browser is causing this.

Nope not that

@solonifer

This comment has been minimized.

Copy link

solonifer commented Sep 14, 2018

iOS 12, RN 0.57.0 same issue.

@shinriyo

This comment has been minimized.

Copy link

shinriyo commented Sep 18, 2018

how to resolve?
or ignore is?

import { YellowBox } from 'react-native';
YellowBox.ignoreWarnings(['RCTBridge']);
@FullstackJack

This comment has been minimized.

Copy link

FullstackJack commented Nov 2, 2018

Yes, I am having this issue as well after adding react-native-video, but what does it mean? It doesn't seem to prevent videos from playing. Also why are all of these third-party components causing the error? Are we missing something in developing our native modules?

@2hyjun

This comment has been minimized.

Copy link

2hyjun commented Nov 6, 2018

Getting same issue on iOS 12.1, RN 0.57.4 without react-native-device-info

@bashirpour

This comment has been minimized.

Copy link

bashirpour commented Nov 15, 2018

I have some issue

"lodash": "^4.17.10",
"react": "16.4.1",
"react-native": "0.56.0",
"react-native-check-box": "^2.1.0",
"react-native-collapsible": "^1.2.1",
"react-native-elements": "^0.19.1",
"react-native-google-analytics-bridge": "^5.8.0",
"react-native-google-places-autocomplete": "^1.3.9",
"react-native-map-clustering": "^1.3.0",
"react-native-maps": "^0.21.0",
"react-native-masked-text": "^1.7.2",
"react-native-modal-picker": "0.0.16",
"react-native-onesignal": "^3.2.8",
"react-native-simple-radio-button": "^2.7.2",
"react-native-svg": "^8.0.0",
"react-native-ui-kitten": "^3.0.1",
"react-native-vector-icons": "^5.0.0",
"react-navigation": "^2.11.2",
"rn-sliding-up-panel": "^1.2.1",
"victory-native": "^30.5.0"
@srichallamalla935

This comment has been minimized.

Copy link

srichallamalla935 commented Dec 12, 2018

In IOS getting "RCTBridge required dispatch_snyc to load RCTDevLoadingView This may lead to deadlocks."

@achmadk

This comment has been minimized.

Copy link

achmadk commented Dec 23, 2018

Maybe you should Project -> Clean in your Xcode, then re-run your application.

@aleclarson

This comment has been minimized.

Copy link
Contributor

aleclarson commented Dec 26, 2018

I've confirmed that this comment is the solution. Thank you @mattijsf!

Find your RCTBridgeDelegate and override the extraModulesForBridge method.

Objective-C

@interface MyBridgeDelegate : NSObject <RCTBridgeDelegate>
@end

@implementation MyBridgeDelegate

- (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge
{
  return @[
#if RCT_DEV
    [bridge moduleForClass:[RCTDevLoadingView class]],
#endif
  ];
}

@end

Swift 4

class MyBridgeDelegate: NSObject, RCTBridgeDelegate {
  func extraModules(for bridge: RCTBridge!) -> [RCTBridgeModule]! {
    var modules: [Any]! = []
    if RCT_DEV == 1 {
      modules.append(bridge.module(for: RCTDevLoadingView.self))
    }
    return modules as? [RCTBridgeModule]
  }
}
@kodayashi

This comment has been minimized.

Copy link

kodayashi commented Dec 28, 2018

Repro on iOS12, RN 0.57.8

@EvanMaFYH

This comment has been minimized.

Copy link

EvanMaFYH commented Jan 8, 2019

image
my dependency,the same issue

@ccorcos

This comment has been minimized.

Copy link

ccorcos commented Jan 11, 2019

@aleclarson what exactly does that code do?

@aleclarson

This comment has been minimized.

Copy link
Contributor

aleclarson commented Jan 12, 2019

@ccorcos It loads the RCTDevLoadingView earlier, so it doesn't have to block the main thread when it's loaded by RN. This comment might be an easier solution for you.

@mikehardy

This comment has been minimized.

Copy link

mikehardy commented Jan 24, 2019

Not sure if this is still happening for others but it still happening for me with RN 0.57.8 + iOS 11.3 (at least)

I'm using the change from the comment above by @devburmistro successfully

@Komalov

This comment has been minimized.

Copy link

Komalov commented Jan 29, 2019

Facing this issue

RN 0.58.3
iOS 11.4, 12.1

and it does lead to deadlock. It happens to me when I closing custom modal

I haven't had this on previous 0.57.8 which was just fine

@oferRounds

This comment has been minimized.

Copy link

oferRounds commented Jan 29, 2019

Same here, getting this after upgrading to RN 0.58.3

@oferRounds

This comment has been minimized.

Copy link

oferRounds commented Jan 29, 2019

my exact error is: Unable find module for DevLoadingView, the solutions above do not fix it for me

screen shot 2019-01-30 at 0 54 04

@oferRounds

This comment has been minimized.

Copy link

oferRounds commented Jan 29, 2019

Seems related to this commit, which has in fact added on RN 0.58.3

d7a0c44#diff-a2a67635fffd7b690d14dc17ae563a71

@superguineapig

This comment has been minimized.

Copy link

superguineapig commented Jan 31, 2019

I am experiencing the same "Unable to find module for DevLoadingView" issue as @oferRounds after upgrading to RN 0.58.3 today.

It seems to trigger when an app is first opened in the simulator. Subsequent reloads (cmd-R) do not present the error.

EDIT: filed a separate issue for this specific error: #23235

@noahtallen

This comment has been minimized.

Copy link

noahtallen commented Feb 5, 2019

I can also confirm that this is still an issue on iOS with 0.58.3.

Some interesting observations:

  • As @superguineapig said, it does not show up after you reload the app.
  • If you quit all terminal instances, and build the app/start the packager fresh, it will not show the error. However, if you then keep the packager open and re-build the app from Xcode, the error shows up after the app attaches to the packager again.

Edit: I can confirm that this workaround is still a viable solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment