Skip to content

flutter_tool crash handler should not report multiple crashes for a single process #178318

Closed

Description

@bkonyi

While debugging #178317, it became clear that it's possible for multiple crash events to be sent for a single process while the tool's shutdown hooks are executing.

Once the root error handler in the tool encounters an exception, it reports the crash to our crash analytics service before running all registered shutdown hooks. Once these shutdown hooks complete, the tool exits.

However, since the shutdown hooks can be asynchronous, it's possible for additional exceptions to be thrown due to the introduction of asynchronous gaps. In the referenced issue, the original exception was thrown from a file watcher callback that was processing files after a flutter pub get, resulting in exceptions being thrown from the same location repeatedly while the tool was shutting down. This caused the root error handler to be invoked repeatedly, causing multiple crash reports to be sent for a single process and the shutdown hooks to be invoked again. Eventually, the tool is able to exit successfully, but only after reporting multiple crashes.

In order to prevent the root error handler from attempting to report additional crashes while executing the shutdown hooks, we should prevent the error handler from being reentrant and return from the handler immediately if we're already in the process of shutting down the tool due to an exception.

Activity

  1. self-assigned this
    on Nov 11, 2025
  2. added
    P1High-priority issues at the top of the work list
    team-toolOwned by Flutter Tool team
    triaged-toolTriaged by Flutter Tool team
    on Nov 11, 2025
  3. github-actions commented on Nov 26, 2025

    @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 Nov 26, 2025
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-toolOwned by Flutter Tool teamtriaged-toolTriaged by Flutter Tool team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions