Files
react-native/ReactAndroid
Joshua Gross 0bea6a9b19 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
2019-10-28 19:28:01 -07:00
..
2019-10-16 10:06:33 -07:00
2018-05-27 15:17:55 -07:00
2019-10-16 10:06:33 -07:00

Building React Native for Android

See the docs on the website.

Running tests

When you submit a pull request CircleCI will automatically run all tests. To run tests locally, see Testing.