Skip to content

[Impeller][Vulkan] CommandPoolVK can free command buffers on a destroyed VkDevice, crashing in vkFreeCommandBuffers on the resource manager thread #186458

@ZhongNing1

Description

@ZhongNing1

Steps to reproduce

1.Run a Flutter app on a Vulkan-enabled Android / Linux device with Impeller (e.g. --enable-impeller).
2.Repeatedly start and kill the app (or rapidly tear down the FlutterEngine / ContextVK).
3.Observe occasional native crashes during shutdown.
This is a teardown-time race; reproduction is timing-dependent but is reliably hit on lower-end devices under memory pressure or fast app-restart loops.

This is the same class of lifetime bug as #166725 ("[Impeller] keep device
holder and allocator alive until last vk image is destroyed"), but on the
command pool teardown path which was not touched in that PR.

Expected results

The application shuts down cleanly. vkDestroyCommandPool / vkFreeCommandBuffers should never be issued through a VkDevice that has already been destroyed.

Actual results

#00 vkFreeCommandBuffers+28 /system/lib64/libvulkan.so
#1 impeller::BackgroundCommandPoolVK::~BackgroundCommandPoolVK()
[inlined: impeller::CommandPoolRecyclerVK::Reclaim(
vk::UniqueHandle<vk::CommandPool, ...>&&,
std::vector<vk::UniqueHandle<vk::CommandBuffer, ...>>&&, bool)]
impeller/renderer/backend/vulkan/command_pool_vk.cc

Code sample

Code sample
[Paste your code here]

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[Paste your output here]

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: crashStack traces logged to the consolee: impellerImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.platform-androidAndroid applications specificallyplatform-linuxBuilding on or for Linux specificallyteam-engineOwned by Engine teamtriaged-engineTriaged by Engine team

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions