-
Notifications
You must be signed in to change notification settings - Fork 24.6k
Take 2: Mitigate deadlock hazard in RCTUtils.m #50807
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
Conversation
This pull request was exported from Phabricator. Differential Revision: D73265906 |
Summary: This structure is unsafe: ``` // In each native module: +load dispatch_once NSBundle mainBundle ``` NSBundle mainBundle itself uses dispatch_once during initialization. If that initialization triggers a native module class load, we could end up with a circular dependency chain. This could deadlock the application. ## Changes Just remove the dispatch_once. Getting the NSBundle mainBundle is very efficient after the first access. And NSBundle objectForInfoDictionaryKey is also very efficient. Created from CodeHub with https://fburl.com/edit-in-codehub Changelog: [Internal] Reviewed By: NickGerleman Differential Revision: D73265906
05c90f9
to
0a0ae77
Compare
This pull request was exported from Phabricator. Differential Revision: D73265906 |
0a0ae77
to
73cd828
Compare
Summary: Pull Request resolved: facebook#50807 This structure is unsafe: ``` // In each native module: +load dispatch_once NSBundle mainBundle ``` NSBundle mainBundle itself uses dispatch_once during initialization. If that initialization triggers a native module class load, we could end up with a circular dependency chain. This could deadlock the application. ## Changes Just remove the dispatch_once. Getting the NSBundle mainBundle is very efficient after the first access. And NSBundle objectForInfoDictionaryKey is also very efficient. Created from CodeHub with https://fburl.com/edit-in-codehub Changelog: [Internal] Reviewed By: NickGerleman Differential Revision: D73265906
73cd828
to
245e3fa
Compare
Summary: This structure is unsafe: ``` // In each native module: +load dispatch_once NSBundle mainBundle ``` NSBundle mainBundle itself uses dispatch_once during initialization. If that initialization triggers a native module class load, we could end up with a circular dependency chain. This could deadlock the application. ## Changes Just remove the dispatch_once. Getting the NSBundle mainBundle is very efficient after the first access. And NSBundle objectForInfoDictionaryKey is also very efficient. Created from CodeHub with https://fburl.com/edit-in-codehub Changelog: [Internal] Reviewed By: NickGerleman Differential Revision: D73265906
Summary: Pull Request resolved: facebook#50807 This structure is unsafe: ``` // In each native module: +load dispatch_once NSBundle mainBundle ``` NSBundle mainBundle itself uses dispatch_once during initialization. If that initialization triggers a native module class load, we could end up with a circular dependency chain. This could deadlock the application. ## Changes Just remove the dispatch_once. Getting the NSBundle mainBundle is very efficient after the first access. And NSBundle objectForInfoDictionaryKey is also very efficient. Created from CodeHub with https://fburl.com/edit-in-codehub Changelog: [Internal] Reviewed By: NickGerleman Differential Revision: D73265906
This pull request was exported from Phabricator. Differential Revision: D73265906 |
245e3fa
to
1298375
Compare
This pull request was successfully merged by @RSNara in aa41184 When will my fix make it into a release? | How to file a pick request? |
This pull request has been merged in aa41184. |
Summary:
This structure is unsafe:
NSBundle mainBundle itself uses dispatch_once during initialization. If that initialization triggers a native module class load, we could end up with a circular dependency chain. This could deadlock the application.
Changes
Just remove the dispatch_once. Getting the NSBundle mainBundle is very efficient after the first access. And NSBundle objectForInfoDictionaryKey is also very efficient.
Created from CodeHub with https://fburl.com/edit-in-codehub
Changelog: [Internal]
Reviewed By: NickGerleman
Differential Revision: D73265906