mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Only show deadlock warning when TM eager init is on
Summary: During setup, TurboModules may synchronously dispatch to the main queue, if they require main queue setup. This is dangerous because it could cause the app to deadlock during TurboModule require. This is why D21654637 (https://github.com/facebook/react-native/commit/e206e34175c091a753c0e733abeda41b662241d4) added a warning aginst this. However, this diff had a mistake. We only want to display the warning if TurboModule eager initialization is enabled, because then, we can eagerly initialize the TurboModules before the bridge starts to avoid the problem. D21654637 (https://github.com/facebook/react-native/commit/e206e34175c091a753c0e733abeda41b662241d4) instead showed the warning if TurboModule eager init **wasn't** enabled. This isn't useful, because there's no way to avoid the problem with TurboModu eager initialization off. Changelog: [Internal] Reviewed By: sammy-SC Differential Revision: D22529780 fbshipit-source-id: 15238483758b66b1a6addcad948203c64dca96ad
This commit is contained in:
committed by
Facebook GitHub Bot
parent
7694b32a88
commit
9f3b6082da
@@ -397,11 +397,11 @@ static Class getFallbackClassFromName(const char *name)
|
||||
|
||||
if ([self _requiresMainQueueSetup:moduleClass]) {
|
||||
/**
|
||||
* When TurboModule eager initialization is disabled, we expect TurboModules requiring main queue setup to be
|
||||
* required on background threads.
|
||||
* When TurboModule eager initialization is enabled, there shouldn't be any TurboModule initializations on the
|
||||
* main queue.
|
||||
* TODO(T69449176) Roll out TurboModule eager initialization, and remove this check.
|
||||
*/
|
||||
if (!RCTIsMainQueue() && !RCTTurboModuleEagerInitEnabled()) {
|
||||
if (RCTTurboModuleEagerInitEnabled() && !RCTIsMainQueue()) {
|
||||
RCTLogWarn(
|
||||
@"TurboModule \"%@\" requires synchronous dispatch onto the main queue to be initialized. This may lead to deadlock.",
|
||||
moduleClass);
|
||||
|
||||
Reference in New Issue
Block a user