Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when searching with fd #2272

Open
3 tasks done
Tyarel8 opened this issue Jan 31, 2025 · 5 comments
Open
3 tasks done

Crash when searching with fd #2272

Tyarel8 opened this issue Jan 31, 2025 · 5 comments
Labels
bug Something isn't working

Comments

@Tyarel8
Copy link
Contributor

Tyarel8 commented Jan 31, 2025

What system are you running Yazi on?

Windows

What terminal are you running Yazi in?

wezterm 20241205-083533-6f375e29

yazi --debug output

Yazi
    Version: 0.4.3 (b6cb1fa 2025-01-29)
    Debug  : false
    Triple : x86_64-pc-windows-msvc (windows-x86_64)
    Rustc  : 1.84.0 (9fc6b431 2025-01-07)

Ya
    Version: 0.4.3 (b6cb1fa 2025-01-29)

Emulator
    TERM                : Some("xterm-256color")
    TERM_PROGRAM        : Some("WezTerm")
    TERM_PROGRAM_VERSION: Some("20241205-083533-6f375e29")
    Brand.from_env      : Some(WezTerm)
    Emulator.detect     : Emulator { kind: Left(WezTerm), light: false, cell_size: None }
    Emulator.detect_full: Ok(Emulator { kind: Right(Unknown { kgp: false, sixel: false }), light: false, cell_size: None })

Adapter
    Adapter.matches: Iip

Desktop
    XDG_SESSION_TYPE           : None
    WAYLAND_DISPLAY            : None
    DISPLAY                    : None
    SWAYSOCK                   : None
    HYPRLAND_INSTANCE_SIGNATURE: None
    WAYFIRE_SOCKET             : None

SSH
    shared.in_ssh_connection: false

WSL
    WSL: false

Neovim
    NVIM          : false
    Neovim version: 0.10.4

Variables
    SHELL           : Some("nu")
    EDITOR          : Some("hx")
    VISUAL          : None
    YAZI_FILE_ONE   : Some("C:\\Users\\<user>\\scoop\\apps\\git\\2.47.1.2\\usr\\bin\\file.exe")
    YAZI_CONFIG_HOME: Some("C:\\Users\\<user>\\Sync\\config\\yazi")
    YAZI_ZOXIDE_OPTS: None
    FZF_DEFAULT_OPTS: Some("--layout=reverse --height=60% --bind=\'ctrl-k:clear-query\'\r\n  --color=fg:-1,fg+:#d0d0d0,bg:-1,bg+:#262626\r\n  --color=hl:#5f87af,hl+:#5fd7ff,info:#afaf87,marker:#87ff00\r\n  --color=prompt:#d7005f,spinner:#af5fff,pointer:#af5fff,header:#87afaf\r\n  --color=border:#262626,label:#aeaeae,query:#d9d9d9\r\n  --border=\"none\" --border-label=\"\" --preview-window=\"border-rounded\" --prompt=\"> \"\r\n  --marker=\">\" --pointer=\"\" --separator=\"\" --scrollbar=\"\"")

Text Opener
    default     : Some(Opener { run: "%EDITOR% %*", block: true, orphan: false, desc: "Editor", for_: None, spread: true })
    block-create: Some(Opener { run: "%EDITOR% %*", block: true, orphan: false, desc: "Editor", for_: None, spread: true })
    block-rename: Some(Opener { run: "%EDITOR% %*", block: true, orphan: false, desc: "Editor", for_: None, spread: true })

Multiplexers
    TMUX               : false
    tmux version       : program not found
    tmux build flags   : enable-sixel=Unknown
    ZELLIJ_SESSION_NAME: None
    Zellij version     : program not found

Dependencies
    file          : 5.45
    ueberzugpp    : program not found
    ffmpeg/ffprobe: 7.1 / 7.1
    pdftoppm      : 24.08.0
    magick        : 7.1.1-43
    fzf           : 0.58.0
    fd/fdfind     : 10.2.0 / program not found
    rg            : 14.1.1
    chafa         : program not found
    zoxide        : 0.9.6
    7zz/7z        : program not found / 24.09
    jq            : 1.7.1

Clipboard
    wl-copy/paste: program not found / program not found
    xclip        : program not found
    xsel         : program not found

Describe the bug

When I have require("full-border"):setup() in my init.lua and I change the name of the plugin folder so that it can't find it, it crashes instantly with the following
Rust Backtrace:

Backtrace (most recent call first):
  File "<unknown>", line 0, in onig_unicode_define_user_property
  File "<unknown>", line 0, in onig_unicode_define_user_property
  File "<unknown>", line 0, in onig_unicode_define_user_property
  File "<unknown>", line 0, in _CxxFrameHandler3
  File "<unknown>", line 0, in is_exception_typeof
  File "<unknown>", line 0, in _C_specific_handler
  File "<unknown>", line 0, in is_exception_typeof
  File "<unknown>", line 0, in _CxxFrameHandler3
  File "<unknown>", line 0, in _chkstk
  File "<unknown>", line 0, in RtlUnwindEx
  File "<unknown>", line 0, in RtlUnwind
  File "<unknown>", line 0, in _report_gsfailure
  File "<unknown>", line 0, in onig_setup_builtin_monitors_by_ascii_encoded_name
  File "<unknown>", line 0, in onig_setup_builtin_monitors_by_ascii_encoded_name
  File "<unknown>", line 0, in onig_setup_builtin_monitors_by_ascii_encoded_name
  File "<unknown>", line 0, in onig_setup_builtin_monitors_by_ascii_encoded_name
  File "<unknown>", line 0, in onig_setup_builtin_monitors_by_ascii_encoded_name
  File "<unknown>", line 0, in onig_unicode_define_user_property
  File "<unknown>", line 0, in onig_setup_builtin_monitors_by_ascii_encoded_name
  File "<unknown>", line 0, in onig_setup_builtin_monitors_by_ascii_encoded_name
  File "<unknown>", line 0, in onig_setup_builtin_monitors_by_ascii_encoded_name
  File "<unknown>", line 0, in onig_setup_builtin_monitors_by_ascii_encoded_name
  File "<unknown>", line 0, in onig_unicode_define_user_property
  File "<unknown>", line 0, in BaseThreadInitThunk
  File "<unknown>", line 0, in RtlUserThreadStart

The application panicked (crashed).
  panic in a function that cannot unwind
in core\src\panicking.rs, line 223
thread: main

Yazi log:

  2025-01-31T01:44:44.546863Z DEBUG yazi_adapter::emulator: read_until_da1: [27, 91, 63, 54, 49, 59, 54, 59, 55, 59, 50, 49, 59, 50, 50, 59, 50, 51, 59, 50, 52, 59, 50, 56, 59, 51, 50, 59, 52, 50, 99]
    at yazi-adapter\src\emulator.rs:128

  2025-01-31T01:44:44.546895Z  WARN yazi_adapter::emulator: Failed to detect background color: "\u{1b}[?61;6;7;21;22;23;24;28;32;42c"
    at yazi-adapter\src\emulator.rs:242

Even with the plugin fully installed, using yazi normally I was getting random crashes with the same/similar log and backtrace, that's why I found out this specific situation. For example, if I go to ~/.cargo/bin and search with fd for the string nu, it sometimes crashes with this yazi log and same backtrace but with the text cut out because it's exiting the tui.

Yazi log:

  2025-01-31T01:49:46.355261Z DEBUG yazi_adapter::emulator: read_until_da1: [27, 91, 63, 54, 49, 59, 54, 59, 55, 59, 50, 49, 59, 50, 50, 59, 50, 51, 59, 50, 52, 59, 50, 56, 59, 51, 50, 59, 52, 50, 99]
    at yazi-adapter\src\emulator.rs:128

  2025-01-31T01:49:46.355294Z  WARN yazi_adapter::emulator: Failed to detect background color: "\u{1b}[?61;6;7;21;22;23;24;28;32;42c"
    at yazi-adapter\src\emulator.rs:242

  2025-01-31T01:49:46.368989Z DEBUG yazi_adapter::emulator: read_until_da1: [27, 80, 48, 36, 114, 27, 92, 27, 91, 63, 49, 50, 59, 49, 36, 121, 27, 91, 63, 54, 49, 59, 54, 59, 55, 59, 50, 49, 59, 50, 50, 59, 50, 51, 59, 50, 52, 59, 50, 56, 59, 51, 50, 59, 52, 50, 99]
    at yazi-adapter\src\emulator.rs:128

  2025-01-31T01:49:48.287481Z DEBUG yazi_adapter::emulator: read_until_da1: [27, 80, 48, 36, 114, 27, 92, 27, 91, 63, 49, 50, 59, 49, 36, 121, 27, 91, 63, 54, 49, 59, 54, 59, 55, 59, 50, 49, 59, 50, 50, 59, 50, 51, 59, 50, 52, 59, 50, 56, 59, 51, 50, 59, 52, 50, 99]
    at yazi-adapter\src\emulator.rs:128

Minimal reproducer

Add require("full-border"):setup() to init.lua but don't have the plugin, when entering yazi it will instantly crash

Anything else?

No response

Checklist

  • I tried the latest nightly build, and the issue is still reproducible
  • I updated the debug information (yazi --debug) input box to the nightly that I tried
  • I can reproduce it after disabling all custom configs/plugins (mv ~/.config/yazi ~/.config/yazi-backup)
@Tyarel8 Tyarel8 added the bug Something isn't working label Jan 31, 2025
@sxyazi
Copy link
Owner

sxyazi commented Jan 31, 2025

Please build Yazi in debug mode, set RUST_BACKTRACE=1, and send the full backtrace

@sxyazi sxyazi added the waiting on op Waiting for more information from the original poster label Jan 31, 2025
@Tyarel8
Copy link
Contributor Author

Tyarel8 commented Jan 31, 2025

Here is the backtrace for the plugin missing

    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.47s
     Running `E:/rust-build-artifacts\debug\yazi.exe`
Error: Lua runtime failed

Caused by:
    Failed to load plugin from "C:\\Users\\<user>\\Sync\\config\\yazi\\plugins\\full-border.yazi/init.lua"
    stack traceback:
        [C]: in function 'require'
        [string "init.lua"]:2: in main chunk


Stack backtrace:
   0: std::backtrace_rs::backtrace::dbghelp64::trace
             at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf\library/std\src\..\..\backtrace\src\backtrace\dbghelp64.rs:91
   1: std::backtrace_rs::backtrace::trace_unsynchronized
             at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf\library/std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2: std::backtrace::Backtrace::create
             at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf\library/std\src\backtrace.rs:331
   3: std::backtrace::Backtrace::capture
             at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf\library/std\src\backtrace.rs:296
   4: anyhow::context::ext::impl$0::ext_context<enum2$<mlua::error::Error>,ref$<str$> >
             at C:\Users\<user>\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.95\src\backtrace.rs:27
   5: anyhow::context::impl$0::context<tuple$<>,enum2$<mlua::error::Error>,ref$<str$> >
             at C:\Users\<user>\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.95\src\context.rs:54
   6: yazi_plugin::lua::init_lua
             at .\yazi-plugin\src\lua.rs:15
   7: yazi_plugin::init
             at .\yazi-plugin\src\lib.rs:13
   8: yazi::main::async_block$0
             at .\yazi-fm\src\main.rs:32
   9: tokio::runtime::park::impl$4::block_on::closure$0<enum2$<yazi::main::async_block_env$0> >
             at C:\Users\<user>\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.43.0\src\runtime\park.rs:284
  10: tokio::runtime::coop::with_budget
             at C:\Users\<user>\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.43.0\src\runtime\coop.rs:107
  11: tokio::runtime::coop::budget
             at C:\Users\<user>\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.43.0\src\runtime\coop.rs:73
  12: tokio::runtime::park::CachedParkThread::block_on<enum2$<yazi::main::async_block_env$0> >
             at C:\Users\<user>\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.43.0\src\runtime\park.rs:284
  13: tokio::runtime::context::blocking::BlockingRegionGuard::block_on<enum2$<yazi::main::async_block_env$0> >
             at C:\Users\<user>\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.43.0\src\runtime\context\blocking.rs:66
  14: tokio::runtime::scheduler::multi_thread::impl$0::block_on::closure$0<enum2$<yazi::main::async_block_env$0> >
             at C:\Users\<user>\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.43.0\src\runtime\scheduler\multi_thread\mod.rs:87
  15: tokio::runtime::context::runtime::enter_runtime<tokio::runtime::scheduler::multi_thread::impl$0::block_on::closure_env$0<enum2$<yazi::main::async_block_env$0> >,enum2$<core::result::Result<tuple$<>,anyhow::Error> > >
             at C:\Users\<user>\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.43.0\src\runtime\context\runtime.rs:65
  16: tokio::runtime::scheduler::multi_thread::MultiThread::block_on<enum2$<yazi::main::async_block_env$0> >
             at C:\Users\<user>\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.43.0\src\runtime\scheduler\multi_thread\mod.rs:86
  17: tokio::runtime::runtime::Runtime::block_on_inner<enum2$<yazi::main::async_block_env$0> >
             at C:\Users\<user>\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.43.0\src\runtime\runtime.rs:370
  18: tokio::runtime::runtime::Runtime::block_on<enum2$<yazi::main::async_block_env$0> >
             at C:\Users\<user>\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.43.0\src\runtime\runtime.rs:342
  19: yazi::main
             at .\yazi-fm\src\main.rs:37
  20: core::ops::function::FnOnce::call_once<enum2$<core::result::Result<tuple$<>,anyhow::Error> > (*)(),tuple$<> >
             at C:\Users\<user>\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\ops\function.rs:250
  21: std::sys::backtrace::__rust_begin_short_backtrace<enum2$<core::result::Result<tuple$<>,anyhow::Error> > (*)(),enum2$<core::result::Result<tuple$<>,anyhow::Error> > >
             at C:\Users\<user>\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\sys\backtrace.rs:154
  22: std::rt::lang_start::closure$0<enum2$<core::result::Result<tuple$<>,anyhow::Error> > >
             at C:\Users\<user>\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\rt.rs:195
  23: std::rt::lang_start_internal::closure$1
             at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf\library/std\src\rt.rs:174
  24: std::panicking::try::do_call
             at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf\library/std\src\panicking.rs:557
  25: std::panicking::try
             at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf\library/std\src\panicking.rs:520
  26: std::panic::catch_unwind
             at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf\library/std\src\panic.rs:358
  27: std::rt::lang_start_internal
             at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf\library/std\src\rt.rs:174
  28: std::rt::lang_start<enum2$<core::result::Result<tuple$<>,anyhow::Error> > >
             at C:\Users\<user>\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\rt.rs:194
  29: main
  30: invoke_main
             at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
  31: __scrt_common_main_seh
             at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
  32: BaseThreadInitThunk
  33: RtlUserThreadStart
