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
46.46k stars 2.63k forks source link

Very large workspaces cause actions (open / save / close files) to hang. #11535

Closed paperdave closed 2 weeks ago

paperdave commented 4 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

  1. Clone WebKit/WebKit from GitHub
  2. Try to mess around with the files. Perform searches, try to edit files.

Environment

Zed: v0.133.7 (Zed) OS: macOS 13.6.2 Memory: 64 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

https://github.com/zed-industries/zed/assets/24465214/840b16ec-f47f-4c69-b0a0-d3d54b0a8219

This is a huge step up from my last "zed is slow" issue, where opening this or Bun just hung the entire editor, not even able to view tree items. It's overall pretty responsive, but some actions can hang a few seconds.

I think sometimes it's possible to start search queries that end up blocking other UI actions, even if you attempt to cancel the search or move your focus away from it.

WebKit also contains a lot of C++, JS, Python, Ruby, and I think even some Rust code. I've noticed in other sessions that performing searches ends up starting these language servers just for the previews.

Since WebKit is a submodule inside of Bun, sometimes the Bun workspace itself gets a little laggy, perhaps due to what is in WebKit.

I think my proper solution is to exclude WebKit and related paths in my config, but I think it is still worth considering that having a very heavy workspace impacts UI actions that should be given higher priority. Opening and closing files should always be instant.

[also, i do want to say that i really love how this editor has been feeling and performing in the 90% case. its amazing, the above is an important outlier]

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

