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

Fixing Race condition that happens with _wasBatchActive #13505

Closed
wants to merge 3 commits into from
Closed

Fixing Race condition that happens with _wasBatchActive #13505

wants to merge 3 commits into from

Conversation

atkit
Copy link

@atkit atkit commented Apr 14, 2017

Issue Fix: #13485

Motivation (required)

Yet another race condition that was found by XCode's Thread Sanitizer.
Happens because wasBatchActive is read/write from multiple threads at the same time

Test Plan (required)

  • opened UIExplorer and see it works
  • npm run test pass
  • tested on own project as well

Next Steps

Signed CLA

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. GH Review: review-needed labels Apr 14, 2017
@javache
Copy link
Member

javache commented Apr 15, 2017

Instead of making this a property (with all its other overhead, can you make that bool a C++ atomic_bool?

@atkit
Copy link
Author

atkit commented Apr 15, 2017

I think that could work better, I can use that.
But to use that I will have to rename to .mm to use std::atomic_bool and Objective C++.

Is it fine for overall plan about Batched Bridge?

@javache
Copy link
Member

javache commented Apr 18, 2017

Yeah, that's fine. We use Objective-C++ in quite a few places. You'll just need to make sure to update all the targets in React.xcodeproj (and maybe make the same change for RCTCxxBridge and ReactCxx.xcodeproj)?

@atkit
Copy link
Author

atkit commented Apr 18, 2017

ok

@javache
Copy link
Member

javache commented Apr 18, 2017

@atkit
Copy link
Author

atkit commented Apr 18, 2017

It can be done as well, but I it seems _wasBatchActive is never set.

@javache
Copy link
Member

javache commented Apr 18, 2017

Huh, that's a separate bug then. I'll follow up. Thanks again for fixing this!

@facebook-github-bot facebook-github-bot added GH Review: accepted Import Started This pull request has been imported. This does not imply the PR has been approved. and removed GH Review: review-needed labels Apr 18, 2017
@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot facebook-github-bot added Import Failed and removed Import Started This pull request has been imported. This does not imply the PR has been approved. labels Apr 19, 2017
@facebook-github-bot
Copy link
Contributor

I tried to merge this pull request into the Facebook internal repo but some checks failed. To unblock yourself please check the following: Does this pull request pass all open source tests on GitHub? If not please fix those. Does the code still apply cleanly on top of GitHub master? If not can please rebase. In all other cases this means some internal test failed, for example a part of a fb app won't work with this pull request. I've added the Import Failed label to this pull request so it is easy for someone at fb to find the pull request and check what failed. If you don't see anyone comment in a few days feel free to comment mentioning one of the core contributors to the project so they get a notification.

@atkit
Copy link
Author

atkit commented Apr 19, 2017

done rebase with master

@atkit
Copy link
Author

atkit commented Apr 19, 2017

@javache did I do something wrong that caused bot to close review?

@atkit
Copy link
Author

atkit commented Apr 19, 2017

I see now, just different workflow that done by bot

@atkit atkit deleted the fix-race-condition-was-batch-active branch April 19, 2017 16:02
Maxwell2022 pushed a commit to Maxwell2022/react-native that referenced this pull request Apr 19, 2017
Summary:
Issue Fix: facebook#13485

Yet another race condition that was found by XCode's Thread Sanitizer.
Happens because wasBatchActive is read/write from multiple threads at the same time

- opened UIExplorer and see it works
- npm run test pass
- tested on own project as well

Signed CLA
Closes facebook#13505

Differential Revision: D4906096

Pulled By: javache

fbshipit-source-id: 5d4329aafcfe9491ce0188fa1e2dd71e09b31031
@atkit atkit restored the fix-race-condition-was-batch-active branch May 5, 2017 09:30
thotegowda pushed a commit to thotegowda/react-native that referenced this pull request May 7, 2017
Summary:
Issue Fix: facebook#13485

Yet another race condition that was found by XCode's Thread Sanitizer.
Happens because wasBatchActive is read/write from multiple threads at the same time

- opened UIExplorer and see it works
- npm run test pass
- tested on own project as well

Signed CLA
Closes facebook#13505

Differential Revision: D4906096

Pulled By: javache

fbshipit-source-id: 5d4329aafcfe9491ce0188fa1e2dd71e09b31031
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants