jdx / mise

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

mise failed to parse cache file #1671

Closed tonyarnold closed 7 months ago

tonyarnold commented 8 months ago

Describe the bug I'm regularly seeing logs saying that mise failed to parse cache file, like the following:

mise failed to parse cache file: /Users/tonyarnold/Library/Caches/mise/starship/1.17.1/list_bin_paths.msgpack.z IO error while reading marker: failed to fill whole buffer: failed to fill whole buffer
mise failed to parse cache file: /Users/tonyarnold/Library/Caches/mise/zoxide/0.9.3/list_bin_paths.msgpack.z IO error while reading marker: failed to fill whole buffer: failed to fill whole buffer

To Reproduce I'm honestly not sure - it's not happening every time I open a new terminal window, but it's happening at least 2 out of every 3 new windows.

Expected behavior There's no IO error.

mise doctor output

mise version:
  2024.2.16 macos-arm64 (2024-02-15)

build:
  Target: aarch64-apple-darwin
  Features: DEFAULT, NATIVE_TLS
  Built: Thu, 15 Feb 2024 02:24:55 +0000
  Rust Version: rustc 1.75.0 (82e1608df 2023-12-21) (Homebrew)
  Profile: release

shell:
  /opt/homebrew/bin/fish
  fish, version 3.7.0

mise dirs:
  data: /Users/tonyarnold/.local/share/mise
  config: /Users/tonyarnold/.config/mise
  cache: /Users/tonyarnold/Library/Caches/mise
  state: /Users/tonyarnold/.local/state/mise
  shims: /Users/tonyarnold/.local/share/mise/shims

mise environment variables:
  MISE_SHELL=fish

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
  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 = false
  python_default_packages_file = "/Users/tonyarnold/.default-python-packages"
  python_pyenv_repo = "https://github.com/pyenv/pyenv.git"
  python_venv_auto_create = false
  raw = false
  trusted_config_paths = []
  quiet = false
  verbose = false
  yes = false
  ci = false
  debug = false
  trace = false
  log_level = "info"

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

activated: yes
shims_on_path: no
config files:
  ~/.config/mise/config.toml

plugins:
  bun           (core)
  deno          (core)
  erlang        (core)
  exa           https://github.com/nyrst/asdf-exa.git#3f525b7
  fzf           https://github.com/kompiro/asdf-fzf.git#d19eb67
  go            (core)
  hugo          https://github.com/NeoHsu/asdf-hugo.git#125ce37
  java          (core)
  kotlin        https://github.com/asdf-community/asdf-kotlin.git#4615415
  mint          https://github.com/mint-lang/asdf-mint#be67a69
  neovim        https://github.com/richin13/asdf-neovim.git#55d10fe
  node          (core)
  python        (core)
  ruby          (core)
  rust          https://github.com/code-lever/asdf-rust.git#95acf4f
  starship      https://github.com/grimoh/asdf-starship.git#9ffad1c
  swiftformat   https://github.com/younke/asdf-swiftformat.git#8f0e34d
  swiftlint     https://github.com/klundberg/asdf-swiftlint.git#79f2c6e
  tuist         https://github.com/asdf-community/asdf-tuist.git#0b8a7dd
  zoxide        https://github.com/nyrst/asdf-zoxide#8ed95c9

toolset:
  python@latest, ruby@latest, bun@latest, node@latest, go@latest, rust@latest, neovim@latest, starship@latest, tuist@latest, kotlin@latest, hugo@latest, zoxide@latest, fzf@latest, mint@latest

No problems found
jdx commented 8 months ago

almost certainly some kind of race condition where you're probably executing mise asynchronously in 2 places. It shouldn't cause any real problem since it just means it has to refresh the cache twice.

I'm not sure what the best way to fix this would be, or even if a fix makes sense. We could create a file lock around these which we do for other things but I don't love that idea. It might impact performance since this is on the critical path. We could also just not show a warning in this case but I kind of want to keep it just in case some other problem happens around serializing since it's good to know that errors are happening without debug mode.

tonyarnold commented 8 months ago

It's happening when I run mise up - I'm not deliberately running more than one copy at a time.

tonyarnold commented 7 months ago

Is there any chance that you could give users a way to hide this logging? It's quite intrusive, and happens almost any time I login, or invoke mise:

Last login: Mon Feb 26 07:33:03 on ttys002
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
mise failed to parse cache file: /Users/tonyarnold/Library/Caches/mise/zoxide/0.9.4/list_bin_paths.msgpack.z IO error while reading marker: failed to fill whole buffer: failed to fill whole buffer
mise failed to parse cache file: /Users/tonyarnold/Library/Caches/mise/tuist/4.3.4/list_bin_paths.msgpack.z IO error while reading marker: failed to fill whole buffer: failed to fill whole buffer
mise failed to parse cache file: /Users/tonyarnold/Library/Caches/mise/usage/0.1.9/list_bin_paths.msgpack.z IO error while reading marker: failed to fill whole buffer: failed to fill whole buffer
mise failed to parse cache file: /Users/tonyarnold/Library/Caches/mise/fzf/0.46.1/list_bin_paths.msgpack.z IO error while reading marker: failed to fill whole buffer: failed to fill whole buffer

~
jdx commented 7 months ago

I think you can hide it by setting MISE_LOG_LEVEL=warn. I have not received any other reports of this.

tonyarnold commented 7 months ago

Thanks @jdx. I think that I've found the issue. I had https://github.com/acomagu/fish-async-prompt installed in my fish shell, which would line up with your earlier statement about this coming from a async execution/access.

I've uninstalled the plugin, and will close this issue if it resolves the issue for a couple of days. Thanks for all of the info and your help.

tonyarnold commented 7 months ago

Yeah, two days on and I haven't seen the warning once. It would seem that the async prompt plugin was the culprit. Thanks again for mise, and for your help with this issue.

jc00ke commented 7 months ago

I saw this for the first time when restarting neovim that had multiple terminal buffers open, in case anyone else runs into this but doesn't have an async prompt plugin installed.

ralgozino commented 1 month ago

I was having a very similar issue, I got the failed to parse cache file randomly and not always blaming the same binary.

Thanks to this message from @tonyarnold :

I think that I've found the issue. I had https://github.com/acomagu/fish-async-prompt installed in my fish shell, which would line up with your earlier statement about this coming from a async execution/access.

I remembered that my zsh + oh my zsh + powerlevel10k configuration has an "instant prompt" feature enabled that could be the issue.

I disabled that feature and haven't seen the failed to parse cache file again, at least yet.

Maybe this helps other users.