Files
react-native/packages
Nick Gerleman dfd445cbc6 Terminate instead of throwing if TurboModule callback double-called (#37570)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37570

If a TM calls a completion callback, or resolves or rejects a promise multiple times, a C++ exception is thrown.

For an in the wild crash, we are getting this signal as:
1. `libdispatch` calls std::terminate while pumping a thread's message queue
2. The hooked FB app termination handler is called, which introspects for the currently handled exception
4. We are handling this TurboModule C++ exception being thrown, suggesting `libdispatch` termination may be due to catching this C++ exception which was not otherwise handled
4. We have by this point lost the stack trace of the code invoking the callback

I think if we change the timing of `abort()` to when the callback is called, we might be able to preserve the stack trace of module code calling the callback.

Reviewed By: javache

Differential Revision: D46175685

fbshipit-source-id: 680aa9aa5e4ca6d8dd04dfe34ec870b86c7640ef
2023-05-25 15:26:12 -07:00
..