Open rnckp opened 2 months ago
Hi @rnckp. I'm sorry you're running into this.
Could you tell me a bit more about your workflow so that I can reproduce this issue?
@MichaReiser Thanks for your fast response!
Hmm interesting. I played around with a notebook, even with mixed languages but haven't been able to trigger the same panic.
Would you mind restarting VS code, open a notebook, and then open Output - Ruff. You should then see something similar to
2024-09-08 12:08:03.411 [info] Server: Stop requested
2024-09-08 12:08:04.375 [info] Name: Ruff
2024-09-08 12:08:04.375 [info] Module: ruff
2024-09-08 12:08:04.375 [info] Python extension loading
2024-09-08 12:08:04.375 [info] Waiting for interpreter from python extension.
2024-09-08 12:08:04.375 [info] Python extension loaded
2024-09-08 12:08:04.375 [info] Using interpreter: /Users/micha/astral/test/.venv/bin/python
2024-09-08 12:08:04.375 [info] Using 'path' setting: /Users/micha/astral/ruff/target/debug/ruff
2024-09-08 12:08:04.386 [info] Resolved 'ruff.nativeServer: auto' to use the native server
2024-09-08 12:08:04.387 [info] Found Ruff 0.6.4 at /Users/micha/astral/ruff/target/debug/ruff
2024-09-08 12:08:04.387 [info] Server run command: /Users/micha/astral/ruff/target/debug/ruff server
Could you share the log with me? I'm specifically interested in the ruff version.
Sure!
What I notice is that the used interpreter is the homebrew one. However, I use miniconda environments for all my projects. These are also the kernels that I always select when I start working in the notebooks.
2024-09-08 12:18:40.977 [info] Name: Ruff
2024-09-08 12:18:40.977 [info] Module: ruff
2024-09-08 12:18:40.977 [info] Python extension loading
2024-09-08 12:18:40.977 [info] Waiting for interpreter from python extension.
2024-09-08 12:18:40.977 [info] Python extension loaded
2024-09-08 12:18:40.977 [info] Using interpreter: /opt/homebrew/bin/python3
2024-09-08 12:18:40.977 [info] Falling back to bundled executable: /Users/teamdata/.vscode/extensions/charliermarsh.ruff-2024.44.0-darwin-arm64/bundled/libs/bin/ruff
2024-09-08 12:18:40.977 [info] Resolved 'ruff.nativeServer: auto' to use the native server
2024-09-08 12:18:40.977 [info] Found Ruff 0.6.4 at /Users/teamdata/.vscode/extensions/charliermarsh.ruff-2024.44.0-darwin-arm64/bundled/libs/bin/ruff
2024-09-08 12:18:40.977 [info] Server run command: /Users/teamdata/.vscode/extensions/charliermarsh.ruff-2024.44.0-darwin-arm64/bundled/libs/bin/ruff server
2024-09-08 12:18:40.977 [info] Server: Start requested.
Thanks. Hmm. this looks all good... Maybe @dhruvmanila has an idea? It might take him a few days to reply because he's currently traveling.
What I notice is that the used interpreter is the homebrew one. However, I use miniconda environments for all my projects. These are also the kernels that I always select when I start working in the notebooks.
Is the environment activated when you start VS Code? Regardless, the panic that you're facing doesn't seem to be related to the selected interpreter. Are you able to share the notebook where you're facing this panic? I can play around with that and try to reproduce it myself.
Thanks @dhruvmanila
I do activate the environment when I start working in the notebook. When I execute the first cell, VS Code let me select the environment and I choose from my miniconda environments.
I will have a look at the notebook tonight and see if I can share it.
I do activate the environment when I start working in the notebook. When I execute the first cell, VS Code let me select the environment and I choose from my miniconda environments.
The extension should probably restart if a user changes the interpreter which should result in Ruff selecting the correct interpreter.
I will have a look at the notebook tonight and see if I can share it.
Thanks, that should be helpful.
Is there a way I could share the notebook directly with you, e.g. email?
New logs from a different notebook where I observe the server panics.
2024-09-10 12:24:26.515 [info] 1: ruff_server::server::Server::run::{{closure}}
2: std::panicking::rust_panic_with_hook
3: std::panicking::begin_panic_handler::{{closure}}
4: std::sys_common::backtrace::__rust_end_short_backtrace
5: _rust_begin_unwind
6: core::panicking::panic_fmt
7: core::option::expect_failed
8: <ruff_server::server::api::requests::hover::Hover as ruff_server::server::api::traits::BackgroundDocumentRequestHandler>::run_with_snapshot
9: core::ops::function::FnOnce::call_once{{vtable.shim}}
10: core::ops::function::FnOnce::call_once{{vtable.shim}}
11: std::sys_common::backtrace::__rust_begin_short_backtrace
12: core::ops::function::FnOnce::call_once{{vtable.shim}}
13: std::sys::pal::unix::thread::Thread::new::thread_start
14: __pthread_joiner_wake
2024-09-10 12:25:07.783 [info] panicked at crates/ruff_source_file/src/line_index.rs:176:13:
index out of bounds: the len is 1 but the index is 6
2024-09-10 12:25:07.783 [info] 0: std::backtrace::Backtrace::create
1: ruff_server::server::Server::run::{{closure}}
2: std::panicking::rust_panic_with_hook
3: std::panicking::begin_panic_handler::{{closure}}
4: std::sys_common::backtrace::__rust_end_short_backtrace
5: _rust_begin_unwind
6: core::panicking::panic_fmt
7: core::panicking::panic_bounds_check
8: ruff_source_file::line_index::LineIndex::line_range
9: <ruff_server::server::api::requests::hover::Hover as ruff_server::server::api::traits::BackgroundDocumentRequestHandler>::run_with_snapshot
10: core::ops::function::FnOnce::call_once{{vtable.shim}}
11: core::ops::function::FnOnce::call_once{{vtable.shim}}
12: std::sys_common::backtrace::__rust_begin_short_backtrace
13: core::ops::function::FnOnce::call_once{{vtable.shim}}
2024-09-10 12:25:07.783 [info] 14: std::sys::pal::unix::thread::Thread::new::thread_start
15: __pthread_joiner_wake
Is there a way I could share the notebook directly with you, e.g. email?
Are you on discord? I'm 'dhruvmanila' or you can email me at "[GitHub username] at gmail".
I have sent two sample notebooks via email.
I also noticed that the crashes occur on a different computer too (Mac mini M1 2020, Sonoma 14.6.1). VS Code is 1.93.0, Ruff v2024.46.0.
Thanks, I tested it against the provided notebooks and I can't seem to reproduce the panic :(
Are you able to reproduce it consistently? Can you provide the steps you took which leads to the panic? Or, record a video that reproduces it? Whatever is easier for you.
Thanks for testing and looking into this issue!
Unfortunately I am not able to reproduce it consistently. However, when it appears, than the server usually crashes again and again. I will try to record a video and send this to you. This might take until Friday or the weekend.
Yeah, no worries.
Hi, When I used the miniconda environment on Pi5 and used vscode remote programming, similar problems also occurred... The log is as follows
2024-09-27 13:11:24.465 [info] Name: Ruff
2024-09-27 13:11:24.465 [info] Module: ruff
2024-09-27 13:11:24.465 [info] Python extension loading
2024-09-27 13:11:24.465 [info] Waiting for interpreter from python extension.
2024-09-27 13:11:24.465 [info] Python extension loaded
2024-09-27 13:11:24.465 [info] Using interpreter: /bin/python3
2024-09-27 13:11:24.506 [info] Falling back to bundled executable: /home/spark/.vscode-server/extensions/charliermarsh.ruff-2024.50.0-linux-arm64/bundled/libs/bin/ruff
2024-09-27 13:11:24.527 [info] Found Ruff 0.6.6 at /home/spark/.vscode-server/extensions/charliermarsh.ruff-2024.50.0-linux-arm64/bundled/libs/bin/ruff
2024-09-27 13:11:24.527 [info] Server run command: /home/spark/.vscode-server/extensions/charliermarsh.ruff-2024.50.0-linux-arm64/bundled/libs/bin/ruff server
2024-09-27 13:11:24.529 [info] Server: Start requested.
2024-09-27 13:13:14.564 [info] panicked at crates/ruff_server/src/server/api/requests/hover.rs:36:10:
hover should only be called on text documents or notebook cells
2024-09-27 13:13:14.658 [info] 0: std::backtrace::Backtrace::create
1: ruff_server::server::Server::run::{{closure}}
2
2024-09-27 13:13:14.658 [info] : std::panicking::rust_panic_with_hook
3: std::panicking::begin_panic_handler::{{closure}}
4: std::sys::backtrace::__rust_end_short_backtrace
5: rust_begin_unwind
6: core::panicking::panic_fmt
7: core::option::expect_failed
8: <ruff_server::server::api::requests::hover::Hover as ruff_server::server::api::traits::BackgroundDocumentRequestHandler>::run_with_snapshot
9: core::ops::function::FnOnce::call_once{{vtable.shim}}
10: core::ops::function::FnOnce::call_once{{vtable.shim}}
11: std::sys::backtrace::__rust_begin_short_backtrace
12: core::ops::function::FnOnce::call_once{{vtable.shim}}
13: std::sys::pal::unix::thread::Thread::new::thread_start
14: start_thread
at ./nptl/pthread_create.c:447:8
15: thread_start
at ./misc/../sysdeps/unix/sysv/linux/aarch64/clone3.S:76
2024-09-27 13:13:15.212 [info] panicked at crates/ruff_server/src/server/api/requests/hover.rs:36:10:
hover should only be called on text documents or notebook cells
2024-09-27 13:13:15.212 [info] 0: std::backtrace::Backtrace::create
1: ruff_server::server::Server::run::{{closure}}
2: std::panicking::rust_panic_with_hook
3: std::panicking::begin_panic_handler::{{closure}}
4: std::sys::backtrace::__rust_end_short_backtrace
5: rust_begin_unwind
6: core::panicking::panic_fmt
7: core::option::expect_failed
8: <ruff_server::server::api::requests::hover::Hover as ruff_server::server::api::traits::BackgroundDocumentRequestHandler>::run_with_snapshot
9: core::ops::function::FnOnce::call_once{{vtable.shim}}
2024-09-27 13:13:15.213 [info] 10: core::ops::function::FnOnce::call_once{{vtable.shim}}
11: std::sys::backtrace::__rust_begin_short_backtrace
12: core::ops::function::FnOnce::call_once{{vtable.shim}}
13: std::sys::pal::unix::thread::Thread::new::thread_start
14: start_thread
at ./nptl/pthread_create.c:447:8
15: thread_start
at ./misc/../sysdeps/unix/sysv/linux/aarch64/clone3.S:76
@dhruvmanila I could record some server panics. I have sent this to you by mail.
PS: I have the feeling that the server crashes are more probable if I have more and longer text print outs in a notebook or more larger text or markdown documents in my VS Code workspace. Just a hunch. I cannot reliably confirm this.
@rnckp Thanks! I'll look into it this week
@dhruvmanila I have added two more screen recordings to the Google Drive folder with the respective notebook where the crashes occur.
@rnckp The text_simplification.ipynb
file is empty in the folder.
@dhruvmanila Sorry about that. I just fixed it and uploaded the proper file.
Can you provide the Ruff config that you're using? I see that in the video some of the cells are giving diagnostics but it's not doing the same for me. Also, the Ruff version and extension version that is being used.
Nevermind, you've provided it in the issue description.
I'm a bit confused, the pyproject.toml
that you've provided is same as the one in ruff-vscode
repository at https://github.com/astral-sh/ruff-vscode/blob/main/pyproject.toml, is that expected?
@dhruvmanila I use this pyproject.toml
to include jupyter notebooks in the Ruff formatting by default per my settings. I placed it at the top level of all my git repos that I generally open in VS Code.
However, for the last tests that I did where I recorded the videos I only had opened one single repo in VS Code (not the entirety of all repos/projects). Therefore I think the .toml
didn't have any effect.
Hi @rnckp, thank you for your patience and open to sharing all the relevant details for us to debug the issue. Although, we're still unable to reproduce this on our end :(
There are couple of things we can try:
ruff.trace.server
to verbose
and ruff.logLevel
to debug
.ruff
which logs additional messages that might be relevant to the panic that you're getting.Let's start with (1) and if that can help figure out the root cause otherwise we can collaborate on (2) if that's feasible from your end (totally fine if not).
@dhruvmanila Thanks again for looking into it! I appreciate that.
Suggestion 1 should be easy. Let's start with that. I will mail you results when I do a next coding session (~ until beginning of next week).
@rnckp Just following up on whether you had the chance to generate detailed logs, no need to rush :)
@dhruvmanila I am still observing and will log the data once the opportunity arises.
I observe frequent server panic exits with no appearant reason. What can I do to fix this?
Note: I do not drag any cells. So this does not seem related to #575
Minimal code snippet I do not invoke specific commands or cells. I observe the crashes throughout various of my projects in VS Code.
Settings settings.zip
Versions VS Code 1.93.0 Ruff extension v2024.44.0 (Auto Update active)
Environment MacBook Pro 16'' 2023, Apple M2 Max, 64GB MacOS Sonoma 14.6.1
Panic logs