[Android][Impeller][OpenGLES] EGL_BAD_ACCESS after recreating an Activity with a retained engine and hybrid-composed WebView
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 12/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- Active
- Domaine
- mobile-dev
Piste de recherche
The suspected path is Rasterizer::Teardown() in engine/src/flutter/shell/common/rasterizer.cc, where the render context is made current and surface_ is reset before the raster and platform threads are unmerged. Read the merge/unmerge callback that calls ClearRenderContext(), then try to reproduce with a retained FlutterEngine and hybrid-composed WebView on an Android device. Done would be a fix validated across repeated activity recreations, with a regression test.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
What happens
With Impeller/OpenGLES, reopening an Android activity on the same FlutterEngine can leave the Flutter part of the screen black while an embedded WebView remains visible and scrollable. Dart still handles the back action, but the Flutter confirmation dialog never appears. I would expect the new FlutterView to render the existing route and respond visibly to input.
Steps that reproduce this in our app
- Use a process-owned FlutterEngine. The activity returns it from
provideFlutterEngineand returns false fromshouldDestroyEngineWithHost. An Android foreground service keeps the process alive. - Open a route containing a WebView using hybrid composition, with a Flutter toolbar above it.
- Swipe the app away from Recents while that route is visible. Relaunch it from the launcher. The PID stays the same and a new activity attaches to the retained engine.
This was reported on a Pixel 10 Pro XL running Android 16 (2/2 from the WebView route, 0/3 from the home route). I also reproduced it on a Samsung SM-S936U running Android 17 with Flutter 3.41.9 (revision 00b0c91f062, arm64 debug build, Impeller/OpenGLES explicitly selected). Skia recovered on the same Samsung device. Reproduction so far is in the app; I have not yet tested current Flutter stable or main.
What the EGL trace shows
An Android GLES debug layer recorded these calls in one failing run. C identifies the same EGL context throughout; S1 and S2 are different draw surfaces.
11:53:52.887 old activity starts destruction
11:53:52.898 platform thread 17600 eglMakeCurrent(C, old draw surface) -> success
11:53:53.920 new activity created in the same process
11:53:53.976 raster thread 17672 eglMakeCurrent(C, S1) -> EGL_BAD_ACCESS
11:53:53.977 raster thread 17672 eglMakeCurrent(C, S2) -> EGL_BAD_ACCESS
The engine repeatedly logs Could not make the context current to acquire the frame. The new Android surface reports valid. In a control run, releasing the identified context once on its owning platform thread during teardown allowed the raster thread to bind it successfully after relaunch. With an app-side workaround that releases the matching context after native surface teardown, three consecutive activity recreations succeeded in the same process, including navigating back from the WebView.
Suspected engine path and follow-up
In 3.41.9, Rasterizer::Teardown() makes the render context current and resets surface_ before unmerging the raster and platform threads. The merge/unmerge callback checks surface_ before calling ClearRenderContext(). This ordering appears consistent with the binding left on the platform thread. Rasterizer source at the tested revision.
I plan to reduce this to a standalone reproduction, check current stable and main, and work on an engine fix if it still reproduces. I’ll validate the fix on physical Android devices with a retained engine and hybrid composition, add regression coverage, and follow up here with the results and a PR.
- Langage dominant
- Dart
- Étoiles
- 182k
- Forks
- 32k
- Merge moyen
- 1 j 23 h
- PR mergées (30 j)
- 352
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 flutter/flutter
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
-
RenderListWheelViewport creates a new OpacityLayer on every paint and keeps it after it stops using itPeut-être pris @leoafarias l’a pris il y a 2 jours. Ouvertea: tests f: scrolling found in release: 3.50 framework has reproducible steps team-framework
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Les mainteneurs répondent en général sous 1 jour
-
a: text input engine found in release: 3.50 fyi-text-input platform-ios team-ios workaround available
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
flutter/flutter#197531 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
in triage
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
flutter/flutter#197514 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de flutter/flutter
Issues similaires
-
Study Button croppedOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
lichess-org/mobile#4119 ·
Les mainteneurs répondent en général sous 1 jour
-
夜間レビュー: 観点 tests の指摘 (PR #443)Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 1/5 1-3 heures Accessibilité débutants 76/100
Nicolas11Leon/Tunner#278 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
ImranR98/apps.obtainium.imranr.dev#2058 · 1 commentaire ·
Les mainteneurs répondent en général sous 6 jours