Skip to content

race condition in android external texture register #192776

Closed

Description

@gaaclarke

b/536875915

Summary

When running on Android API level 29+ with Impeller enabled, an application will crash with SIGABRT via FML_CHECK(false) on startup if any bundled plugin
synchronously requests an external texture or surface producer inside its FlutterEngineConnectionRegistry.java:150 callback.
──────

Preconditions

  1. Device / OS: Android API level ≥ 29 (causing flutter_main.cc:268-303 to select android_rendering_selector.h:18).
  2. Renderer: Impeller enabled (default on Android).
  3. Plugin Behavior: A plugin (or application initialization code) eagerly invokes FlutterRenderer.java:225 or FlutterRenderer.java:261 during
    FlutterEngineConnectionRegistry.java:150.
    ──────

Execution Flow & Race Condition

Platform Thread (Android UI Thread)               Raster Thread                     IO Thread
-----------------------------------               -------------                     ---------
1. new FlutterEngine()
   -> flutterJNI.attachToNative()
   -> Shell::CreateWithSnapshot()
      -> Post SetupImpellerContext() ----------> (queued)
      -> Post ShellIOManager setup ---------------------------------------------> Starts ShellIOManager
                                                                                  -> io_manager_promise.set_value()
2. Shell::Setup() unblocks <------------------------------------------------------ (unblocks Platform Thread early!)
   (io_manager_future is ready)
3. attachToNative() returns to Java
4. GeneratedPluginRegister.registerGeneratedPlugins()
5. plugin.onAttachedToEngine(binding)
6. binding.getTextureRegistry()
     .createSurfaceProducer()
7. Native RegisterImageTexture()
   -> queries android_context_->RenderingApi()
   ----------------------------------------> Concurrent with:
                                             vk_context_ = GetActualRenderingAPI...
                                             (Vulkan setup ~50-200ms)

Activity

  1. self-assigned this
    on Sep 14, 2026
  2. added
    P1High-priority issues at the top of the work list
    on Sep 14, 2026
  3. github-actions commented on Oct 5, 2026

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  4. locked as resolved and limited conversation to collaborators on Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work listteam-engineOwned by Engine teamtriaged-engineTriaged by Engine team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions