This repo demonstrates an infinite recursion bug in @sentry/react-native (and likely all Sentry SDKs) when an event processor throws an error.
When an event processor throws an error:
- Sentry's internal error handler catches it
- It calls
captureException()to report the processor error captureException()runs through the same event processors- The processor throws again → goto step 1
- Infinite loop until the app crashes or becomes unresponsive
-
Install dependencies:
npm install
-
Start the app:
npx expo start
-
Press "Trigger captureMessage" button
-
Watch the console - you'll see
EVENT PROCESSOR CALLED: Nincrementing rapidly -
Press "Update count" to see how many times the processor was called (likely thousands before the app becomes unresponsive)
Sentry should detect the recursion and break the loop, e.g., by:
- Tracking if we're already handling a processor error
- Skipping event processors for error events about processor failures
- Limiting the recursion depth
The event processor is called 300+ times in seconds (limited only by memory/stack exhaustion). In our real app testing, we've seen 8700+ calls before force-termination.
- Infinite async loop - consumes resources continuously (doesn't freeze UI since it's async)
- Original event is lost - the initial message/exception is never sent to Sentry
- Thousands of error events queued - floods the event queue
- HMR breaks - in React Native dev mode, this breaks Hot Module Replacement
@sentry/react-native: 7.11.0 (latest)- Expo SDK: 54
- React Native: (via Expo)