jdx / mise

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

mise up node fails #2240

Closed avysk closed 1 month ago

avysk commented 1 month ago

Describe the bug

❯ which node
/home/alexey/.local/share/mise/shims/node
~
❯ node -v
v20.13.1
❯ mise up node
[...downloads source tarball to 80+%...]
mise error decoding response body
mise request or response body error
mise operation timed out

I have tried to cargo uninstall mise and then carge install mise with the same result.

Expected behavior Node is updated.

mise doctor output

❯ LANG=C mise doctor
version: 2024.6.0 freebsd-x64 (2024-06-02)
activated: no
shims_on_path: yes

build_info:
  Target: x86_64-unknown-freebsd
  Features: DEFAULT, NATIVE_TLS
  Built: Sun, 2 Jun 2024 06:27:35 +0000
  Rust Version: rustc 1.78.0 (9b00956e5 2024-04-29)
  Profile: release

shell:
  /usr/local/bin/bash
  GNU bash, version 5.2.26(1)-release (amd64-portbld-freebsd14.0)
  Copyright (C) 2022 Free Software Foundation, Inc.
  License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

  This is free software; you are free to change and redistribute it.
  There is NO WARRANTY, to the extent permitted by law.

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)
  opam    https://github.com/asdf-community/asdf-opam.git#d6be9d7
  pipx    https://github.com/yozachar/asdf-pipx.git#31db618
  python  (core)
  ruby    (core)
  zig     (core)

toolset:
  python@3.12.3
  pipx@1.5.0
  node@20.13.1
  npm:prettier@3.3.0
  npm:awk-language-server@0.10.5
  npm:bash-language-server@5.3.3
  pipx:ipython@latest
  pipx:terminal-colors@latest
  pipx:ruff@latest
  pipx:pytest@latest
  pipx:pylint@latest
  pipx:poetry@latest
  pipx:mypy@latest
  pipx:isort@latest
  pipx:black@latest
  pipx:magic-wormhole@latest
  pipx:fortls@latest
  pipx:fprettify@latest
  cargo:eza@0.18.16
  cargo:bat@0.24.0
  cargo:zoxide@0.9.4
  cargo:starship@1.19.0
  cargo:maturin@1.5.1

env_vars:
  (none)

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 = true
  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
  http_timeout = 30
  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/alexey/.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 up node --debug
[DEBUG] ARGS: mise up node --debug
[DEBUG] Config {
    Config Files: [
        "~/.config/mise/config.toml",
    ],
}
[DEBUG] Toolset (429.936µs): python@latest, pipx@latest, node@latest, npm:prettier@latest, npm:awk-language-server@latest, npm:bash-language-server@latest, pipx:ipython@latest, pipx:terminal-colors@latest, pipx:ruff@latest, pipx:pytest@latest, pipx:pylint@latest, pipx:poetry@latest, pipx:mypy@latest, pipx:isort@latest, pipx:black@latest, pipx:magic-wormhole@latest, pipx:fortls@latest, pipx:fprettify@latest, cargo:eza@latest, cargo:bat@latest, cargo:zoxide@latest, cargo:starship@latest, cargo:maturin@latest
[DEBUG] ToolRequestSet.build(88.836µs): ToolRequestSet: python@latest pipx@latest node@latest npm:prettier@latest npm:awk-language-server@latest npm:bash-language-server@latest pipx:ipython@latest pipx:terminal-colors@latest pipx:ruff@latest pipx:pytest@latest pipx:pylint@latest pipx:poetry@latest pipx:mypy@latest pipx:isort@latest pipx:black@latest pipx:magic-wormhole@latest pipx:fortls@latest pipx:fprettify@latest cargo:eza@latest cargo:bat@latest cargo:zoxide@latest cargo:starship@latest cargo:maturin@latest

