Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flutter pub upgrade randomly results in: Rename failed, path = '~/.pub-cache/_temp/dirBVDEOH' (OS Error: File exists, errno = 17) #148650

Closed
mrcsh opened this issue May 19, 2024 · 5 comments
Labels
r: invalid Issue is closed as not valid team-tool Owned by Flutter Tool team tool Affects the "flutter" command-line tool. See also t: labels.

Comments

@mrcsh
Copy link

mrcsh commented May 19, 2024

Steps to reproduce

The error does not happen frequently maybe once a day. But I have script that goes through all my flutter projects and does a flutter pub upgrade. After installing flutter 3.22 it randomly fails every so often with

Rename failed, path = '/home/csh/.pub-cache/_temp/dirBVDEOH' (OS Error: File exists, errno = 17)

The random filename is different each time of course. It may happen more frequently if there are actually a lot of packages updated. If I can notice any clear patterns I will update.
I have only seen this on Linux, but I do most of my development on Linux.

Expected results

flutter pub upgrade completes without error

Actual results

.
.
.
> flutter_secure_storage 9.2.1 (was 9.1.1)
> flutter_secure_storage_macos 3.1.1 (was 3.1.0)
> image_picker_ios 0.8.11+2 (was 0.8.11+1)
Rename failed, path = '/home/csh/.pub-cache/_temp/dirBVDEOH' (OS Error: File exists, errno = 17)
make[1]: *** [Makefile:44: upgrade] Error 66

Code sample

n/a

Screenshots or Video

n/a

Logs

n/a

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.22.0, on Fedora Linux 39 (Thirty Nine) 6.8.7-200.fc39.x86_64, locale
    en_US.UTF-8)
    • Flutter version 3.22.0 on channel stable at /server/home/csh/lib/flutter3
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 5dcb86f68f (10 days ago), 2024-05-09 07:39:20 -0500
    • Engine revision f6344b75dc
    • Dart version 3.4.0
    • DevTools version 2.34.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /home/csh/Android/Sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /server/home/csh/lib/android-studio/jbr/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 17.0.6 (Fedora 17.0.6-2.fc39)
    • cmake version 3.27.7
    • ninja version 1.11.1
    • pkg-config version 1.9.5

[✓] Android Studio (version 2023.2)
    • Android Studio at /server/home/csh/lib/android-studio
    • Flutter plugin version 78.4.1
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)

[✓] VS Code (version 1.89.1)
    • VS Code at /usr/share/code
    • Flutter extension version 3.88.0

[✓] Connected device (5 available)
    • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64    • Android 14 (API 34) (emulator)
    • sdk gphone x86 64 (mobile)   • emulator-5556 • android-x64    • Android 13 (API 33) (emulator)
    • sdk gphone64 x86 64 (mobile) • emulator-5558 • android-x64    • Android 14 (API 34) (emulator)
    • Linux (desktop)              • linux         • linux-x64      • Fedora Linux 39 (Thirty Nine)
      6.8.7-200.fc39.x86_64
    • Chrome (web)                 • chrome        • web-javascript • Google Chrome 125.0.6422.60

[✓] Network resources
    • All expected network resources are available.

• No issues found!
@darshankawar darshankawar added the in triage Presently being triaged by the triage team label May 20, 2024
@darshankawar
Copy link
Member

Thanks for the report @mrcsh

I have script that goes through all my flutter projects and does a flutter pub upgrade. After installing flutter 3.22 it randomly fails every so often with

Does it occur without using the script or occurs only while using the script ?

If I can notice any clear patterns I will update.

This will be helpful to address it further.

@darshankawar darshankawar added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label May 20, 2024
@mrcsh
Copy link
Author

mrcsh commented May 20, 2024

I don't often update an individual project out side of the script, but I may have seen it on an individual update, but I cannot say for sure. It doesn't happen super often maybe on the order of one in 30-50 updates. And may only happen if packages are actually updated so reproducibility is problematic at best.

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label May 20, 2024
@darshankawar
Copy link
Member

Keeping the issue open and labeling for team's attention.

@darshankawar darshankawar added tool Affects the "flutter" command-line tool. See also t: labels. team-tool Owned by Flutter Tool team and removed in triage Presently being triaged by the triage team labels May 21, 2024
@andrewkolos
Copy link
Contributor

Howdy. Thanks for contributing this issue!

This one is certainly interesting. flutter pub is, for the most part, a lightweight wrapper around the pub CLI tool1. From the error message, I'm guessing pub is trying to create a new temp directory2, but one with the chosen name already exists. Still, this would be surprising for me because the Linux implementation for choosing a temp directory name includes logic to avoid this3.

Footnotes

  1. Source: https://github.com/flutter/flutter/blob/66367dd888458d94a3bd1ffd712c4cb473dc5f69/packages/flutter_tools/lib/src/dart/pub.dart#L307

  2. Source: https://github.com/dart-lang/pub/blob/e1fbda73d1ac597474b82882ee0bf6ecea5df108/lib/src/system_cache.dart#L121-L130

  3. Source: https://github.com/dart-lang/sdk/blob/14f7622ef4404eb22b7396458b6382b96f8af128/runtime/bin/directory_linux.cc#L451

@andrewkolos
Copy link
Contributor

Since this is most likely an issue in pub, I'll be closing this issue. Feel free to re-file this issue on the pub repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
r: invalid Issue is closed as not valid team-tool Owned by Flutter Tool team tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

No branches or pull requests

3 participants