error: process didn't exit successfully: `E:/rust-build-artifacts\debug\yazi.exe` (exit code: 1)

As for the other random crash, I didn't manage to reproduce it with cargo run but still happens consistently in the latest nightly I downloaded for the bug report.

@github-actions github-actions bot removed the waiting on op Waiting for more information from the original poster label Jan 31, 2025
@sxyazi
Copy link
Owner

sxyazi commented Jan 31, 2025

Why do the two backtraces have no similarities except for their level of redundancy? Are you sure they are caused by the same reason (plugin not found)?

The backtrace in debug mode is expected behavior — when a user imports a non-existent plugin, the current behavior is to print the backtrace.

As for the occasional crashes you mentioned, a more stable reproduction step is necessary.

@sxyazi sxyazi added the waiting on op Waiting for more information from the original poster label Jan 31, 2025
@Tyarel8
Copy link
Contributor Author

Tyarel8 commented Jan 31, 2025

You are right, this crashes probably don't have anything in common. I have experimented a little bit more, and it seems that random crash I was talking about happens when you search with fd in a directory and the search doesn't return empty (this always happens when there are no sub-directories, and only in some when there are sub-directories). For example, if I'm in ~/.cargo/bin and search for nu it will crash because I have nu plugins in there, but if I search for zxz it works normal and shows No items

Example: https://asciinema.org/a/nazAlKYw4OcDwEuJq0w7xWXpX

@github-actions github-actions bot removed the waiting on op Waiting for more information from the original poster label Jan 31, 2025
@Tyarel8 Tyarel8 changed the title Crash when plugin is missing Crash when searching with fd Jan 31, 2025
@Tyarel8
Copy link
Contributor Author

Tyarel8 commented Feb 2, 2025

Also happens when batch renaming files, even with no config

https://asciinema.org/a/EKNTQzjtXFgn2okaneFyNFgPE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants