Skip to content

Conversation

@HeyImChris
Copy link

@HeyImChris HeyImChris commented May 13, 2021

Please select one of the following

  • I am removing an existing difference between facebook/react-native and microsoft/react-native-macos 👍
  • I am cherry-picking a change from Facebook's react-native into microsoft/react-native-macos 👍
  • I am making a fix / change for the macOS implementation of react-native
  • I am making a change required for Microsoft usage of react-native

Summary

Our logs show intermittent crashes with the stack ending here. It's not obvious what's failing as everything in the stack is pretty safe, but the only potentially suspicious behavior is we blindly pass in an NSRunLoop object into a non-null parameter of a method.

It's not obvious how the custom run loop could fail to instantiate, but there's no harm in being safe here and adding a nil check and log to see if we ever hit this.

After this gets in I can bring the same change over to our stable branches.

Changelog

[General] [Bug] - Nil check our custom run loop

Test Plan

It's just a simple nil check so nothing to test here. I can't repro the failure but in a test app was able to verify we'll throw an exception if we pass a nil object in as a non-null parameter.

@HeyImChris HeyImChris requested a review from harrieshin May 13, 2021 05:46
@HeyImChris HeyImChris requested a review from alloy as a code owner May 13, 2021 05:46
@HeyImChris HeyImChris self-assigned this May 13, 2021
@pull-bot
Copy link

Messages
📖

📋 Verify Changelog Format - A changelog entry has the following format: [CATEGORY] [TYPE] - Message.

DetailsCATEGORY may be:
  • General
  • macOS
  • iOS
  • Android
  • JavaScript
  • Internal (for changes that do not need to be called out in the release notes)

TYPE may be:

  • Added, for new features.
  • Changed, for changes in existing functionality.
  • Deprecated, for soon-to-be removed features.
  • Removed, for now removed features.
  • Fixed, for any bug fixes.
  • Security, in case of vulnerabilities.

MESSAGE may answer "what and why" on a feature level. Use this to briefly tell React Native users about notable changes.

Generated by 🚫 dangerJS against 66da532

{
if (!_scheduledRunloops.count) {
[self scheduleInRunLoop:[NSRunLoop RCTSR_networkRunLoop] forMode:NSDefaultRunLoopMode];
// [TODO(macOS ISS#2323203): `scheduleInRunLoop:forMode:` takes in a non-null run loop parameter so let's be safe and verify that
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a better bug number or can we create one in git then this generic ISS number?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked and one didn't exist. I figure since we need to go through and update all of these anyway, making it one that we can easily track/update all at once might be easier than making a new one and not tracking it well/forgetting about it

@HeyImChris HeyImChris merged commit e0e598e into microsoft:master May 13, 2021
HeyImChris added a commit to HeyImChris/react-native-macos that referenced this pull request May 13, 2021
* Update RCTCxxBridge.mm

* Update RCTCxxBridge.mm

* run loop nil check

Co-authored-by: Chris Hogan <chrishogan@Chriss-MacBook-Pro-2.local>
HeyImChris added a commit to HeyImChris/react-native-macos that referenced this pull request May 13, 2021
* Update RCTCxxBridge.mm

* Update RCTCxxBridge.mm

* run loop nil check

Co-authored-by: Chris Hogan <chrishogan@Chriss-MacBook-Pro-2.local>
HeyImChris added a commit that referenced this pull request May 14, 2021
* Add nullability checks (#704)

* Update RCTCxxBridge.mm

* add nullability checks

* Nil check our run loop thread (#771)

* Update RCTCxxBridge.mm

* Update RCTCxxBridge.mm

* run loop nil check

Co-authored-by: Chris Hogan <chrishogan@Chriss-MacBook-Pro-2.local>

* podfile lock

Co-authored-by: Chris Hogan <chrishogan@Chriss-MacBook-Pro-2.local>
HeyImChris added a commit that referenced this pull request May 14, 2021
* Update RCTCxxBridge.mm

* Update RCTCxxBridge.mm

* run loop nil check

Co-authored-by: Chris Hogan <chrishogan@Chriss-MacBook-Pro-2.local>

Co-authored-by: Chris Hogan <chrishogan@Chriss-MacBook-Pro-2.local>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants