Repository navigation
bugfix(android): fatal js errors report twice and hang 5 s - #408
Merged
Merged
Conversation
# Conflicts: # packages/react-native/android/src/main/java/backtrace/library/BacktraceAndroidBackgroundUnhandledExceptionHandler.java
This was referenced Oct 7, 2026
KishanPRao
marked this pull request as ready for review
October 7, 2026 14:05
melekr
approved these changes
Oct 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A fatal JS error on Android now shows up once in Backtrace with its JS stack, and the app exits right after the report is sent instead of 5 s later.
Changes
BacktraceAndroidBackgroundUnhandledExceptionHandler.java: skip React Native's rethrow of a fatal error the JS side already reported when the messages match, let the JS side release the crashing thread without the 5 s wait.BacktraceAndroidBackgroundUnhandledExceptionHandlerFatalErrorTest.java: new, covers a matching rethrow, one with another message, and other Java exceptions.UnhandledExceptionHandler.ts: send the fatal error report before handing the error to the app's handler, cap the wait at 5 s, skip or end the wait in the background and in debug builds.AndroidUnhandledExceptionHandler.ts: pass the reported fatal error's message to the Java handler, release the crashing thread once a rethrown error's report is stored.unhandledExceptionHandlerTests.spec.ts: cover the wait for the report, the 5 s cap, the background and debug build cases.errorHandlerSafetyTests.spec.ts: cover a failing report and a failing app handler.androidUnhandledExceptionHandlerTests.spec.ts: cover the message passed to the Java handler, older native modules, release builds.android-js-fatal.sh: new, fires a fatal JS error on the emulator, expects one stored report and an exit within 2 s of React Native's rethrow.ci-crash-driver.js: add a deep link that throws a fatal JS error, log each stored report.android.yml: run the new check after the native crash checks, keep its logcat on failure.build.gradle(example app): set React Native dev support per build type.MainApplication.java: keep dev support off in the debuggable CI release build.Note
iOS now stays alive up to 5 s after a fatal JS error while the report uploads.
ref: BT-7804