-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Conversation
There was a problem hiding this 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.
There was a problem hiding this 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.
This pull request was successfully merged by @zhongwuzw in 831f5fe. When will my fix make it into a release? | Upcoming Releases |
@zhongwuzw thanks you! |
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
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 leadsEXC_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.