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] Fixes race condition of Network module #25156

Closed
wants to merge 3 commits into from

Conversation

zhongwuzw
Copy link
Contributor

@zhongwuzw zhongwuzw commented Jun 5, 2019

Summary

There exists race condition in sendRequest:withDelegate: method, it can do the session creation multiple times, because we don't lock that, which would leads EXC_BAD_ACCESS because use and deallocated session concurrently, we can refer to how to create a singleton safely.

Related #25152.

Changelog

[iOS] [Fixed] - Fixes race condition of Network module

Test Plan

Race condition, reproduce not easy.

@zhongwuzw zhongwuzw requested a review from cpojer June 5, 2019 14:34
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 5, 2019
@react-native-bot react-native-bot added Platform: iOS iOS applications. Bug labels Jun 5, 2019
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@sammy-SC has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@sammy-SC has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @zhongwuzw in 831f5fe.

When will my fix make it into a release? | Upcoming Releases

@sammy-SC
Copy link
Contributor

sammy-SC commented Jun 6, 2019

@zhongwuzw thanks you!

M-i-k-e-l pushed a commit to M-i-k-e-l/react-native that referenced this pull request Mar 10, 2020
Summary:
There exists race condition in `sendRequest:withDelegate:` method, it can do the session creation multiple times, because we don't lock that, which would leads `EXC_BAD_ACCESS` because use and deallocated session concurrently, we can refer to how to create a singleton safely.

Related facebook#25152.

## Changelog

[iOS] [Fixed] - Fixes race condition of Network module
Pull Request resolved: facebook#25156

Differential Revision: D15671734

Pulled By: sammy-SC

fbshipit-source-id: 5021e6cf33c2b55e3f7adf573ab5c8e6a8d82e23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Platform: iOS iOS applications.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants