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

Ruff extension: language server error #19408

Open
1 task done
Okroshiashvili opened this issue Oct 18, 2024 · 4 comments
Open
1 task done

Ruff extension: language server error #19408

Okroshiashvili opened this issue Oct 18, 2024 · 4 comments
Labels
bug [core label] language An umbrella label for all programming languages syntax behaviors panic / crash [core label] python Python programming language support

Comments

@Okroshiashvili
Copy link

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

I've opened the zed editor and got the following error:

Language server error: ruff

error while executing at wasm backtrace:
    0: 0x1373f - zed_ruff.wasm!rust_panic
    1: 0x13696 - zed_ruff.wasm!std::panicking::rust_panic_with_hook::h002a9d757cec9266
    2: 0x128df - zed_ruff.wasm!std::panicking::begin_panic_handler::{{closure}}::h5e11e16f0cbe0dd6
    3: 0x12850 - zed_ruff.wasm!std::sys::backtrace::__rust_end_short_backtrace::h34d7c06dcd4fe40d
    4: 0x12fec - zed_ruff.wasm!rust_begin_unwind
    5: 0x846e - zed_ruff.wasm!core::panicking::panic_fmt::h7e49d43cccf0228e
    6: 0x2fdb - zed_ruff.wasm!core::slice::index::slice_end_index_len_fail::hd4374c81ba7a2894
    7: 0x117d6 - zed_ruff.wasm!<std::sys::pal::wasi::fs::ReadDir as core::iter::traits::iterator::Iterator>::next::he4d4ac3f8ccdea64
    8: 0x14163 - zed_ruff.wasm!std::sys::pal::wasi::fs::remove_dir_all_recursive::hfeb30a9063e65819
    9: 0x13e5b - zed_ruff.wasm!std::sys::pal::wasi::fs::remove_dir_all::hd252435211c84e77
   10: 0x24fd0 - zed_ruff.wasm!<zed_ruff[3de5c4208a363a46]::RuffExtension as zed_extension_api[ddab9613c637baf]::Extension>::language_server_command
   11: 0x204ad - zed_ruff.wasm!language-server-command
   12: 0x2a59f - zed_ruff.wasm!language-server-command.command_export
-- stderr--

Environment

Zed: v0.157.5 (Zed)
OS: macOS 15.0.1
Memory: 8 GiB
Architecture: aarch64

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

Zed.log
[Zed.log](https://github.com/user-attachments/files/17430125/Zed.log)
@Okroshiashvili Okroshiashvili added admin read Pending admin review bug [core label] panic / crash [core label] triage Maintainer needs to classify the issue labels Oct 18, 2024
@bufke
Copy link

bufke commented Oct 18, 2024

For me, restarting zed worked around this.

@Okroshiashvili
Copy link
Author

Indeed, reloading Zed solved the issue

@jansol
Copy link
Contributor

jansol commented Oct 18, 2024

It's worth noting that the Zed extension requires a fairly recent version of ruff! IIRC something like 0.6.5 or newer.

@jansol jansol added the python Python programming language support label Oct 18, 2024
@JosephTLyons JosephTLyons added language An umbrella label for all programming languages syntax behaviors and removed triage Maintainer needs to classify the issue admin read Pending admin review labels Oct 18, 2024
@valentinegb
Copy link
Contributor

valentinegb commented Dec 10, 2024

Unsure if this is related, but I've experienced a number of strange problems with std::fs::remove_dir_all in all Zed extensions... mainly:

  • hanging forever on std::fs::remove_dir_all
    let entries = fs::read_dir(".")
        .map_err(|err| format!("failed to list working directory: {err}"))?;
    
    for entry in entries {
        let entry =
            entry.map_err(|err| format!("failed to load directory entry: {err}"))?;
    
        if entry.file_name().to_str() != Some(build_path) {
            if let Err(err) = fs::remove_dir_all(entry.path()) { // never moves past this point
                println!("failed to remove directory entry: {err}");
            }
        }
    }
  • when adding, I guess, too many dbg!()s, panicking with "range end index 403697798 out of range for slice of length 128"
    let entries = fs::read_dir(".")
        .map_err(|err| format!("failed to list working directory: {err}"))?;
    
    dbg!(&entries); // doesn't give useful information anyway, just literally "ReadDir(ReadDir { ... })"
    
    for entry in entries {
        let entry =
            entry.map_err(|err| format!("failed to load directory entry: {err}"))?;
    
        dbg!(&entry);
    
        if entry.file_name().to_str() != Some(build_path) {
            if let Err(err) = fs::remove_dir_all(entry.path()) { // crashes here
                println!("failed to remove directory entry: {err}");
            }
        }
    }
    [src/lib.rs:113:13] &entries = ReadDir(
        ReadDir { .. },
    )
    [src/lib.rs:119:17] &entry = DirEntry(
        "./jdt-language-server-1.37.0-202411281516",
    )
    thread '<unnamed>' panicked at std/src/sys/pal/wasi/fs.rs:192:33:
    range end index 403698206 out of range for slice of length 128
    stack backtrace:
    [2024-12-10T14:50:14-08:00 ERROR project::lsp_store] Failed to start language server "jdtls": error while executing at wasm backtrace:
        0: 0x27b2d - java.wasm!__rust_start_panic
        1: 0x26df1 - java.wasm!rust_panic
        2: 0x26dc4 - java.wasm!std::panicking::rust_panic_with_hook::h6218836d58f55410
        3: 0x26068 - java.wasm!std::panicking::begin_panic_handler::{{closure}}::hb41907dc51f329e9
        4: 0x25fd4 - java.wasm!std::sys::backtrace::__rust_end_short_backtrace::h8fafdd304e0bd069
        5: 0x26758 - java.wasm!rust_begin_unwind
        6: 0x3241d - java.wasm!core::panicking::panic_fmt::hc5404f01bc4f263a
        7: 0x2d6f2 - java.wasm!core::slice::index::slice_end_index_len_fail::h891c0a2a0c7782b3
        8: 0x23e90 - java.wasm!<std::sys::pal::wasi::fs::ReadDir as core::iter::traits::iterator::Iterator>::next::h585ba4990ab71437
        9: 0x277a5 - java.wasm!std::sys::pal::wasi::fs::remove_dir_all_recursive::h8cc6e40f46f2e50c
       10: 0x275c0 - java.wasm!std::sys::pal::wasi::fs::remove_dir_all_recursive::h8cc6e40f46f2e50c
       11: 0x275c0 - java.wasm!std::sys::pal::wasi::fs::remove_dir_all_recursive::h8cc6e40f46f2e50c
       12: 0x275c0 - java.wasm!std::sys::pal::wasi::fs::remove_dir_all_recursive::h8cc6e40f46f2e50c
       13: 0x275c0 - java.wasm!std::sys::pal::wasi::fs::remove_dir_all_recursive::h8cc6e40f46f2e50c
       14: 0x275c0 - java.wasm!std::sys::pal::wasi::fs::remove_dir_all_recursive::h8cc6e40f46f2e50c
       15: 0x27319 - java.wasm!std::sys::pal::wasi::fs::remove_dir_all::h0e59f7a669dcd931
       16: 0x997b - java.wasm!std::fs::remove_dir_all::h7f15e102a6f913f7
       17: 0x625a - java.wasm!<java::Java as zed_extension_api::Extension>::language_server_command::h09e323385b6ff04e
       18: 0xd251 - java.wasm!zed_extension_api::wit::_export_language_server_command_cabi::hfbac040a07d42066
       19: 0x1c3bb - java.wasm!language-server-command
       20: 0x3847b - java.wasm!language-server-command.command_export
    

Restarting appears to fix the problem because the extension will see that the latest version of its language server is installed and won't attempt to delete any older versions, however, the older versions are still there since they failed to be deleted. Again, this is a problem that I have experienced with all extensions which auto download language servers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug [core label] language An umbrella label for all programming languages syntax behaviors panic / crash [core label] python Python programming language support
Projects
None yet
Development

No branches or pull requests

5 participants