Android: turbo_module.* crash tags permanently pinned to RNSentry.initNativeReactNavigationNewFrameTracking (promise never settles)
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 78/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- android, react-native, typescript
- Ambito
- mobile
Direzione di ricerca
Leggi android/src/main/java/io/sentry/react/RNSentryModuleImpl.java e confronta initNativeReactNavigationNewFrameTracking con l’implementazione iOS in ios/RNSentry.mm. Verifica come vengono gestiti i metodi che restituiscono Promises in src/js/turbomodule/wrapTurboModule.ts; l’issue suggerisce inoltre di verificare anche gli altri metodi che ricevono Promises in RNSentryModuleImpl. Il lavoro è completo quando questa chiamata non lascia più bloccato un frame del tracker e il comportamento Android corrisponde alla risoluzione prevista della Promise.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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)
- Lingua principale
- TypeScript
- Stelle
- 1.8k
- Fork
- 369
- Merge medio
- 20h 46m
- PR unite (30g)
- 106
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di getsentry/sentry-react-native
-
sendDefaultPii is reported as deprecated on ReactNativeOptions although dataCollection is hiddenForse già presa @alwx l’ha presa 3 giorni fa. ApertaBug React-Native
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
getsentry/sentry-react-native#6830 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
React-Native Replays Task
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
getsentry/sentry-react-native#6680 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Improvement React-Native
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
getsentry/sentry-react-native#6143 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
React-Native Task User Feedbacks
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
getsentry/sentry-react-native#5932 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
React-Native Replays Task
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
getsentry/sentry-react-native#5882 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di getsentry/sentry-react-native
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
siyuan-note/siyuan#20313 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 92/100
alunduil/projects-v2-sync#14 ·
-
Service process inherits the caller's cwd at first use, holding that folder open on Windows (EBUSY)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
DevTools page styles leak into the host app in developmentForse già presa @onmax l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
nuxt-modules/better-auth#567 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno