mise icon indicating copy to clipboard operation
mise copied to clipboard

config rtx to make http request as little as possible

Open dfang opened this issue 2 years ago • 1 comments

when I run rtx uninstall bin, it was very slow. it shouldn't be. so I try to trace it.

λ RTX_TRACE=1 rtx uninstall bin
[TRACE] (1) rtx::config::config_file::rtx_toml: [src/config/config_file/rtx_toml.rs:59] parsing: /Users/kb24/.config/rtx/config.toml
[TRACE] (1) rtx::config::config_file::rtx_toml: [src/config/config_file/rtx_toml.rs:59] parsing: /Users/kb24/.config/rtx/config.toml
[TRACE] (1) rtx::config: [src/config/mod.rs:68] Settings: Settings {
    experimental: true,
    missing_runtime_behavior: Warn,
    always_keep_download: true,
    always_keep_install: true,
    legacy_version_file: true,
    legacy_version_file_disable_tools: {},
    plugin_autoupdate_last_check_duration: 604800s,
    trusted_config_paths: {},
    verbose: true,
    asdf_compat: false,
    jobs: 4,
    shorthands_file: None,
    disable_default_shorthands: false,
    disable_tools: {},
    log_level: Trace,
    raw: false,
}
[DEBUG] (1) rtx::config: [src/config/mod.rs:111] Files: ~/.config/rtx/config.toml
Installed Plugins: bin, pdm
[DEBUG] (1) rtx::cli: [src/cli/mod.rs:190] rtx uninstall bin
[DEBUG] (1) rtx::cmd: [src/cmd.rs:80] $ /Users/kb24/.local/share/rtx/plugins/bin/bin/latest-stable
[WARN] (1) rtx::toolset::tool_version_list: [src/toolset/tool_version_list.rs:35] failed to resolve tool version: Failed fetching latest stable version for plugin bin: ~/.local/share/rtx/plugins/bin/bin/latest-stable exited with non-zero status: no exit status
[DEBUG] (1) rtx::toolset::builder: [src/toolset/builder.rs:63] bin@latest
The application panicked (crashed).
Message:  no version found
Location: src/cli/uninstall.rs:36

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                                ⋮ 8 frames hidden ⋮
   9: core::option::expect_failed::h9313fc4a058fca56
      at <unknown source file>:<unknown line>
  10: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold::h53a62cadddd3a82f
      at <unknown source file>:<unknown line>
  11: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter::h1ed3ac077d8ead83
      at <unknown source file>:<unknown line>
  12: core::iter::adapters::try_process::h8b3e9931742436ff
      at <unknown source file>:<unknown line>
  13: <rtx::cli::uninstall::Uninstall as rtx::cli::command::Command>::run::h8e4321c6b0ac07f3
      at <unknown source file>:<unknown line>
  14: rtx::cli::Cli::run::hf8f6dc3817ab44bc
      at <unknown source file>:<unknown line>
  15: rtx::main::h92486b1f6d3a2636
      at <unknown source file>:<unknown line>
  16: std::sys_common::backtrace::__rust_begin_short_backtrace::he39734598d93c58b
      at <unknown source file>:<unknown line>
  17: std::rt::lang_start::{{closure}}::hca813edbd21c75ce
      at <unknown source file>:<unknown line>
  18: std::rt::lang_start_internal::h36134e47b0b0d769
      at <unknown source file>:<unknown line>
  19: _main<unknown>
      at <unknown source file>:<unknown line>

Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.

λ rtx ls
bin    0.17.0 (missing) ~/.config/rtx/config.toml latest
go     1.20.5
go     1.20.6
pdm    2.7.4
python 3.10.12

λ rtx version
1.35.8 macos-x64 (3d305dc 2023-08-01)

