fvm icon indicating copy to clipboard operation
fvm copied to clipboard

[BUG]Extremely Slow and Failing fvm install Command

Open numa08 opened this issue 1 year ago • 19 comments

Before creating a bug report please make check the following

  • [x] You have read our FAQ
  • [x] If you have used flutter. Please install correctly, run pub cache repair. Close the terminal and try again.
  • [x] If you are on Windows. Make sure you are running the terminal as administrator or with developer permissions.
  • [x] Run fvm doctor if possible and add the output to the issue.

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 [email protected]: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',
        '[email protected]: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',
      '[email protected]: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):

  • OS: Ubuntu (WSL2)
  • FVM Version 2.4.1
  • If Windows: Which Powershell are you using?

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.

numa08 avatar Dec 18 '23 06:12 numa08

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

DavidOrakpo avatar Dec 18 '23 18:12 DavidOrakpo

Thank you for your comment.

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

cd $HOME/fvm/versions
git clone [email protected]: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

numa08 avatar Dec 19 '23 01:12 numa08

facing same issue

AliYar-Khan avatar Dec 22 '23 12:12 AliYar-Khan

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

AliYar-Khan avatar Dec 22 '23 13:12 AliYar-Khan

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

leoafarias avatar Dec 23 '23 15:12 leoafarias

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

AliYar-Khan avatar Dec 23 '23 17:12 AliYar-Khan

but i am trying to clone using

git clone [email protected]: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 avatar Dec 23 '23 17:12 AliYar-Khan

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

AliYar-Khan avatar Dec 23 '23 18:12 AliYar-Khan

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

leoafarias avatar Dec 23 '23 18:12 leoafarias

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

yaotutu avatar Dec 25 '23 07:12 yaotutu

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

ForFlutter400 avatar Jan 17 '24 12:01 ForFlutter400

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.

leoafarias avatar Jan 17 '24 14:01 leoafarias

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

$ git config --global http.postBuffer 52428800
$ git config --global core.compression 0

ikoamu avatar Jan 24 '24 09:01 ikoamu

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

AliYar-Khan avatar Feb 11 '24 17:02 AliYar-Khan

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

leoafarias avatar Feb 11 '24 17:02 leoafarias

Anyone with a working solution for this problem ?

BrianRigii avatar Feb 29 '24 17:02 BrianRigii

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

leoafarias avatar Feb 29 '24 18:02 leoafarias

still the same issue

ViktorKirjanov avatar Aug 10 '24 14:08 ViktorKirjanov

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...

leoafarias avatar Aug 13 '24 16:08 leoafarias