Android: turbo_module.* crash tags permanently pinned to RNSentry.initNativeReactNavigationNewFrameTracking (promise never settles)
Les mainteneurs répondent en général sous 1 jour
Évaluation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Accessibilité débutants
- 78/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- android, react-native, typescript
- Domaine
- mobile
Piste de recherche
Lisez android/src/main/java/io/sentry/react/RNSentryModuleImpl.java et comparez initNativeReactNavigationNewFrameTracking avec l’implémentation iOS dans ios/RNSentry.mm. Vérifiez comment les méthodes qui renvoient des Promises sont gérées dans src/js/turbomodule/wrapTurboModule.ts ; l’issue suggère également d’auditer les autres méthodes qui prennent des Promises dans RNSentryModuleImpl. C’est terminé lorsque cet appel ne laisse plus un frame du tracker bloqué et que le comportement Android correspond au règlement attendu de la Promise.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Summary
On Android, the crash-time TurboModule attribution added in #6227 is permanently pinned to a single startup call. Every native crash report from an Android app carries:
turbo_module.name: RNSentry
turbo_module.method: initNativeReactNavigationNewFrameTracking
regardless of what was actually executing. The tags are not stale-by-a-moment; they are stuck for the entire process lifetime, so the feature reports a wrong answer rather than no answer. iOS is unaffected.
Cause
Three facts compose:
-
wrapTurboModulepops a tracker frame for a promise-returning method only when that promise settles (src/js/turbomodule/wrapTurboModule.ts— theisThenable(result)branch pops in boththenhandlers). -
The Android implementation never settles the promise:
// android/src/main/java/io/sentry/react/RNSentryModuleImpl.java public void initNativeReactNavigationNewFrameTracking(Promise promise) { this.initFragmentInitialFrameTracking(); }promiseis accepted and dropped — noresolve, noreject, no path that settles it later. iOS does the equivalent work and then callsresolve(nil)(ios/RNSentry.mm). -
RNSENTRY_SKIPinturboModuleContextIntegrationdoes not include this method, so it is wrapped like any other.
The frame pushed at startup therefore never pops. popTurboModuleCall walks the stack and re-syncs the scope onto "the newest remaining frame on the same scope" after every subsequent pop — which, once the app is idle, is always the leaked startup frame. The native scope is left holding it, and sentry-java serialises it into every crash report.
Two smaller consequences of the same leak: the tracker stack never drains to empty (so clearScope's empty-string sentinel path is unreachable on Android), and the aggregate record for that call is never emitted.
Steps to reproduce
- Expo app on Android with
enableTimeToInitialDisplayon (expoRouterIntegrationorreactNavigationIntegration). - Let the app finish starting, navigate anywhere, idle.
- Trigger any native crash — e.g.
Sentry.nativeCrash()— or readgetTurboModuleCallStack(). - The event's tags report
RNSentry.initNativeReactNavigationNewFrameTrackingas the in-flight call; the stack still holds that frame.
Suggested fix
Settle the promise in the Android implementation, mirroring iOS:
public void initNativeReactNavigationNewFrameTracking(Promise promise) {
this.initFragmentInitialFrameTracking();
promise.resolve(null);
}
Adding the method to RNSENTRY_SKIP would hide the symptom but leave the dangling promise, so the native-side fix seems the right one. It may be worth auditing the other Promise-taking methods in RNSentryModuleImpl for the same shape.
Versions
@sentry/react-native: reproduced on 8.27.0; the Android code is unchanged on 8.29.0 (current latest)- Platform: Android only (iOS resolves correctly)
- Langage dominant
- TypeScript
- Étoiles
- 1.8k
- Forks
- 373
- Merge moyen
- 1 j 7 h
- PR mergées (30 j)
- 106
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de getsentry/sentry-react-native
-
React-Native Replays Task
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
getsentry/sentry-react-native#6680 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Improvement React-Native
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
getsentry/sentry-react-native#6143 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
React-Native Task User Feedbacks
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
getsentry/sentry-react-native#5932 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
React-Native Replays Task
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
getsentry/sentry-react-native#5882 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Good First Issue React-Native Task
Difficulté 1/5 Moins d'une heure Accessibilité débutants 65/100
getsentry/sentry-react-native#5771 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de getsentry/sentry-react-native
Issues similaires
-
Navbar avatar and name stay stale after saving profile changesPeut-être pris @alexechoi l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
marmelab/atomic-crm#416 ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
epam/ai-dial-react-file-manager#99 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
canonical/craft-actions#146 ·
Les mainteneurs répondent en général sous 2 jours
-
feature-request
Difficulté 2/5 1-3 heures Accessibilité débutants 66/100
bluesky-social/social-app#12343 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
lucide-icons/lucide#5165 ·
Les mainteneurs répondent en général sous 1 jour