λ RTX_TRACE=1 rtx doctor
[TRACE] (1) rtx::config::config_file::rtx_toml: [src/config/config_file/rtx_toml.rs:59] parsing: /Users/kb24/.config/rtx/config.toml
[TRACE] (7) rtx::config::config_file::tool_versions: [src/config/config_file/tool_versions.rs:57] parsing tool-versions: /Users/kb24/src/rtx/.tool-versions
[TRACE] (3) rtx::config::config_file::rtx_toml: [src/config/config_file/rtx_toml.rs:59] parsing: /Users/kb24/src/rtx/.rtx.local.toml
[TRACE] (10) rtx::config::config_file::rtx_toml: [src/config/config_file/rtx_toml.rs:59] parsing: /Users/kb24/src/rtx/.rtx.toml
[TRACE] (6) rtx::config::config_file::rtx_toml: [src/config/config_file/rtx_toml.rs:59] parsing: /Users/kb24/.config/rtx/config.toml
[TRACE] (1) rtx::config: [src/config/mod.rs:68] Settings: Settings {
    experimental: true,
    missing_runtime_behavior: Warn,
    always_keep_download: true,
    always_keep_install: true,
    legacy_version_file: true,
    legacy_version_file_disable_tools: {},
    plugin_autoupdate_last_check_duration: 604800s,
    trusted_config_paths: {},
    verbose: true,
    asdf_compat: false,
    jobs: 4,
    shorthands_file: None,
    disable_default_shorthands: false,
    disable_tools: {},
    log_level: Trace,
    raw: false,
}
[DEBUG] (1) rtx::config: [src/config/mod.rs:111] Files: ~/src/rtx/.rtx.local.toml, ~/src/rtx/.rtx.toml, ~/src/rtx/.tool-versions, ~/src/rtx/.node-version, ~/.config/rtx/config.toml
Installed Plugins: bin, pdm
[DEBUG] (1) rtx::cli: [src/cli/mod.rs:190] rtx doctor
[DEBUG] (9) rtx::cmd: [src/cmd.rs:80] $ /Users/kb24/.local/share/rtx/plugins/bin/bin/latest-stable
[TRACE] (10) rtx::cache: [src/cache.rs:78] reading ~/Library/Caches/rtx/ruby/remote_versions.msgpack.z
[TRACE] (3) rtx::cache: [src/cache.rs:78] reading ~/Library/Caches/rtx/node/remote_versions.msgpack.z
[WARN] (9) rtx::toolset::tool_version_list: [src/toolset/tool_version_list.rs:35] failed to resolve tool version: Failed fetching latest stable version for plugin bin: ~/.local/share/rtx/plugins/bin/bin/latest-stable exited with non-zero status: no exit status
[DEBUG] (1) rtx::toolset::builder: [src/toolset/builder.rs:63] tiny@1, go@latest, python@latest, [email protected], [email protected], shfmt@sub-1:3, jq@latest, node@lts/hydrogen, bin@latest
rtx version:
  1.35.8 macos-x64 (3d305dc 2023-08-01)

build:
  Target: x86_64-apple-darwin
  Features: DEFAULT, NATIVE_TLS, OPENSSL, SELF_UPDATE
  Built: Tue, 01 Aug 2023 19:09:37 +0000
  Rust Version: rustc 1.70.0 (90c541806 2023-05-31)
  Profile: release

[DEBUG] (1) rtx::cmd: [src/cmd.rs:80] $ /bin/bash --version
shell:
  /bin/bash
  GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin20)
  Copyright (C) 2007 Free Software Foundation, Inc.

rtx data directory:
  /Users/kb24/.local/share/rtx

rtx environment variables:
  RTX_TRACE=1
  RTX_SHELL=bash
  RTX_GO_REPO=https://ghproxy.com/https://github.com/golang/go
  RTX_RUBY_BUILD_REPO=https://ghproxy.com/https://github.com/rbenv/ruby-build.git
  RTX_ALWAYS_KEEP_INSTALL=1
  RTX_PYENV_REPO=https://ghproxy.com/https://github.com/pyenv/pyenv.git
  RTX_EXPERIMENTAL=1
  RTX_NODEJS_NODEBUILD_REPO=https://ghproxy.com/https://github.com/nodenv/node-build.git
  RTX_ALWAYS_KEEP_DOWNLOAD=1
  RTX_GOLANG_DOWNLOAD_MIRROR=https://mirrors.aliyun.com/golang
  RTX_GO_SKIP_CHECKSUM=1
  RTX_CONFIRM=yes
  RTX_VERBOSE=1
  RTX_GO_DOWNLOAD_MIRROR=https://mirrors.aliyun.com/golang
  RTX_FETCH_REMOTE_VERSIONS_TIMEOUT=5000ms