[DEBUG] Toolset (414.115µs): python@latest, pipx@latest, node@latest, npm:prettier@latest, npm:awk-language-server@latest, npm:bash-language-server@latest, pipx:ipython@latest, pipx:terminal-colors@latest, pipx:ruff@latest, pipx:pytest@latest, pipx:pylint@latest, pipx:poetry@latest, pipx:mypy@latest, pipx:isort@latest, pipx:black@latest, pipx:magic-wormhole@latest, pipx:fortls@latest, pipx:fprettify@latest, cargo:eza@latest, cargo:bat@latest, cargo:zoxide@latest, cargo:starship@latest, cargo:maturin@latest
[DEBUG] install_versions: node@latest
downloading node-v22.2.0-freebsd-x64.tar.gz
[DEBUG] GET Downloading https://nodejs.org/dist/v22.2.0/node-v22.2.0-freebsd-x64.tar.gz to ~/.local/share/mise/downloads/node/22.2.0/node-v22.2.0-freebsd-x64.tar.gz
[DEBUG] GET https://nodejs.org/dist/v22.2.0/node-v22.2.0-freebsd-x64.tar.gz
[DEBUG] starting new connection: https://nodejs.org/
[DEBUG] GET https://nodejs.org/dist/v22.2.0/node-v22.2.0-freebsd-x64.tar.gz 404 Not Found
[DEBUG] precompiled node not found
downloading node-v22.2.0.tar.gz
[DEBUG] GET Downloading https://nodejs.org/dist/v22.2.0/node-v22.2.0.tar.gz to ~/.local/share/mise/downloads/node/22.2.0/node-v22.2.0.tar.gz
[DEBUG] GET https://nodejs.org/dist/v22.2.0/node-v22.2.0.tar.gz
[DEBUG] starting new connection: https://nodejs.org/
[DEBUG] GET https://nodejs.org/dist/v22.2.0/node-v22.2.0.tar.gz 200 OK
Error:
   0: error decoding response body
   1: request or response body error
   2: operation timed out

Location:
   /home/alexey/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mise-2024.6.0/src/http.rs:130

Version:
   2024.6.0 freebsd-x64 (2024-06-02)

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                                ⋮ 3 frames hidden ⋮
   4: <core::pin::Pin<P> as core::future::future::Future>::poll::h69798ca4b7b0b0b4
      at <unknown source file>:<unknown line>
   5: tokio::runtime::scheduler::current_thread::Context::enter::h148b1534012239c6
      at <unknown source file>:<unknown line>
   6: tokio::runtime::context::scoped::Scoped<T>::set::h42e2d57ce0708433
      at <unknown source file>:<unknown line>
   7: tokio::runtime::scheduler::current_thread::CoreGuard::block_on::h641f5aa1c0ad8124
      at <unknown source file>:<unknown line>
   8: tokio::runtime::context::runtime::enter_runtime::hb987abbbdbcbf6b0
      at <unknown source file>:<unknown line>
   9: tokio::runtime::runtime::Runtime::block_on::hfdb6a7685bc1ecd7
      at <unknown source file>:<unknown line>
  10: mise::http::Client::download_file::h40614b3384beffcd
      at <unknown source file>:<unknown line>
  11: mise::plugins::core::node::NodePlugin::fetch_tarball::hee9a06e05ffb128d
      at <unknown source file>:<unknown line>
  12: mise::plugins::core::node::NodePlugin::install_compiled::hd034e28dbf3ff12b
      at <unknown source file>:<unknown line>
  13: <mise::plugins::core::node::NodePlugin as mise::backend::Backend>::install_version_impl::h04c5aaf85f918b14
      at <unknown source file>:<unknown line>
  14: mise::backend::Backend::install_version::h35e7d2e3c978da8b
      at <unknown source file>:<unknown line>
  15: std::sys_common::backtrace::__rust_begin_short_backtrace::h14e7345a0d14aff5
      at <unknown source file>:<unknown line>
  16: core::ops::function::FnOnce::call_once{{vtable.shim}}::h3de76bdb9288e09e
      at <unknown source file>:<unknown line>
  17: std::sys::pal::unix::thread::Thread::new::thread_start::h48875a304fc6b344
      at <unknown source file>:<unknown line>

Downloading dist tarball manually on this system works without any problems.

avysk commented 1 month ago

I have bypassed the problem by setting http_timeout = 60 in config file. You have somewhere the hardcoded timeout. Oh my.

avysk commented 1 month ago

This https://github.com/jdx/mise/commit/cca3a8abf58a7d851ce413a8e0c7dc99b859477f kinda parametrizes timeout. Still "did not download file in time T" is not a good way to determine if http request has stalled. At the very least, without major changes in the architecture, you can reset timeout if some new data has arrived.

roele commented 1 month ago

HTTP timeout is still 30s even after changes in cca3a8a but i assume the culprit is the following line which should rather be a read_timeout().

https://github.com/jdx/mise/blob/4334313da52c13d7f87656fb0e7978e4cf1f5d2f/src/http.rs#L38