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

Race condition in RCTBridge #1116

Closed
artemyarulin opened this issue May 3, 2015 · 5 comments
Closed

Race condition in RCTBridge #1116

artemyarulin opened this issue May 3, 2015 · 5 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@artemyarulin
Copy link

  1. RCTBridge.setUp is executing. On some moment module is created using [[moduleClass alloc] init]
  2. RCTReachability.m subscribes to event in init method: SCNetworkReachabilitySetCallback(_reachability, RCTReachabilityCallback, &context);
  3. RCTBridge.setUp continuing and calls RCTLocalModulesConfig
  4. RCTReachabilityCallback is called and executes eventDispathed.sendDeviceEventWithName -> enqueueJSCall
  5. enqueueJSCall - crashes because there are no modules exists yet
@artemyarulin
Copy link
Author

Here pull request which fixes this issue (actually I guess this is a real reason for #1114).

Now I'm thinking that it worth giving user a warning that his call is ignored because RCTBridge still initializing, what do you think?

@nicklockwood
Copy link
Contributor

Cc: @tadeuzagallo, who's been working on a unified solution for these race conditions.

@tadeuzagallo
Copy link
Contributor

Thanks @artemyarulin for raising that issue!

I had moved the _loading already, but after your comment I figured out a way so we never ignore any call, so it should be alright now.

The commit hasn't landed internally yet, but I'm working on it, shouldn't take long now.

@artemyarulin
Copy link
Author

@tadeuzagallo Cool, thank you!

@nicklockwood
Copy link
Contributor

Fixed in #1165

@facebook facebook locked as resolved and limited conversation to collaborators May 29, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 22, 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

Successfully merging a pull request may close this issue.

4 participants