2024-05-08T00:07:04-07:00 [INFO] ========== starting zed ==========
2024-05-08T00:07:04-07:00 [INFO] Opening main db
2024-05-08T00:07:04-07:00 [INFO] Using git binary path: Some("/Applications/Zed.app/Contents/MacOS/git")
2024-05-08T00:07:04-07:00 [INFO] set environment variables from shell:/opt/homebrew/bin/fish, path:/opt/homebrew/bin:/opt/homebrew/opt/coreutils/libexec/gnubin:/opt/homebrew/opt/findutils/libexec/gnubin:/opt/homebrew/opt/gawk/libexec/gnubin:/opt/homebrew/opt/gnu-sed/libexec/gnubin:/opt/homebrew/opt/inetutils/libexec/gnubin:/opt/homebrew/opt/libtool/libexec/gnubin:/opt/homebrew/opt/make/libexec/gnubin:/bin:/sbin:/usr/local/bin:/opt/homebrew/opt/node@21/bin:/opt/homebrew/opt/llvm@16/bin:/opt/homebrew/opt/coreutils/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/usr/sbin:/Users/dave/code/bun/packages/debug-bun-darwin-aarch64:/Users/dave/code/bun/build:/Users/dave/.bun/bin:/Users/dave/.cargo/bin:/Users/dave/.deno/bin:/Users/dave/.zig/bin:/Users/dave/code/zls/zig-out/bin:/Users/dave/code/config/bin:/Users/dave/code/paperdave.net/bin:/nix/var/nix/profiles/default/bin
2024-05-08T00:07:05-07:00 [INFO] extensions updated. loading 13, reloading 0, unloading 0
2024-05-08T00:07:05-07:00 [INFO] Opening main db
2024-05-08T00:07:05-07:00 [INFO] building git repository, `.git` path in the worktree: ".git"
2024-05-08T00:07:05-07:00 [INFO] set status on client 0: Authenticating
2024-05-08T00:07:05-07:00 [INFO] Opening main db
2024-05-08T00:07:05-07:00 [INFO] Opening main db
2024-05-08T00:07:05-07:00 [INFO] set status on client 82438: Connecting
2024-05-08T00:07:05-07:00 [INFO] connected to rpc endpoint https://collab.zed.dev/rpc
2024-05-08T00:07:05-07:00 [INFO] add connection to peer
2024-05-08T00:07:05-07:00 [INFO] add_connection;
2024-05-08T00:07:05-07:00 [INFO] waiting for server hello
2024-05-08T00:07:05-07:00 [INFO] got server hello
2024-05-08T00:07:05-07:00 [INFO] set status to connected (connection id: ConnectionId { owner_id: 0, id: 0 }, peer id: PeerId { owner_id: 402, id: 2115627 })
2024-05-08T00:07:05-07:00 [INFO] set status on client 82438: Connected { peer_id: PeerId { owner_id: 402, id: 2115627 }, connection_id: ConnectionId { owner_id: 0, id: 0 } }
2024-05-08T00:07:06-07:00 [ERROR] crates/workspace/src/persistence/model.rs:314: No path stored for this editor
2024-05-08T00:07:06-07:00 [INFO] starting language servers for C++: clangd
2024-05-08T00:07:06-07:00 [INFO] starting language server "clangd", path: "/Users/dave/code/bun/src/bun.js/WebKit", id: 1
2024-05-08T00:07:06-07:00 [INFO] starting language servers for C++: clangd
2024-05-08T00:07:06-07:00 [INFO] starting language servers for C++: clangd
2024-05-08T00:07:06-07:00 [INFO] starting language servers for C++: clangd
2024-05-08T00:07:06-07:00 [INFO] starting language servers for C++: clangd
2024-05-08T00:07:06-07:00 [INFO] starting language servers for C++: clangd
2024-05-08T00:07:06-07:00 [INFO] starting language servers for C++: clangd
2024-05-08T00:07:06-07:00 [INFO] starting language servers for C++: clangd
2024-05-08T00:07:06-07:00 [INFO] starting language servers for C++: clangd
2024-05-08T00:07:06-07:00 [INFO] starting language servers for C++: clangd
2024-05-08T00:07:06-07:00 [INFO] starting language servers for C++: clangd
2024-05-08T00:07:06-07:00 [INFO] starting language servers for C++: clangd
2024-05-08T00:07:06-07:00 [INFO] starting language servers for C++: clangd
2024-05-08T00:07:06-07:00 [INFO] starting language servers for C++: clangd
2024-05-08T00:07:06-07:00 [INFO] found user-installed language server for C++. path: "/opt/homebrew/opt/llvm@16/bin/clangd", arguments: []
2024-05-08T00:07:06-07:00 [INFO] starting language server. binary path: "/opt/homebrew/opt/llvm@16/bin/clangd", working directory: "/Users/dave/code/bun/src/bun.js/WebKit", args: []
2024-05-08T00:07:06-07:00 [ERROR] crates/project/src/project.rs:3339: no worktree found for diagnostics path "/Users/dave/code/bun/.clangd"
2024-05-08T00:07:22-07:00 [INFO] starting language servers for C++: clangd
2024-05-08T00:07:22-07:00 [INFO] starting language servers for C++: clangd
2024-05-08T00:07:26-07:00 [WARN] Generic lsp request to clangd failed: Request cancelled because the document was modified
2024-05-08T00:07:26-07:00 [ERROR] crates/editor/src/editor.rs:3876: Request cancelled because the document was modified
2024-05-08T00:07:30-07:00 [WARN] Generic lsp request to clangd failed: Request cancelled because the document was modified
2024-05-08T00:07:30-07:00 [ERROR] crates/editor/src/editor.rs:3876: Request cancelled because the document was modified
2024-05-08T00:07:35-07:00 [INFO] starting language servers for C++: clangd
2024-05-08T00:07:35-07:00 [INFO] starting language servers for C++: clangd
2024-05-08T00:07:35-07:00 [INFO] starting language servers for C++: clangd
2024-05-08T00:07:35-07:00 [ERROR] crates/project/src/project.rs:3339: no worktree found for diagnostics path "/Users/dave/code/bun/build/bun-webkit/include/wtf/Compiler.h"
2024-05-08T00:07:52-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:52-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:52-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:52-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:52-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:52-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:52-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:52-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:52-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:52-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:52-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:52-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:52-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:52-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:52-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:52-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:52-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:52-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:52-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:52-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:52-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:53-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:53-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:53-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:53-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:53-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:53-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:53-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:53-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:53-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:53-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:53-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:53-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:53-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:53-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:53-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:53-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:53-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:53-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:53-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:53-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:53-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:53-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:53-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:07:53-07:00 [ERROR] unexpected item event after pane was dropped
2024-05-08T00:09:55-07:00 [INFO] open paths ["/Users/dave/Library/Logs/Zed/Zed.log"]

I suspect unexpected item after pane was dropped was me spamming Cmd+W and :wq queueing up actions.

paperdave commented 4 months ago

today i just hit this again when opening bun today. my workspace is soft-locked. restarting the editor seems to fix it.

paperdave commented 4 months ago

part of my issue is #7195 (stuff seems to be more stable when excluding large folders), but this still shouldnt cause hangups in the editor

szlend commented 3 months ago

I noticed a git process stuck at 100% CPU usage owned by zed when this happens. As soon as I kill it, the UI becomes responsive again.

It's trying to git blame a large (41k line) file from https://github.com/NixOS/nixpkgs

git blame --incremental --contents - pkgs/top-level/all-packages.nix

Edit: Disabling inline_blame works around this issue (after restarting the editor).

notpeter commented 2 weeks ago

Closing in favor of:

Please 👍 over there.