Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Work around ancient race condition in ReactInstanceManager
Summary: See T55861104. In rare cases if `removeReactInstanceEventListener` is called right after (like, a small number of CPU instructions later, on a different thread) we allocate the `listeners` array with a certain size, then we could have one or more `null` listeners in the array, which is what we've been seeing in prod, at very low volumes, for several years. Without solving the root of the race condition we can just add a null check here. Maybe it's also possible that if `addReactInstanceEventListener` is called on another thread in a racey way, that the size will be incremented on the array before we can access the additional member. That seems crazy, but maybe. While this has been firing for multiple years it seems like a more recent change caused a regression. This diff doesn't address that and only resolves the crash. Changelog: [Internal] Reviewed By: ejanzer Differential Revision: D18192801 fbshipit-source-id: c1000cfcdf6f251b03061d1386eabb9f0617a7d3
- Loading branch information
0bea6a9
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.
#33210