jdx / mise

dev tools, env vars, task runner
https://mise.jdx.dev
MIT License
9.38k stars 262 forks source link

Download keep failing if it takes more than 30s. #2214

Closed mkblast closed 4 months ago

mkblast commented 4 months ago

Describe the bug When i download something using mise. Like mise i node@lts due of my slow internet atm, if the download takes longer than 30s it will fail with this output

mise error decoding response body
mise request or response body error
mise operation timed out
mise Run with --verbose or MISE_VERBOSE=1 for more information

To Reproduce

  1. Download anything and make sure it will take longer than 30s.

Expected behavior

  1. Just continue do download until it finishes or i cancel it

mise doctor output

version: 2024.5.24 linux-x64 (cf1a690 2024-05-28)
activated: yes
shims_on_path: no

build_info: 
  Target: x86_64-unknown-linux-gnu
  Features: DEFAULT, NATIVE_TLS, OPENSSL
  Built: Tue, 28 May 2024 17:21:46 +0000
  Rust Version: rustc 1.78.0 (9b00956e5 2024-04-29)
  Profile: release

shell: 
  /usr/bin/zsh
  zsh 5.9 (x86_64-pc-linux-gnu)

dirs: 
  data: ~/.local/share/mise
  config: ~/.config/mise
  cache: ~/.cache/mise
  state: ~/.local/state/mise
  shims: ~/.local/share/mise/shims

config_files: 
  ~/.config/mise/config.toml

backends: 
  cargo
  core
  go
  npm
  pipx
  ubi

plugins: 
  bun     (core)
  deno    (core)
  erlang  (core)
  go      (core)
  java    (core)
  node    (core)
  python  (core)
  ruby    (core)
  usage   https://github.com/jdx/mise-usage.git#fe3888a
  zig     https://github.com/cheetah/asdf-zig.git#4c6cb6f

toolset: 
  node@20.14.0  (missing)
  go@1.22.3     
  zig@0.12.0    
  usage@0.3.0   

env_vars: 
  MISE_SHELL=zsh

settings: 
  activate_aggressive = false
  all_compile = false
  always_keep_download = false
  always_keep_install = false
  asdf_compat = false
  cargo_binstall = true
  color = true
  disable_default_shorthands = false
  disable_tools = []
  experimental = false
  go_default_packages_file = "~/.default-go-packages"
  go_download_mirror = "https://dl.google.com/go"
  go_repo = "https://github.com/golang/go"
  go_set_gopath = false
  go_set_goroot = true
  go_skip_checksum = false
  jobs = 4
  legacy_version_file = true
  legacy_version_file_disable_tools = []
  node_compile = false
  not_found_auto_install = true
  paranoid = false
  plugin_autoupdate_last_check_duration = "7d"
  python_default_packages_file = "/home/karim/.default-python-packages"
  python_pyenv_repo = "https://github.com/pyenv/pyenv.git"
  raw = false
  trusted_config_paths = []
  quiet = false
  verbose = false
  yes = false
  ci = false
  debug = false
  trace = false
  log_level = "info"
  python_venv_auto_create = false

  [status]
  missing_tools = "if_other_versions_installed"
  show_env = false
  show_tools = false

No warnings found
No problems found

Additional context mise --trace

