zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
50.3k stars 3.1k forks source link

Zed Hangs when with many diagnostic errors #18300

Open notpeter opened 1 month ago

notpeter commented 1 month ago

Check for existing issues

Describe the bug / provide steps to reproduce it

Steps to reproduce:

  1. Download this json file
  2. Open it in Zed.
  3. Open the Diagnostics Panel
  4. Watch Zed hang with a beach ball for 2-3 minutes.

Bask in the glory that is a responsive Zed rendering a diagnostic panel with 23908 error (and 1 warning).

Note, this file is not properly format JSON, it has ' instead of ".

Screenshot 2024-09-24 at 16 06 48

Pathological json originally provided in: https://github.com/zed-industries/zed/issues/9639

Environment

Zed: v0.155.0 (Zed Nightly 2470db490115322720f85e2ad57e922de930ee1b) OS: macOS 14.7.0 Memory: 64 GiB Architecture: aarch64

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

2024-09-24T15:59:02.467904-04:00 [ERROR] Suspected hang on main thread:
zed[aeaadfcd382ca95a]::reliability::monitor_main_thread_hangs::handle_backtrace_signal::handle_sigusr2
__simple_esappend
<hashbrown[fc56c84cf2afd150]::raw::RawTable<(multi_buffer[6c8f0e62ba58a472]::ExcerptId, outline_panel[fc75351769cedc7c]::Excerpt)>>::reserve_rehash::<hashbrown[fc56c84cf2afd150]::map::make_hasher<multi_buffer[6c8f0e62ba58a472]::ExcerptId, outline_panel[fc75351769cedc7c]::Excerpt, core[f827f14b5e761a5d]::hash::BuildHasherDefault<rustc_hash[eb1a4c65225b5ee7]::FxHasher>>::{closure#0}>
<outline_panel[fc75351769cedc7c]::OutlinePanel>::update_fs_entries
<gpui[7c9659821f45890d]::window::ViewContext<outline_panel[fc75351769cedc7c]::OutlinePanel>>::subscribe::<editor[c9eec18573203624]::Editor, gpui[7c9659821f45890d]::view::View<editor[c9eec18573203624]::Editor>, editor[c9eec18573203624]::EditorEvent, outline_panel[fc75351769cedc7c]::subscribe_for_editor_events::{closure#0}>::{closure#0}
<gpui[7c9659821f45890d]::app::AppContext>::flush_effects
<diagnostics[5c4cfe90f6c541f2]::ProjectDiagnosticsEditor>::new_with_context::{closure#6}::{closure#0}
<async_task[3f1cb45a7eb7a0e6]::raw::RawTask<<async_task[3f1cb45a7eb7a0e6]::runnable::Builder<_>>::spawn_local::Checked<core[f827f14b5e761a5d]::pin::Pin<alloc[47bc6d386d7ae45f]::boxed::Box<dyn core[f827f14b5e761a5d]::future::future::Future<Output = core[f827f14b5e761a5d]::result::Result<(), anyhow[7235d837ddcd6144]::Error>>>>>, core[f827f14b5e761a5d]::result::Result<(), anyhow[7235d837ddcd6144]::Error>, <gpui[7c9659821f45890d]::executor::ForegroundExecutor>::spawn::inner<core[f827f14b5e761a5d]::result::Result<(), anyhow[7235d837ddcd6144]::Error>>::{closure#0}, ()>>::run
gpui[7c9659821f45890d]::platform::mac::dispatcher::trampoline
<gpui[7c9659821f45890d]::platform::mac::platform::MacPlatform as gpui[7c9659821f45890d]::platform::Platform>::run
<gpui[7c9659821f45890d]::app::App>::run::<zed[aeaadfcd382ca95a]::main::{closure#5}>
zed[aeaadfcd382ca95a]::main
std[4f7d7c3ef984657a]::sys::backtrace::__rust_begin_short_backtrace::<fn(), ()>
std[4f7d7c3ef984657a]::rt::lang_start::<()>::{closure#0}
std::rt::lang_start_internal::hdd117cb81a316264
_main
Petemir commented 1 month ago

The ability to exclude certain files from diagnostics would be nice, too.

For convenience (silly me), I added a big file that I did not want to be checked to a project and there was no way to exclude it from diagnostics, which would generate lots of unsolvable errors. I couldn't pass options to the Language Server to ignore/exclude the file; if I excluded the file from the project ("file_scan_exclusions" option) the LS would still check the file, and even changing the file type/extension (losing therefore any type of highlighting, structure, etc.) would still check the file somehow, spending lots of resources.

Edit: in the end, I think that setting the file as "plain text" may have worked, but it still is annoying not having any syntax highlighting.