Skip to content

_DefaultPub.get tries to read version file but does not hold the lock long enough to do so #109205

Description

@Hixie

_DefaultPub.get has this code:

    final File currentVersion = _fileSystem.file(
      _fileSystem.path.join(Cache.flutterRoot!, 'version'));
    // ...
    if (/*...*?
        lastVersion.readAsStringSync() == currentVersion.readAsStringSync()) {
      // ...

That code has a race condition. If that command runs in parallel with another flutter command, there's no guarantee that the currentVersion file will still be around.

We should not release the lockfile until after this test is done.

cc @christopherfujino @jmagman

Activity

  1. added
    c: crashStack traces logged to the console
    toolAffects the "flutter" command-line tool. See also t: labels.
    P2Important issues not at the top of the work list
    on Aug 9, 2022
  2. christopherfujino commented on Aug 9, 2022

    @christopherfujino
    Contributor

    @Hixie thanks for root causing this one!

  3. added
    tool-still-validIssues that have been deemed still valid as part of the Flutter Tools issue cleanup initiative.
    on Jul 11, 2025
  4. added 2 commits that reference this issue on Mar 28, 2026
    ac564a2
    6d42e9d
  5. added a commit that references this issue on Apr 14, 2026
    dd2d719
  6. added a commit that references this issue on Apr 15, 2026
    f16deab
  7. github-actions commented on Apr 28, 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.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: crashStack traces logged to the consoleteam-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.tool-still-validIssues that have been deemed still valid as part of the Flutter Tools issue cleanup initiative.triaged-toolTriaged by Flutter Tool team

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions