leoafarias / fvm

Flutter Version Management: A simple CLI to manage Flutter SDK versions.
https://fvm.app
MIT License
4.67k stars 229 forks source link

[BUG]Extremely Slow and Failing fvm install Command #586

Open numa08 opened 10 months ago

numa08 commented 10 months ago

Before creating a bug report please make check the following

fvm doctor


FVM Version: 2.4.1
___________________________________________________

FVM config found:
___________________________________________________

Project: radio_qth_map
Directory: /home/numa08/src/github.com/covelline/radio_qth_map/app/radio_qth_map
Version: 3.16.4
Project Flavor: None selected
___________________________________________________

Version is currently cached locally.

Cache Path: /home/numa08/fvm/versions/3.16.4
Channel: false
SDK Version: 3.16.4

IDE Links
VSCode: .fvm/flutter_sdk
Android Studio: /home/numa08/src/github.com/covelline/radio_qth_map/app/radio_qth_map/.fvm/flutter_sdk

Configured env paths:
___________________________________________________

Flutter:

Dart:
/home/linuxbrew/.linuxbrew/bin/dart

FVM_HOME:
not set

Describe the bug

When using the fvm install command to clone Flutter, I am experiencing significantly slow download speeds for the source code. Here is a copy from the terminal, indicating speeds around 80 ~ 200 KiB/s.

image

To troubleshoot the issue, I attempted the following:

  1. Manual Git Clone: I executed git clone git@github.com:flutter/flutter.git -b 3.16.4. This process worked fine with speeds around 10 MiB/s, indicating no issues with cloning speed.
image
  1. Using Process.start: Realizing that the git execution is ultimately handled by Dart's Process.start, I wrote and executed the following code to measure the speed .
import 'dart:io';

void main() async {
    final p = await Process.start(
        'git',
        ['clone',
        'git@github.com:flutter/flutter.git',
        '-b',
        '3.16.4',
        ],
        runInShell: true,
        mode: ProcessStartMode.inheritStdio
        );
}

The result was similar to the first test, with cloning speeds of about 10 MiB/s.

  1. Testing with git.dart Used Internally by FVM: To see if the issue lies within git.dart, which is used internally by FVM, I wrote and executed the following code to measure the speed .
import 'package:test_app/test_app.dart' as test_app;
import 'package:git/git.dart';

void main(List<String> arguments) async {
  await runGit(
    [
      'clone',
      '--progress',
      '-c',
      'advice.detachedHead=false',
      '-b',
      '3.16.4',
      'git@github.com:flutter/flutter.git',
    ],
    echoOutput: true,
  );
}

Like the second test, it confirmed sufficient speeds.


It seems the issue might be within FVM's internal implementation or the command-line options being executed. I am unsure of how to resolve this but would appreciate guidance on further steps for a detailed investigation.

To Reproduce Steps to reproduce the behavior:

  1. Go to terminal..
  2. Run fvm use stable...
  3. Check...
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

I expect the cloning process to complete at speeds comparable to the standard git command, typically in the range of several tens of MiB/s.

Logs Please provide the verbose logs by running --verbose after the command.

fvm install --verbose

Flutter "3.16.4" is not installed.

Installing version: 3.16.4...
Cloning into '/home/numa08/fvm/versions/3.16.4'...
remote: Enumerating objects: 485131, done.        
remote: Counting objects: 100% (41909/41909), done.        
remote: Compressing objects: 100% (1593/1593), done.        
error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: CANCEL (err 8)
error: 4595 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output
[ 2m 41.448s] Cloning into '/home/numa08/fvm/versions/3.16.4'...
remote: Enumerating objects: 485131, done.        
remote: Counting objects: 100% (41909/41909), done.        
remote: Compressing objects: 100% (1593/1593), done.        
error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: CANCEL (err 8)
error: 4595 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output

[ 2m 41.449s] Internal Error: Could not git clone 3.16.4

Could not install 3.16.4

Please run command with  --verbose if you want more information

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

I considered the possibility of using the --filter=tree:0 option in the clone command to only clone necessary information.

DavidOrakpo commented 10 months ago

I'm facing this issue as well! How do we solve it? I'd try the manual method you said and report back

numa08 commented 10 months ago

Thank you for your comment.

I also tried cloning manually. The command I used is as follows.

cd $HOME/fvm/versions
git clone git@github.com:flutter/flutter.git -b 3.16.4 --filter=tree:0 ./3.16.4
# and go your project directory that is managed by fvm
fvm use
AliYar-Khan commented 10 months ago

facing same issue

AliYar-Khan commented 10 months ago

I am facing same issue with -filter=tree command as well

leoafarias commented 10 months ago

Maybe this was a hick up on git? if not can you do the same command on version 3.0 beta 5?

AliYar-Khan commented 10 months ago

github is also slow ... can be an issue. !!!

AliYar-Khan commented 10 months ago

but i am trying to clone using

git clone git@github.com:flutter/flutter.git -b 3.16.5 --filter=tree:0 ./3.16.5

but it doesn't consider it as a clean setup and delete the folder and its content @leoafarias

AliYar-Khan commented 10 months ago

I got it working with this --filter=tree command

leoafarias commented 10 months ago

Be aware of any command that does partial clones, as flutter tooling is tightly dependent on the clone itself and can cause weird issue due to release channel detection and feature flags

yaotutu commented 10 months ago

I had same problem.

[64] % fvm doctor

No FVM config found:
/Users/yao
Fvm will run the version in your PATH env: /Users/yao/fvm/versions/stable/bin/flutter

Configured env paths:
___________________________________________________

Flutter:
/Users/yao/fvm/versions/stable/bin/flutter

Dart:
/opt/homebrew/bin/dart

FVM_HOME:
not set
image
ForFlutter400 commented 9 months ago

i'm facing the same issue, my internet connection is good everything is downloading with the speed of 5mb/s on browser but when i run 'fvm install' then speed is 50, 100, 200, 400 kb/s and then it suddenly stops, please solve this issue.

prob1

image

leoafarias commented 9 months ago

When you have an issue like this, can you run the clone command through git? This seems to be a git issue, as fvm is running the clone command behind the scenes. Also, I suggest using version 3.0.0 beta, as it does some optimizations behind the scenes.

ikoamu commented 9 months ago

I was able to install it by changing my git settings.

$ git config --global http.postBuffer 52428800
$ git config --global core.compression 0
AliYar-Khan commented 8 months ago

@leoafarias I am facing issue on latest fvm version as well. How to utilize the Git mirroring for faster cloning?

leoafarias commented 8 months ago

It should already be enabled. Can you try to clone outside of fvm to see if it's an issue with fvm itself?

BrianRigii commented 8 months ago

Anyone with a working solution for this problem ?

leoafarias commented 8 months ago

@BrianRigii can you run outside of FVM to see if there is a difference in speed?

ViktorKirjanov commented 2 months ago

still the same issue

leoafarias commented 2 months ago

Sorry, guys. I'm not sure what to do here. The information is not clear on whether it was a Git hiccup or if it's happening internally...