[DEBUG] (1) mise::cli: [src/cli/mod.rs:217] ARGS: mise up --trace
[TRACE] (1) mise::config: [src/config/mod.rs:69] Settings: Settings {
    activate_aggressive: false,
    all_compile: false,
    always_keep_download: false,
    always_keep_install: false,
    asdf_compat: false,
    cargo_binstall: true,
    color: true,
    disable_default_shorthands: false,
    disable_tools: {},
    experimental: false,
    go_default_packages_file: "~/.default-go-packages",
    go_download_mirror: "https://dl.google.com/go",
    go_repo: "https://github.com/golang/go",
    go_set_gobin: None,
    go_set_gopath: false,
    go_set_goroot: true,
    go_skip_checksum: false,
    jobs: 4,
    legacy_version_file: true,
    legacy_version_file_disable_tools: {},
    node_compile: false,
    not_found_auto_install: true,
    paranoid: false,
    plugin_autoupdate_last_check_duration: "7d",
    python_compile: None,
    python_default_packages_file: Some(
        "/home/karim/.default-python-packages",
    ),
    python_patch_url: None,
    python_patches_directory: None,
    python_precompiled_arch: None,
    python_precompiled_os: None,
    python_pyenv_repo: "https://github.com/pyenv/pyenv.git",
    raw: false,
    shorthands_file: None,
    status: SettingsStatus {
        missing_tools: IfOtherVersionsInstalled,
        show_env: false,
        show_tools: false,
    },
    task_output: None,
    trusted_config_paths: {},
    quiet: false,
    verbose: true,
    yes: false,
    ci: false,
    cd: None,
    debug: true,
    env_file: None,
    trace: true,
    log_level: "trace",
    python_venv_auto_create: false,
}
[TRACE] (3) mise::file: [src/file.rs:101] cat ~/.local/share/mise/installs/zig/.mise.forge.json
[TRACE] (3) mise::file: [src/file.rs:101] cat ~/.local/share/mise/installs/node/.mise.forge.json
[TRACE] (2) mise::file: [src/file.rs:101] cat ~/.local/share/mise/installs/usage/.mise.forge.json
[TRACE] (2) mise::file: [src/file.rs:101] cat ~/.local/share/mise/installs/go/.mise.forge.json
[TRACE] (1) mise::config::config_file::mise_toml: [src/config/config_file/mise_toml.rs:86] parsing: ~/.config/mise/config.toml
[TRACE] (1) mise::file: [src/file.rs:101] cat ~/.config/mise/config.toml
[TRACE] (1) mise::file: [src/file.rs:101] cat ~/.config/mise/config.toml
[TRACE] (1) mise::config::config_file::mise_toml: [src/config/config_file/mise_toml.rs:96] [tools]
node = "lts"
go = "latest"
zig = "latest"
usage = "latest"

[DEBUG] (1) mise::config: [src/config/mod.rs:92] Config {
    Config Files: [
        "~/.config/mise/config.toml",
    ],
}
[DEBUG] (2) mise::toolset::tool_request_set: [src/toolset/tool_request_set.rs:159] ToolRequestSet.build(66.38µs): ToolRequestSet: node@lts go@latest zig@latest usage@latest

[TRACE] (2) mise::cache: [src/cache.rs:87] reading ~/.cache/mise/node/remote_versions-6991a.msgpack.z
[DEBUG] (1) mise::toolset::builder: [src/toolset/builder.rs:48] Toolset (3.227006ms): node@lts, go@latest, zig@latest, usage@latest
[TRACE] (1) mise::cache: [src/cache.rs:87] reading ~/.cache/mise/go/remote_versions-6991a.msgpack.z
[TRACE] (1) mise::cache: [src/cache.rs:87] reading ~/.cache/mise/zig/remote_versions-6991a.msgpack.z
[TRACE] (1) mise::cache: [src/cache.rs:87] reading ~/.cache/mise/usage/latest_stable-6991a.msgpack.z
[DEBUG] (1) mise::toolset::builder: [src/toolset/builder.rs:48] Toolset (1.404724ms): node@lts, go@latest, zig@latest, usage@latest
[DEBUG] (1) mise::toolset: [src/toolset/mod.rs:161] install_versions: node@lts
[TRACE] (6) mise::file: [src/file.rs:31] rm -rf ~/.cache/mise/node/20.14.0
[TRACE] (6) mise::file: [src/file.rs:42] rm ~/.local/share/mise/installs/node/20.14.0
[TRACE] (6) mise::file: [src/file.rs:120] mkdir -p ~/.local/share/mise/installs/node/20.14.0
[TRACE] (6) mise::file: [src/file.rs:120] mkdir -p ~/.local/share/mise/downloads/node/20.14.0
[TRACE] (6) mise::file: [src/file.rs:120] mkdir -p ~/.cache/mise/node/20.14.0
[TRACE] (2) mise::cache: [src/cache.rs:87] reading ~/.cache/mise/zig/0.12.0/list_bin_paths-6991a.msgpack.z
[TRACE] (3) mise::cache: [src/cache.rs:87] reading ~/.cache/mise/usage/0.3.0/list_bin_paths-6991a.msgpack.z
[TRACE] (6) mise::plugins::core::node: [src/plugins/core/node.rs:296] node build opts: BuildOpts {
    version: "20.14.0",
    path: [
        "/home/karim/.local/share/mise/installs/go/1.22.3/bin",
        "/home/karim/.local/share/mise/installs/go/1.22.3/go/bin",
        "/home/karim/.local/share/mise/installs/zig/latest/bin",
        "/home/karim/.local/share/mise/installs/usage/latest/bin",
    ],
    install_path: "/home/karim/.local/share/mise/installs/node/20.14.0",
    build_dir: "/tmp/mise/node-v20.14.0",
    configure_cmd: "./configure --prefix=/home/karim/.local/share/mise/installs/node/20.14.0",
    make_cmd: "make -j2",
    make_install_cmd: "make install",
    source_tarball_name: "node-v20.14.0.tar.gz",
    source_tarball_path: "/home/karim/.local/share/mise/downloads/node/20.14.0/node-v20.14.0.tar.gz",
    source_tarball_url: Url {
        scheme: "https",
        cannot_be_a_base: false,
        username: "",
        password: None,
        host: Some(
            Domain(
                "nodejs.org",
            ),
        ),
        port: None,
        path: "/dist/v20.14.0/node-v20.14.0.tar.gz",
        query: None,
        fragment: None,
    },
    binary_tarball_name: "node-v20.14.0-linux-x64.tar.gz",
    binary_tarball_path: "/home/karim/.local/share/mise/downloads/node/20.14.0/node-v20.14.0-linux-x64.tar.gz",
    binary_tarball_url: Url {
        scheme: "https",
        cannot_be_a_base: false,
        username: "",
        password: None,
        host: Some(
            Domain(
                "nodejs.org",
            ),
        ),
        port: None,
        path: "/dist/v20.14.0/node-v20.14.0-linux-x64.tar.gz",
        query: None,
        fragment: None,
    },
}
downloading node-v20.14.0-linux-x64.tar.gz
[DEBUG] (6) mise::http: [src/http.rs:115] GET Downloading https://nodejs.org/dist/v20.14.0/node-v20.14.0-linux-x64.tar.gz to ~/.local/share/mise/downloads/node/20.14.0/node-v20.14.0-linux-x64.tar.gz
[DEBUG] (6) mise::http: [src/http.rs:50] GET https://nodejs.org/dist/v20.14.0/node-v20.14.0-linux-x64.tar.gz
[DEBUG] (6) reqwest::connect: [/cargo/registry/src/index.crates.io-6f17d22bba15001f/reqwest-0.12.4/src/connect.rs:497] starting new connection: https://nodejs.org/
[DEBUG] (6) mise::http: [src/http.rs:58] GET https://nodejs.org/dist/v20.14.0/node-v20.14.0-linux-x64.tar.gz 200 OK
[TRACE] (6) mise::file: [src/file.rs:31] rm -rf ~/.local/share/mise/installs/node/20.14.0
[TRACE] (6) mise::file: [src/file.rs:31] rm -rf ~/.local/share/mise/downloads/node/20.14.0
Error: 
   0: error decoding response body
   1: request or response body error
   2: operation timed out

Location:
   src/http.rs:128

Version:
   2024.5.24 linux-x64 (cf1a690 2024-05-28)

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
sassdavid commented 4 months ago

It's not documented, but as far as I know, there is an environment variable called MISE_FETCH_REMOTE_VERSIONS_TIMEOUT where you can configure the timeout. The default is 10 seconds.

https://github.com/jdx/mise/blob/ef25cb1a419a39de42a2839b4e97c56f19bfe569/src/env.rs#L82

mkblast commented 4 months ago

Yeah, I already tried that.

export MISE_FETCH_REMOTE_VERSIONS_TIMEOUT="1000 s"

Something like this does nothing to fix the issue.

sassdavid commented 4 months ago

I use it in this format:

env_vars:
  MISE_EXPERIMENTAL=true
  MISE_FETCH_REMOTE_VERSIONS_TIMEOUT=30s

could you try?

sassdavid commented 4 months ago

Oh, and I set the environment variable before activating mise.

mkblast commented 4 months ago

unfortunately still the same issue. For now im using this version v2024.3.9, it works fine.

Also it only happens with core plugins. for example zig installation works fine even if it takes more than 30s.

roele commented 4 months ago

The MISE_FETCH_REMOTE_VERSIONS_TIMEOUT is only used to fetch a list of versions in a JSON format, not to download the tool itself. I assume the default HTTP client is used which has a default timeout of 30s.

https://github.com/jdx/mise/blob/402c5cee97ebdbeb42fc32d055f73794d4dfdf12/src/http.rs#L22