[iOS][Fixed] Data race related to reading/writing to AllocationTestModule.valid#45191
[iOS][Fixed] Data race related to reading/writing to AllocationTestModule.valid#45191hakonk wants to merge 4 commits into
AllocationTestModule.valid#45191Conversation
…d(). This entails making AllocationTestModule and Objective-C++ file in order to make use of std::atomic<BOOL>. Getters and setters are then implemented to make sure and underlying atomic bool is accessed instead of a synthesized property.
Base commit: e320ab4 |
|
It's unclear what problem this PR is solving,. If access to this property needs to be atomic (but it's unclear why), consider using |
|
Running this test with TSan enabled and runtime issues breakpoint in Xcode will reveal concurrent read/write to the mentioned property, which is in this case classified as a data race by TSan. I haven't studied the reasons for concurrent access, but it seems to be related to code fundamental to how RCTBridge works. That said, I can certainly alter the proposed changes to make use of the |
|
Here is the TSan output when Seems like it is related to invalidating the bridge. I have now resorted to making use of an atomic Objective-C property. Please see the changes @javache |
|
Thanks! Please update the PR description to make it reflect the changes you've made. |
|
@javache has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
This pull request was successfully merged by @hakonk in dba25fa. When will my fix make it into a release? | How to file a pick request? |
The fix entails making
AllocationTestModule.validan Objective-C atomic property and funneling access to the ivar via the synthesized property getter and setter.Summary:
While the data race was present in test code, it would make it more difficult to spot more severe data races with the TSan. Also, getting rid of a data race is always good.
Changelog:
[iOS][Fixed] - Data race related to access of
AllocationTestModule.validTest Plan:
RCTAllocationTestswill test the implementation ofAllocationTestModule.