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

iOS Warning: RCTBridge required dispatch_sync to load REAModule #3678

Closed
dimaischenko opened this issue Oct 15, 2022 · 23 comments · Fixed by #3698
Closed

iOS Warning: RCTBridge required dispatch_sync to load REAModule #3678

dimaischenko opened this issue Oct 15, 2022 · 23 comments · Fixed by #3698
Labels
Missing repro This issue need minimum repro scenario Needs review Issue is ready to be reviewed by a maintainer Platform: iOS This issue is specific to iOS

Comments

@dimaischenko
Copy link

Description

When the application starts, I get the following warning: RCTBridge required dispatch_sync to load REAModule. This may lead to deadlocks

Steps to reproduce

Every time the application is launched

Знімок екрана 2022-10-15 о 11 33 43

Snack or a link to a repository

Sorry

Reanimated version

2.11.0

React Native version

0.70.3

Platforms

iOS

JavaScript runtime

No response

Workflow

React Native (without Expo)

Architecture

No response

Build type

No response

Device

No response

Device model

No response

Acknowledgements

Yes

@dimaischenko dimaischenko added the Needs review Issue is ready to be reviewed by a maintainer label Oct 15, 2022
@github-actions github-actions bot added the Missing repro This issue need minimum repro scenario label Oct 15, 2022
@github-actions
Copy link

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

@github-actions github-actions bot added the Platform: iOS This issue is specific to iOS label Oct 15, 2022
@dpyeates
Copy link

I see am seeing this as well now.

@godlikeAlex
Copy link

+1

@enahum
Copy link

enahum commented Oct 15, 2022

same

@godlikeAlex

This comment was marked as outdated.

@dimaischenko
Copy link
Author

Thank you, so the downgrade will help, but maybe someone will know what a patch or fixes for the current release

@aymather
Copy link
Contributor

I can also confirm that moving from 2.10.0 -> 2.11.0 introduced this issue.

@AmeyaDalvi
Copy link

Facing the same issue, will a downgrade work? I'm assuming it will but it wont fix the issue

@tomekzaw
Copy link
Member

tomekzaw commented Oct 17, 2022

Hey, we are investigating this issue and working on a fix.

Feel free to use 2.10.0 or call LogBox.ignoreLogs to ignore this warning.

@Max-DVS
Copy link

Max-DVS commented Oct 18, 2022

Hello,

I stumbled upon the same issue today using 2.11.0

Just start a fresh project and follow react navigation documentation to add a drawer...

The only missing piece on their docs is to add react-native-reanimated/plugin into babel...

did a pod install and the only thing I got was that error, a regular stack works while a drawer will throw that error.

The fix was to get back to 2.10.0

@hadnet
Copy link

hadnet commented Oct 19, 2022

Same here using Reanimated 3-RC3

@alqamabinsadiq
Copy link

Downgrading to 2.10.0 worked for me too.

@tomekzaw
Copy link
Member

tomekzaw commented Oct 20, 2022

The offending PR is #3555. Fixed in #3698.

If you encounter warning "RCTBridge required dispatch_sync to load REAModule", you have four options:

  1. Simply ignore the warning (it only appears in debug mode, so you won't see this in production build of your app).

  2. Add the following code in index.js of your app:

import { LogBox } from 'react-native';

LogBox.ignoreLogs(['RCTBridge required dispatch_sync to load REAModule']);
  1. Remove the following lines in node_modules/react-native-reanimated/ios/REAModule.mm (e.g. using patch-package):
- + (BOOL)requiresMainQueueSetup
- {
-   return YES;
- }
  1. Downgrade to react-native-reanimated@2.10.0 and upgrade to 2.12.0 once this issue is fixed.

@tomekzaw tomekzaw pinned this issue Oct 20, 2022
@dimaischenko
Copy link
Author

@tomekzaw Thank you for such a quick response, work and clarification!

piaskowyk pushed a commit that referenced this issue Oct 20, 2022
…3698)

## Description

Fixes #3678. Reverts part of #3555 for Paper.

On Paper, the warning "RCTBridge required dispatch_sync to load
REAModule" was gone when I removed `requiresMainQueueSetup` method
introduced in #3678. However, the PR description explicitly states that
this method was added in order to eliminate the following warning:

> This is because the `init` method was not present before and after
adding it, it caused this warning:
> 
> `Module RCTImagePickerManager requires main queue setup since it
overrides init but doesn't implement 'requiresMainQueueSetup'. In a
future release React Native will default to initializing all native
modules on a background thread unless explicitly opted-out of.`

However, after the removal of `requiresMainQueueSetup` no warning
appears, so I assume that it is in fact not necessary to initialize
REAModule on main queue, thus it's safe to remove
`requiresMainQueueSetup`.

On Fabric, removing `requiresMainQueueSetup` it crashes the app on
reload, so I've left it as it is for now. We may address this
inconsistency in a separate PR.
piaskowyk pushed a commit that referenced this issue Oct 20, 2022
…3698)

## Description

Fixes #3678. Reverts part of #3555 for Paper.

On Paper, the warning "RCTBridge required dispatch_sync to load
REAModule" was gone when I removed `requiresMainQueueSetup` method
introduced in #3678. However, the PR description explicitly states that
this method was added in order to eliminate the following warning:

> This is because the `init` method was not present before and after
adding it, it caused this warning:
> 
> `Module RCTImagePickerManager requires main queue setup since it
overrides init but doesn't implement 'requiresMainQueueSetup'. In a
future release React Native will default to initializing all native
modules on a background thread unless explicitly opted-out of.`

However, after the removal of `requiresMainQueueSetup` no warning
appears, so I assume that it is in fact not necessary to initialize
REAModule on main queue, thus it's safe to remove
`requiresMainQueueSetup`.

On Fabric, removing `requiresMainQueueSetup` it crashes the app on
reload, so I've left it as it is for now. We may address this
inconsistency in a separate PR.
@skam22
Copy link

skam22 commented Oct 21, 2022

not to nitpick but the method is LogBox.ignoreLogs, not LogBox.ignore:

import { LogBox } from 'react-native';

LogBox.ignoreLogs(['RCTBridge required dispatch_sync to load REAModule']);

@tomekzaw
Copy link
Member

This issue has been fixed in #3698 and released in 2.12.0 so upgrade and you will never see this warning again.

@tomekzaw tomekzaw unpinned this issue Oct 28, 2022
fluiddot pushed a commit to wordpress-mobile/react-native-reanimated that referenced this issue Jun 5, 2023
…oftware-mansion#3698)

## Description

Fixes software-mansion#3678. Reverts part of software-mansion#3555 for Paper.

On Paper, the warning "RCTBridge required dispatch_sync to load
REAModule" was gone when I removed `requiresMainQueueSetup` method
introduced in software-mansion#3678. However, the PR description explicitly states that
this method was added in order to eliminate the following warning:

> This is because the `init` method was not present before and after
adding it, it caused this warning:
> 
> `Module RCTImagePickerManager requires main queue setup since it
overrides init but doesn't implement 'requiresMainQueueSetup'. In a
future release React Native will default to initializing all native
modules on a background thread unless explicitly opted-out of.`

However, after the removal of `requiresMainQueueSetup` no warning
appears, so I assume that it is in fact not necessary to initialize
REAModule on main queue, thus it's safe to remove
`requiresMainQueueSetup`.

On Fabric, removing `requiresMainQueueSetup` it crashes the app on
reload, so I've left it as it is for now. We may address this
inconsistency in a separate PR.
@derwaldgeist
Copy link

I'm seeing this in a brand-new installation of RN (macOS Sonoma, iOS 17). Shouldn't this be fixed by now?

@tomekzaw
Copy link
Member

@derwaldgeist Yes, this should be fixed. Which version of Reanimated exactly are you using?

@derwaldgeist
Copy link

@derwaldgeist Yes, this should be fixed. Which version of Reanimated exactly are you using?

Oh, sorry. I just realized that this repo is related to a certain library. I just came here via Google and thought it was on the react-native repo itself. I just tried out RN, to check how far I can get on a Vision Pro (but the issue also occurred on iOS).

@tuantvk
Copy link

tuantvk commented Jan 30, 2024

@tomekzaw I got the same warning in the new version.

"react-native": "0.73.3",
"react-native-reanimated": "^3.6.2",

I think maybe it is related to the new version react-native.

  // This dispatch_async avoids a deadlock while configuring native modules
  dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0), ^{
    id a11yManager = [self->_bridge moduleForName:@"AccessibilityManager"
                                             lazilyLoadIfNecessary:YES];
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(didReceiveNewContentSizeMultiplier)
                                                 name:@"RCTAccessibilityManagerDidUpdateMultiplierNotification"
                                               object:a11yManager];

packages/react-native/React/Modules/RCTUIManager.m

@correafederico25
Copy link

correafederico25 commented Jan 30, 2024

@tuantvk I also have the same warning in version 0.73.3

A few days ago I built an app with version 0.73.2 and I didn't have any problems. 1 hour ago I built a new app with version 0.73.3 and started seeing this warning.

Do you think this warning could cause problems later? Or we could just ignore it.

{
  "name": "AwesomeProject2",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "lint": "eslint .",
    "start": "react-native start",
    "test": "jest"
  },
  "dependencies": {
    "react": "18.2.0",
    "react-native": "0.73.3"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@babel/preset-env": "^7.20.0",
    "@babel/runtime": "^7.20.0",
    "@react-native/babel-preset": "0.73.20",
    "@react-native/eslint-config": "0.73.2",
    "@react-native/metro-config": "0.73.4",
    "@react-native/typescript-config": "0.73.1",
    "@types/react": "^18.2.6",
    "@types/react-test-renderer": "^18.0.0",
    "babel-jest": "^29.6.3",
    "eslint": "^8.19.0",
    "jest": "^29.6.3",
    "prettier": "2.8.8",
    "react-test-renderer": "18.2.0",
    "typescript": "5.0.4"
  },
  "engines": {
    "node": ">=18"
  }
}

@Milutin-P
Copy link

@correafederico25 Are you sure that it is the same message? I got RCTBridge required dispatch_sync to load RCTAccessibilityManager. This may lead to deadlocks. Which is not related to RNA, I would say.

@uen
Copy link

uen commented Feb 1, 2024

Check facebook/react-native#42728 - it is fixed in 0.73.4, and not an issue with reanimated, but this is the first thing that comes up on google if you search 'RCTBridge required dispatch_sync' and leave out the RCTAccessibilityManager part

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Missing repro This issue need minimum repro scenario Needs review Issue is ready to be reviewed by a maintainer Platform: iOS This issue is specific to iOS
Projects
None yet