settings:
  {"always_keep_download": "true", "always_keep_install": "true", "asdf_compat": "false", "disable_default_shorthands": "false", "disable_tools": "[]", "experimental": "true", "jobs": "4", "legacy_version_file": "true", "legacy_version_file_disable_tools": "[]", "log_level": "TRACE", "missing_runtime_behavior": "warn", "plugin_autoupdate_last_check_duration": "10080", "raw": "false", "trusted_config_paths": "[]", "verbose": "true"}

config files:
  /Users/kb24/.config/rtx/config.toml
  /Users/kb24/src/rtx/.node-version
  /Users/kb24/src/rtx/.tool-versions
  /Users/kb24/src/rtx/.rtx.toml
  /Users/kb24/src/rtx/.rtx.local.toml

[DEBUG] (1) rtx::cmd: [src/cmd.rs:80] $ git -C /Users/kb24/.local/share/rtx/plugins/bin config --get remote.origin.url
[DEBUG] (1) rtx::git: [src/git.rs:108] remote url for /Users/kb24/.local/share/rtx/plugins/bin: https://github.com/joe733/asdf-bin.git
[DEBUG] (1) rtx::cmd: [src/cmd.rs:80] $ git -C /Users/kb24/.local/share/rtx/plugins/bin rev-parse --short HEAD
[DEBUG] (1) rtx::git: [src/git.rs:86] current sha for /Users/kb24/.local/share/rtx/plugins/bin: 5b5c60b
[DEBUG] (1) rtx::cmd: [src/cmd.rs:80] $ git -C /Users/kb24/.local/share/rtx/plugins/pdm config --get remote.origin.url
[DEBUG] (1) rtx::git: [src/git.rs:108] remote url for /Users/kb24/.local/share/rtx/plugins/pdm: https://github.com/1oglop1/asdf-pdm
[DEBUG] (1) rtx::cmd: [src/cmd.rs:80] $ git -C /Users/kb24/.local/share/rtx/plugins/pdm rev-parse --short HEAD
[DEBUG] (1) rtx::git: [src/git.rs:86] current sha for /Users/kb24/.local/share/rtx/plugins/pdm: 913e73f
plugins:
  bin      https://github.com/joe733/asdf-bin.git#5b5c60b
  bun      (core)
  deno     (core)
  go       (core)
  java     (core)
  node     (core)
  pdm      https://github.com/1oglop1/asdf-pdm#913e73f
  python   (core)
  ruby     (core)

toolset:
  tiny@1, go@latest, python@latest, [email protected], [email protected], shfmt@sub-1:3, jq@latest, node@lts/hydrogen, bin@latest

4 problems found:
plugin jq is not installed

plugin shellcheck is not installed

plugin shfmt is not installed

plugin tiny is not installed

maybe the problem is [DEBUG] (9) rtx::cmd: [src/cmd.rs:80] $ /Users/kb24/.local/share/rtx/plugins/bin/bin/latest-stable, without HTTPS_PROXY environment available in iTerm, the request is unstable. it's easy for me to reproduce this:

  1. install it, rtx i xxx
  2. clear cache with rtx cache clear
  3. turn off vpn and unset https_proxy environment variable (turn off wifi is not the case)
  4. then run rtx uninstall xxx

so my question is how to turn off the check when uninstall or else. because I also noticed when I run some rtx commands(eg. rtx ls), the title of iTerm tab is changed to curl or git. when the proxy is not available, this could be annoying.

dfang avatar Aug 09 '23 01:08 dfang

open a new tab in terminal

