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
49.59k stars 3.04k forks source link

Extremely high CPU usage #17970

Closed unitythemaker closed 1 month ago

unitythemaker commented 1 month ago

Check for existing issues

Describe the bug / provide steps to reproduce it

I had two different Go projects (windows) open in Zed for around 5-6 hours. Not very big projects but randomly my PC got very slow (while Zed was focused but I was just scrolling in the same code), I felt it then I checked htop and seen the below usage.

I am not sure but when this happened, I usually had a core file generated at the root of the project but this time it took too much time so I quit the editor and restarted and it got back to normal. Editor was not frozen but was just using high CPU.

I am unsure but this could be another issue. I get core files generated randomly almost in every project I open. The core files are usually around a few hundred MBs, I do think when this happens it slows my machine temporarily because of high I/O. I usually work on JavaScript (Nuxt) projects which this happens quite often, sometimes I see them in my Go projects but I never seen them in my Python projects (I usually don't code Python often though, just around an hour per week). This issue bothers me because I needed to add rm core in my Git hook to remove that big file before committing my changes.

I love Zed but I just want this issue to be gone. I want to help you by providing info and etc., guide me and I will try my best.

Environment

Zed: v0.152.3 (Zed) OS: Linux Wayland nixos 24.05 Memory: 62.6 GiB Architecture: x86_64 GPU: Intel(R) UHD Graphics (TGL GT1) || Intel open-source Mesa driver || Mesa 24.0.7

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

image

If applicable, attach your Zed.log file to this issue.

Zed.log
Logs above are from a few from around 30 minutes ago, a few from 3 hours ago and a few from 5 hours ago. They contain some sensitive information about the project, so not included. If needed, I can provide them by censoring them though.
...
2024-09-17T23:16:34.698209172+03:00 [INFO] starting language servers for JSON: json-language-server, package-version-server
2024-09-17T23:30:12.550724006+03:00 [ERROR] window not found
2024-09-17T23:30:12.550818567+03:00 [ERROR] window not found
2024-09-17T23:30:16.7206477+03:00 [ERROR] window not found
2024-09-17T23:30:16.720765934+03:00 [ERROR] window not found
2024-09-17T23:34:44.365168073+03:00 [INFO] ========== starting zed ==========
2024-09-17T23:34:44.3796823+03:00 [WARN] failed to load font 'SymbolsNFM'
2024-09-17T23:34:44.387571471+03:00 [WARN] failed to load font 'SymbolsNFM'
2024-09-17T23:34:44.396938967+03:00 [INFO] perform;
2024-09-17T23:34:44.396980133+03:00 [INFO] authenticate;
2024-09-17T23:34:44.397023489+03:00 [INFO] read_command;
2024-09-17T23:34:44.397067902+03:00 [INFO] Opening main db
2024-09-17T23:34:44.397467927+03:00 [INFO] new;
2024-09-17T23:34:44.397503581+03:00 [INFO] socket reader;
2024-09-17T23:34:44.397955346+03:00 [INFO] keep_updated;
2024-09-17T23:34:44.398373217+03:00 [INFO] Using git binary path: None
2024-09-17T23:34:44.418462099+03:00 [INFO] set environment variables from shell:/run/current-system/sw/bin/fish, path:/run/wrappers/bin:/usr/bin:/usr/sbin:/run/wrappers/bin:/home/unitythemaker/.nix-profile/bin:/nix/profile/bin:/home/unitythemaker/.local/state/nix/profile/bin:/etc/profiles/per-user/unitythemaker/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin
2024-09-17T23:34:44.423566331+03:00 [ERROR] No such file or directory (os error 2) about ["/home/unitythemaker/.config/github-copilot"]
2024-09-17T23:34:44.423726279+03:00 [INFO] initializing context server client
2024-09-17T23:34:44.42380303+03:00 [INFO] Registering built-in prompt template: content_prompt
2024-09-17T23:34:44.424050918+03:00 [INFO] Registering built-in prompt template: edit_workflow
2024-09-17T23:34:44.424240687+03:00 [INFO] Registering built-in prompt template: step_resolution
2024-09-17T23:34:44.424566434+03:00 [INFO] Registering built-in prompt template: terminal_assistant_prompt
2024-09-17T23:34:44.424711087+03:00 [INFO] No prompt template overrides directory found at /home/unitythemaker/.local/share/zed/prompt_overrides. Using built-in prompts.
2024-09-17T23:34:44.425105724+03:00 [INFO] extensions updated. loading 19, reloading 0, unloading 0
2024-09-17T23:34:44.42798418+03:00 [INFO] activate is not implemented on Linux, ignoring the call
2024-09-17T23:34:44.428063246+03:00 [INFO] Opening main db
2024-09-17T23:34:44.429657063+03:00 [INFO] perform;
2024-09-17T23:34:44.429697345+03:00 [INFO] authenticate;
2024-09-17T23:34:44.429735625+03:00 [INFO] read_command;
2024-09-17T23:34:44.430162206+03:00 [INFO] socket reader;
2024-09-17T23:34:44.431358899+03:00 [WARN] Theme "BlackFox" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-09-17T23:34:44.43493958+03:00 [INFO] building git repository, `.git` path in the worktree: ".git"
2024-09-17T23:34:44.435872892+03:00 [INFO] new;
2024-09-17T23:34:44.436565387+03:00 [INFO] keep_updated;
2024-09-17T23:34:44.47122837+03:00 [INFO] Enabling Vulkan Portability
2024-09-17T23:34:44.471290551+03:00 [INFO] Enabling color space support
2024-09-17T23:34:44.476755789+03:00 [ERROR] Error { code: -9, klass: 4, message: "reference 'refs/heads/main' not found" }
2024-09-17T23:34:44.486031076+03:00 [WARN] Theme "Material Dark" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-09-17T23:34:44.498618454+03:00 [WARN] Theme "One Dark Pro" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-09-17T23:34:44.504678369+03:00 [INFO] Adapter: "Intel(R) UHD Graphics (TGL GT1)"
2024-09-17T23:34:44.504737543+03:00 [INFO] Testing presentation capability on Linux/Intel
2024-09-17T23:34:44.507255683+03:00 [INFO] No ray tracing extensions are supported
2024-09-17T23:34:44.509441552+03:00 [INFO] Using surface present mode MAILBOX
2024-09-17T23:34:44.509675241+03:00 [WARN] Unable to forbid exclusive full screen
2024-09-17T23:34:44.509783791+03:00 [INFO] Creating a descriptor pool for at most 16 sets
2024-09-17T23:34:44.509826166+03:00 [INFO] Creating a descriptor pool for at most 16 sets
2024-09-17T23:34:44.509866012+03:00 [INFO] Initializing Blade pipelines for surface SurfaceInfo { format: Bgra8UnormSrgb, alpha: PreMultiplied }
2024-09-17T23:34:44.514615598+03:00 [INFO] Using GPU: GPUSpecs { is_software_emulated: false, device_name: "Intel(R) UHD Graphics (TGL GT1)", driver_name: "Intel open-source Mesa driver", driver_info: "Mesa 24.0.7" }
2024-09-17T23:34:44.515091944+03:00 [INFO] set status on client 0: Authenticating
2024-09-17T23:34:44.515371263+03:00 [INFO] perform;
2024-09-17T23:34:44.515424248+03:00 [INFO] authenticate;
2024-09-17T23:34:44.515466839+03:00 [INFO] read_command;
2024-09-17T23:34:44.515569834+03:00 [INFO] Opening main db
2024-09-17T23:34:44.516048317+03:00 [INFO] socket reader;
2024-09-17T23:34:44.520336525+03:00 [INFO] new;
2024-09-17T23:34:44.520840541+03:00 [INFO] keep_updated;
2024-09-17T23:34:44.523208198+03:00 [INFO] Opening main db
2024-09-17T23:34:44.524095033+03:00 [INFO] set status on client 156756: Connecting
2024-09-17T23:34:44.535821276+03:00 [INFO] perform;
2024-09-17T23:34:44.535892169+03:00 [INFO] authenticate;
2024-09-17T23:34:44.535951861+03:00 [INFO] read_command;
2024-09-17T23:34:44.536637026+03:00 [INFO] socket reader;
2024-09-17T23:34:44.540222368+03:00 [INFO] starting language servers for Go: gopls
2024-09-17T23:34:44.540276537+03:00 [INFO] starting language server "gopls", path: "/home/unitythemaker/proj/defencemore/one-click-audit-4-sap/one-click-audit-4-sap-java-checker-go", id: 1
2024-09-17T23:34:44.541400966+03:00 [INFO] starting language servers for Go: gopls
2024-09-17T23:34:44.541540111+03:00 [INFO] new;
2024-09-17T23:34:44.54222802+03:00 [INFO] keep_updated;
2024-09-17T23:34:44.542553697+03:00 [INFO] starting language servers for Go: gopls
2024-09-17T23:34:44.542669166+03:00 [INFO] starting language servers for Go: gopls
2024-09-17T23:34:44.542700414+03:00 [INFO] starting language servers for Go: gopls
2024-09-17T23:34:44.542729342+03:00 [INFO] starting language servers for Go: gopls
2024-09-17T23:34:44.545319979+03:00 [INFO] fetching latest version of language server "gopls"
2024-09-17T23:34:44.566213314+03:00 [INFO] Using surface present mode MAILBOX
2024-09-17T23:34:44.566512207+03:00 [WARN] Unable to forbid exclusive full screen
2024-09-17T23:34:44.592735599+03:00 [INFO] starting language servers for Go: gopls
2024-09-17T23:34:44.592798004+03:00 [INFO] starting language servers for Go: gopls
2024-09-17T23:34:44.592830279+03:00 [INFO] starting language servers for Go: gopls
2024-09-17T23:34:44.941220695+03:00 [WARN] unhandled message: Metadata(SupermavenMetadataMessage { dust_strings: None })
2024-09-17T23:34:45.101045922+03:00 [INFO] downloading language server "gopls"
2024-09-17T23:34:45.101389469+03:00 [INFO] using CLI environment for language server "gopls", id: 1
2024-09-17T23:34:45.101459102+03:00 [INFO] starting language server. binary path: "/home/unitythemaker/.local/share/zed/languages/gopls/gopls_0.16.2", working directory: "/home/unitythemaker/proj/defencemore/one-click-audit-4-sap/one-click-audit-4-sap-java-checker-go", args: ["-mode=stdio"]
2024-09-17T23:34:45.150387929+03:00 [INFO] connected to rpc endpoint https://collab.zed.dev/rpc
2024-09-17T23:34:45.227132612+03:00 [WARN] unhandled capability registration: Registration { id: "workspace/didChangeConfiguration", method: "workspace/didChangeConfiguration", register_options: None }
2024-09-17T23:34:45.644626483+03:00 [INFO] starting language servers for Go: gopls
2024-09-17T23:34:45.644683421+03:00 [INFO] starting language servers for Go: gopls
2024-09-17T23:34:45.644715409+03:00 [INFO] starting language servers for Go: gopls
2024-09-17T23:34:45.645993937+03:00 [WARN] unhandled message: Set(SupermavenSetMessage { key: "disabled", value: Bool(false) })
2024-09-17T23:34:45.714832135+03:00 [INFO] add connection to peer
2024-09-17T23:34:45.714880371+03:00 [INFO] add_connection;
2024-09-17T23:34:45.714913345+03:00 [INFO] waiting for server hello
2024-09-17T23:34:45.724471446+03:00 [INFO] got server hello
2024-09-17T23:34:45.724522798+03:00 [INFO] set status to connected (connection id: ConnectionId { owner_id: 0, id: 0 }, peer id: PeerId { owner_id: 540, id: 10373568 })
2024-09-17T23:34:45.72457497+03:00 [INFO] set status on client 156756: Connected { peer_id: PeerId { owner_id: 540, id: 10373568 }, connection_id: ConnectionId { owner_id: 0, id: 0 } }
2024-09-17T23:34:46.317726724+03:00 [INFO] Using surface present mode MAILBOX
2024-09-17T23:34:46.317988995+03:00 [WARN] Unable to forbid exclusive full screen
2024-09-17T23:34:46.650607381+03:00 [WARN] unhandled message: TaskStatus(SupermavenTaskUpdateMessage { task: "Initializing", status: Complete, percent_complete: None })
2024-09-17T23:34:46.650678797+03:00 [WARN] unhandled message: ActiveRepo(SupermavenActiveRepoMessage { repo_simple_name: None })
2024-09-17T23:34:52.413664077+03:00 [WARN] unhandled message: Popup(SupermavenPopupMessage { message: "We don't have an active payment method on file for your account. To use Supermaven Pro, please add a payment method.", actions: [OpenUrl { label: "Add payment method", url: "https://supermaven.com/account" }, NoOp { label: "Dismiss" }] })
taimast commented 1 month ago

Sometimes the same thing happened to me on Windows, when, for example, in the terminal inside zed, I run a program to generate a lot of files. I assume that in my case this is because zed starts to run indexing on every new file that is generated. I also have suspicions that the zed terminal is considered part of the ide program, so any resource-intensive program that runs in the terminal inside zed starts to slow it down.

unitythemaker commented 1 month ago

I need to investigate this further but it seems like core file is generated by node. I will try to get a core file while using other IDEs such as VSCode and see if it's a problem with Zed (more likely LSP) or node (code or one of the libraries).

unitythemaker commented 1 month ago

It is generated by a library I use. Not Zed related, closing.