Last login: Sat Aug 26 20:32:44 on ttys032
[DEBUG] rtx::config: Files: /Users/mj/.tool-versions, ~/.config/rtx/config.toml
Installed Plugins: bin, fzf, jq, pdm, shfmt
[DEBUG] rtx::cli: rtx activate --status -s bash
[DEBUG] rtx::config: Files: /Users/mj/.tool-versions, ~/.config/rtx/config.toml
Installed Plugins: bin, fzf, jq, pdm, shfmt
[DEBUG] rtx::cli: rtx hook-env --status -s bash
[DEBUG] rtx::http: GET https://joschi.github.io/java-metadata/metadata/all.json
[DEBUG] reqwest::connect: starting new connection: https://joschi.github.io/
^C[DEBUG] rtx: Ctrl-C pressed, exiting...

[DEBUG] rtx::config: Files: /Users/mj/.tool-versions, ~/.config/rtx/config.toml
Installed Plugins: bin, fzf, jq, pdm, shfmt
[DEBUG] rtx::cli: rtx hook-env --status -s bash
[DEBUG] rtx::http: GET https://joschi.github.io/java-metadata/metadata/all.json
[DEBUG] reqwest::connect: starting new connection: https://joschi.github.io/
^C[DEBUG] rtx: Ctrl-C pressed, exiting...

[DEBUG] rtx::config: Files: /Users/mj/.tool-versions, ~/.config/rtx/config.toml
Installed Plugins: bin, fzf, jq, pdm, shfmt
[DEBUG] rtx::cli: rtx hook-env --status -s bash
[DEBUG] rtx::http: GET https://joschi.github.io/java-metadata/metadata/all.json
[DEBUG] reqwest::connect: starting new connection: https://joschi.github.io/
^C[DEBUG] rtx: Ctrl-C pressed, exiting...

[DEBUG] rtx::config: Files: /Users/mj/.tool-versions, ~/.config/rtx/config.toml
Installed Plugins: bin, fzf, jq, pdm, shfmt
[DEBUG] rtx::cli: rtx hook-env --status -s bash
[DEBUG] rtx::http: GET https://joschi.github.io/java-metadata/metadata/all.json
[DEBUG] reqwest::connect: starting new connection: https://joschi.github.io/
^C[DEBUG] rtx: Ctrl-C pressed, exiting...

[DEBUG] rtx::config: Files: /Users/mj/.tool-versions, ~/.config/rtx/config.toml
Installed Plugins: bin, fzf, jq, pdm, shfmt
[DEBUG] rtx::cli: rtx hook-env --status -s bash
[DEBUG] rtx::http: GET https://joschi.github.io/java-metadata/metadata/all.json
[DEBUG] reqwest::connect: starting new connection: https://joschi.github.io/
[WARN] rtx::toolset::tool_version_list: failed to resolve tool version: timed out: timed out waiting on channel
[WARN] rtx::toolset: Tools not installed: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected] (install with: rtx install)
[DEBUG] rtx::toolset::builder: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]+8, [email protected], [email protected], [email protected]
rtx [email protected]

new tab again

Last login: Sat Aug 26 20:34:00 on ttys033
[DEBUG] rtx::config: Files: /Users/mj/.tool-versions, ~/.config/rtx/config.toml
Installed Plugins: bin, fzf, jq, pdm, shfmt
[DEBUG] rtx::cli: rtx activate --status -s bash
[DEBUG] rtx::config: Files: /Users/mj/.tool-versions, ~/.config/rtx/config.toml
Installed Plugins: bin, fzf, jq, pdm, shfmt
[DEBUG] rtx::cli: rtx hook-env --status -s bash
[DEBUG] rtx::http: GET https://joschi.github.io/java-metadata/metadata/all.json
[DEBUG] reqwest::connect: starting new connection: https://joschi.github.io/
[WARN] rtx::toolset::tool_version_list: failed to resolve tool version: timed out: timed out waiting on channel

I need to wait a few seconds

[WARN] rtx::toolset: Tools not installed: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected] (install with: rtx install)
[DEBUG] rtx::toolset::builder: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]+8, [email protected], [email protected], [email protected]
rtx [email protected]

like this https://github.com/jdxcode/rtx/issues/801, press CTRL + C not work as expected

dfang avatar Aug 26 '23 12:08 dfang

closing since it's basically a duplicate of #676

jdx avatar Jan 25 '24 02:01 jdx