High CPU on Intel Mac (1000%+) - Python Language Server?
Check for existing issues
- [X] Completed
Describe the bug / provide steps to reproduce it
Zed seems to be incredibly resource hungry when dealing with a reasonably sized Python FastAPI app. CPU usage is constantly bursting to well over 1000% as indicated by iStatMenus and Activity Monitor and editor slows to a crawl.
It only occurs when Zed starts and looking at the logs, appears to be when the language server is doing it's thing. Not sure where to start debugging here, but something definitely doesn't seem right unless Zed is trying to help me Sous Vide my thighs with my MBP.
Zed Version and System Specs
Zed: v0.166.1 (Zed) OS: macOS 15.1.1 Memory: 64 GiB Architecture: x86_64
If applicable, add screenshots or screencasts of the incorrect state / behavior
If applicable, attach your Zed.log file to this issue.
Zed.log
Last login: Thu Dec 26 11:54:09 on ttys000
cat ~/Library/Logs/Zed/Zed.log%
~ cat ~/Library/Logs/Zed/Zed.log | pbcopy
~ tail -f ~/Library/Logs/Zed/Zed.log
"schemaUri": "https://json.schemastore.org/fly.json",
"meta": {
"name": "fly.io Configuration",
"description": "fly.io, a cloud provider, configuration",
"source": "catalog",
"catalog_url": "https://www.schemastore.org/api/json/catalog.json"
}
}
2024-12-26T11:54:09.894089+11:00 [INFO] language server 2: unregistered workspace/DidChangeWatchedFiles capability with id e06c5304-d19e-4a85-b140-fdd4af17689c
2024-12-26T11:55:11.270744+11:00 [INFO] Initializing default prettier with plugins {}
2024-12-26T12:07:02.373237+11:00 [INFO] attempting to start language server "pylsp", path: "/Users/aturner/Library/Application Support/Zed/languages/pyright/node_modules/pyright/dist/typeshed-fallback/stubs/requests/requests/api.pyi", id: 11
2024-12-26T12:07:02.391986+11:00 [INFO] starting language server process. binary path: "/Users/aturner/Library/Application Support/Zed/languages/pylsp/pylsp-venv/bin/pylsp", working directory: "/Users/aturner/Library/Application Support/Zed/languages/pyright/node_modules/pyright/dist/typeshed-fallback/stubs/requests/requests", args: []
2024-12-26T12:07:02.420279+11:00 [WARN] skipping diagnostics update, no worktree found for path "/Users/aturner/Library/Application Support/Zed/languages/pyright/node_modules/pyright/dist/typeshed-fallback/stubs/requests/requests/api.pyi"
2024-12-26T12:07:02.437867+11:00 [WARN] skipping diagnostics update, no worktree found for path "/Users/aturner/Library/Application Support/Zed/languages/pyright/node_modules/pyright/dist/typeshed-fallback/stubs/requests/requests/api.pyi"
2024-12-26T12:07:02.438289+11:00 [ERROR] oneshot canceled
2024-12-26T12:07:04.611584+11:00 [INFO] attempting to start language server "pylsp", path: "/Users/aturner/Library/Application Support/Zed/languages/pyright/node_modules/pyright/dist/typeshed-fallback/stubs/requests/requests/api.pyi", id: 12
2024-12-26T12:07:04.627677+11:00 [INFO] starting language server process. binary path: "/Users/aturner/Library/Application Support/Zed/languages/pylsp/pylsp-venv/bin/pylsp", working directory: "/Users/aturner/Library/Application Support/Zed/languages/pyright/node_modules/pyright/dist/typeshed-fallback/stubs/requests/requests", args: []
2024-12-26T12:07:04.711121+11:00 [WARN] skipping diagnostics update, no worktree found for path "/Users/aturner/Library/Application Support/Zed/languages/pyright/node_modules/pyright/dist/typeshed-fallback/stubs/requests/requests/api.pyi"
2024-12-26T12:07:04.74319+11:00 [ERROR] oneshot canceled
2024-12-26T12:10:07.620726+11:00 [INFO] attempting to start language server "pylsp", path: "/Users/aturner/Library/Application Support/Zed/languages/pyright/node_modules/pyright/dist/typeshed-fallback/stubs/requests/requests/models.pyi", id: 13
2024-12-26T12:10:07.621222+11:00 [INFO] starting language server process. binary path: "/Users/aturner/Library/Application Support/Zed/languages/pylsp/pylsp-venv/bin/pylsp", working directory: "/Users/aturner/Library/Application Support/Zed/languages/pyright/node_modules/pyright/dist/typeshed-fallback/stubs/requests/requests", args: []
2024-12-26T12:10:07.653307+11:00 [ERROR] oneshot canceled
2024-12-26T12:10:07.653753+11:00 [ERROR] oneshot canceled
2024-12-26T12:10:07.654124+11:00 [ERROR] oneshot canceled
2024-12-26T12:10:07.65446+11:00 [ERROR] oneshot canceled
2024-12-26T12:10:07.654754+11:00 [ERROR] oneshot canceled
2024-12-26T12:10:07.6551+11:00 [ERROR] oneshot canceled
2024-12-26T12:10:07.655432+11:00 [ERROR] oneshot canceled
2024-12-26T12:10:07.655771+11:00 [ERROR] oneshot canceled
2024-12-26T12:10:07.656144+11:00 [ERROR] oneshot canceled
2024-12-26T12:10:07.656524+11:00 [ERROR] oneshot canceled
2024-12-26T12:10:07.753618+11:00 [ERROR] timed out waiting on app_will_quit
2024-12-26T12:10:11.525937+11:00 [INFO] ========== starting zed ==========
2024-12-26T12:10:11.61998+11:00 [INFO] Opening main db
2024-12-26T12:10:11.621426+11:00 [INFO] Opening main db
2024-12-26T12:10:11.844626+11:00 [INFO] Using git binary path: Some("/Applications/Zed.app/Contents/MacOS/git")
2024-12-26T12:10:12.304861+11:00 [ERROR] theme not found: Tokyo Night Storm
2024-12-26T12:10:12.306479+11:00 [INFO] No prompt template overrides directory found at /Users/aturner/.config/zed/prompt_overrides. Using built-in prompts.
2024-12-26T12:10:12.308174+11:00 [INFO] extensions updated. loading 10, reloading 0, unloading 0
2024-12-26T12:10:12.412796+11:00 [INFO] Opening main db
2024-12-26T12:10:12.424595+11:00 [ERROR] theme not found: Tokyo Night Storm
2024-12-26T12:10:12.428281+11:00 [ERROR] theme not found: Tokyo Night Storm
2024-12-26T12:10:12.429766+11:00 [INFO] building git repository, `.git` path in the worktree: ".git"
2024-12-26T12:10:12.430747+11:00 [ERROR] theme not found: Tokyo Night Storm
2024-12-26T12:10:12.479147+11:00 [INFO] Opening main db
2024-12-26T12:10:12.486679+11:00 [INFO] set status on client 0: Authenticating
2024-12-26T12:10:12.488509+11:00 [INFO] open paths ["/Users/aturner/Downloads/quote-response.json"]
2024-12-26T12:10:12.489159+11:00 [INFO] Opening main db
2024-12-26T12:10:12.493839+11:00 [INFO] open paths ["/Users/aturner/.config/zed/settings.json"]
2024-12-26T12:10:12.496157+11:00 [INFO] set status on client 241075: Connecting
2024-12-26T12:10:12.581953+11:00 [ERROR] buffer has no file
2024-12-26T12:10:12.582156+11:00 [ERROR] buffer has no file
2024-12-26T12:10:12.582297+11:00 [ERROR] buffer has no file
2024-12-26T12:10:12.582443+11:00 [ERROR] buffer has no file
2024-12-26T12:10:12.590538+11:00 [INFO] Opening main db
2024-12-26T12:10:12.611269+11:00 [INFO] attempting to start language server "json-language-server", path: "/Users/aturner/Code/go/src/github.com/qdynamicsco/circuitwise-obo", id: 1
2024-12-26T12:10:12.611555+11:00 [INFO] Initializing default prettier with plugins {}
2024-12-26T12:10:12.613243+11:00 [INFO] attempting to start language server "package-version-server", path: "/Users/aturner/Code/go/src/github.com/qdynamicsco/circuitwise-obo", id: 2
2024-12-26T12:10:12.613474+11:00 [INFO] Initializing default prettier with plugins {}
2024-12-26T12:10:12.614056+11:00 [INFO] Initializing default prettier with plugins {}
2024-12-26T12:10:12.616652+11:00 [INFO] fetching latest version of language server "json-language-server"
2024-12-26T12:10:12.617049+11:00 [INFO] Node runtime install_if_needed
2024-12-26T12:10:12.64814+11:00 [INFO] fetching latest version of language server "package-version-server"
2024-12-26T12:10:12.670159+11:00 [INFO] attempting to start language server "pyright", path: "/Users/aturner/Code/go/src/github.com/qdynamicsco/circuitwise-obo", id: 3
2024-12-26T12:10:12.670383+11:00 [INFO] attempting to start language server "pylsp", path: "/Users/aturner/Code/go/src/github.com/qdynamicsco/circuitwise-obo", id: 4
2024-12-26T12:10:12.67334+11:00 [INFO] attempting to start language server "yaml-language-server", path: "/Users/aturner/Code/go/src/github.com/qdynamicsco/circuitwise-obo", id: 5
2024-12-26T12:10:12.673571+11:00 [INFO] Initializing default prettier with plugins {}
2024-12-26T12:10:12.696709+11:00 [INFO] Initializing default prettier with plugins {}
2024-12-26T12:10:12.706713+11:00 [INFO] Initializing default prettier with plugins {}
2024-12-26T12:10:12.707713+11:00 [INFO] fetching latest version of language server "pylsp"
2024-12-26T12:10:12.707892+11:00 [INFO] downloading language server "pylsp"
2024-12-26T12:10:12.708104+11:00 [INFO] fetching latest version of language server "yaml-language-server"
2024-12-26T12:10:12.710909+11:00 [INFO] attempting to start language server "json-language-server", path: "/Users/aturner/.config/zed/settings.json", id: 6
2024-12-26T12:10:12.711142+11:00 [INFO] Initializing default prettier with plugins {}
2024-12-26T12:10:12.721606+11:00 [INFO] Initializing default prettier with plugins {}
2024-12-26T12:10:12.721897+11:00 [INFO] Initializing default prettier with plugins {}
2024-12-26T12:10:12.728872+11:00 [INFO] set environment variables from shell:/bin/zsh, path:/Users/aturner/miniconda3/condabin:/usr/local/opt/ruby/bin:/usr/local/opt/[email protected]/libexec/bin:/Applications/Sublime Text.app/Contents/SharedSupport/bin:/usr/local/bin:/usr/local/sbin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/MacGPG2/bin:/usr/local/go/bin:/Applications/Visual Studio Code.app/Contents/Resources/app/bin:/bin:/Users/aturner/Code/go/bin:/Users/aturner/.rvm/bin
2024-12-26T12:10:12.734036+11:00 [INFO] attempting to start language server "json-language-server", path: "/Users/aturner/Downloads/quote-response.json", id: 7
2024-12-26T12:10:12.734274+11:00 [INFO] attempting to start language server "package-version-server", path: "/Users/aturner/Downloads/quote-response.json", id: 8
2024-12-26T12:10:12.734485+11:00 [INFO] Initializing default prettier with plugins {}
2024-12-26T12:10:12.734709+11:00 [INFO] fetching latest version of language server "json-language-server"
2024-12-26T12:10:12.797408+11:00 [INFO] connected to rpc endpoint https://collab.zed.dev/rpc
2024-12-26T12:10:13.248205+11:00 [INFO] downloading language server "package-version-server"
2024-12-26T12:10:13.807402+11:00 [INFO] using project environment variables shell launched in "/Users/aturner/Code/go/src/github.com/qdynamicsco/circuitwise-obo". PATH="/Users/aturner/miniconda3/condabin:/usr/local/opt/ruby/bin:/usr/local/opt/[email protected]/libexec/bin:/Applications/Sublime Text.app/Contents/SharedSupport/bin:/usr/local/bin:/usr/local/sbin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/MacGPG2/bin:/usr/local/go/bin:/Applications/Visual Studio Code.app/Contents/Resources/app/bin:/bin:/Users/aturner/Code/go/bin:/Users/aturner/.rvm/bin"
2024-12-26T12:10:13.835278+11:00 [INFO] starting language server process. binary path: "/Users/aturner/Library/Application Support/Zed/languages/package-version-server/package-version-server-v0.0.7", working directory: "/Users/aturner/Code/go/src/github.com/qdynamicsco/circuitwise-obo", args: []
2024-12-26T12:10:13.839326+11:00 [INFO] starting language server process. binary path: "/Users/aturner/Library/Application Support/Zed/languages/package-version-server/package-version-server-v0.0.7", working directory: "/Users/aturner/Downloads", args: []
2024-12-26T12:10:14.177585+11:00 [INFO] add_connection;
2024-12-26T12:10:14.178416+11:00 [INFO] set status on client 241075: Connected { peer_id: PeerId { owner_id: 629, id: 6103640 }, connection_id: ConnectionId { owner_id: 0, id: 0 } }
2024-12-26T12:10:15.191524+11:00 [INFO] Initializing default prettier with plugins {}
2024-12-26T12:10:15.19236+11:00 [INFO] Initializing default prettier with plugins {}
2024-12-26T12:10:15.192981+11:00 [INFO] Initializing default prettier with plugins {}
2024-12-26T12:10:15.193491+11:00 [INFO] attempting to start language server "docker-compose", path: "/Users/aturner/Code/go/src/github.com/qdynamicsco/circuitwise-obo", id: 9
2024-12-26T12:10:15.194139+11:00 [INFO] attempting to start language server "taplo", path: "/Users/aturner/Code/go/src/github.com/qdynamicsco/circuitwise-obo", id: 10
2024-12-26T12:10:15.892527+11:00 [INFO] fetching latest version of language server "pyright"
2024-12-26T12:10:16.425389+11:00 [INFO] starting language server process. binary path: "/Users/aturner/Library/Application Support/Zed/extensions/work/toml/taplo-0.9.3/taplo", working directory: "/Users/aturner/Code/go/src/github.com/qdynamicsco/circuitwise-obo", args: ["lsp", "stdio"]
2024-12-26T12:10:16.85198+11:00 [INFO] downloading language server "json-language-server"
2024-12-26T12:10:17.457948+11:00 [INFO] downloading language server "json-language-server"
2024-12-26T12:10:18.243636+11:00 [INFO] downloading language server "yaml-language-server"
2024-12-26T12:10:18.420341+11:00 [INFO] starting language server process. binary path: "/Users/aturner/Library/Application Support/Zed/languages/pylsp/pylsp-venv/bin/pylsp", working directory: "/Users/aturner/Code/go/src/github.com/qdynamicsco/circuitwise-obo", args: []
2024-12-26T12:10:18.518831+11:00 [INFO] starting language server process. binary path: "/usr/local/bin/node", working directory: "/Users/aturner/Code/go/src/github.com/qdynamicsco/circuitwise-obo", args: ["/Users/aturner/Library/Application Support/Zed/languages/json-language-server/node_modules/vscode-langservers-extracted/bin/vscode-json-language-server", "--stdio"]
2024-12-26T12:10:18.520393+11:00 [INFO] starting language server process. binary path: "/usr/local/bin/node", working directory: "/Users/aturner/.config/zed", args: ["/Users/aturner/Library/Application Support/Zed/languages/json-language-server/node_modules/vscode-langservers-extracted/bin/vscode-json-language-server", "--stdio"]
2024-12-26T12:10:18.738202+11:00 [INFO] downloading language server "pyright"
2024-12-26T12:10:19.004983+11:00 [INFO] starting language server process. binary path: "/usr/local/bin/node", working directory: "/Users/aturner/Downloads", args: ["/Users/aturner/Library/Application Support/Zed/languages/json-language-server/node_modules/vscode-langservers-extracted/bin/vscode-json-language-server", "--stdio"]
2024-12-26T12:10:20.400334+11:00 [INFO] starting language server process. binary path: "/usr/local/bin/node", working directory: "/Users/aturner/Code/go/src/github.com/qdynamicsco/circuitwise-obo", args: ["/Users/aturner/Library/Application Support/Zed/languages/yaml-language-server/node_modules/yaml-language-server/bin/yaml-language-server", "--stdio"]
2024-12-26T12:10:20.719817+11:00 [INFO] starting language server process. binary path: "/usr/local/bin/node", working directory: "/Users/aturner/Code/go/src/github.com/qdynamicsco/circuitwise-obo", args: ["/Users/aturner/Library/Application Support/Zed/languages/pyright/node_modules/pyright/langserver.index.js", "--stdio"]
2024-12-26T12:10:20.97283+11:00 [WARN] unhandled capability registration: Registration { id: "17ea2e36-cf5b-4e5a-b02f-db4c04931741", method: "workspace/didChangeWorkspaceFolders", register_options: Some(Object {}) }
2024-12-26T12:10:20.973177+11:00 [WARN] unhandled capability registration: Registration { id: "0a9d65d7-4a2e-41f4-b4c4-658606c3cf20", method: "workspace/didChangeConfiguration", register_options: Some(Object {}) }
2024-12-26T12:10:21.044267+11:00 [INFO] starting language server process. binary path: "/usr/local/bin/node", working directory: "/Users/aturner/Code/go/src/github.com/qdynamicsco/circuitwise-obo", args: ["/Users/aturner/Library/Application Support/Zed/extensions/work/docker-compose/node_modules/.bin/docker-compose-langserver", "--stdio"]
2024-12-26T12:10:21.282851+11:00 [INFO] language server 3: unregistered workspace/DidChangeWatchedFiles capability with id e7708252-06c9-449d-81d6-6c012e2d616c
I can't believe pylsp is that slow on my new M4 Pro Macbook and eats up so much CPU too.
Can someone share some more detailed steps to reproduce? It'd be great if we had an example of a Python repo and files to open that result in the high CPU usage.
- Set
pylspto the only language server for Python. -
git clone https://github.com/huggingface/transformers. -
zed transformers. - Open random Python file by file picker.
Observation
CPU goes to 100% and lots of pylsp processes.
Zed: v0.174.2 (Zed Preview) OS: macOS 15.3.0 Memory: 64 GiB Architecture: aarch64
Duplicate of https://github.com/zed-industries/zed/issues/21076?
Can't seem to reproduce this, opening a python file in huggingface/transformers does spike cpu usage once but quickly goes down to no usage in less than a second for me
Hi there! 👋 We're working to clean up our issue tracker by closing older bugs that might not be relevant anymore. If you are able to reproduce this issue in the latest version of Zed, please let us know by commenting on this issue, and it will be kept open. If you can't reproduce it, feel free to close the issue yourself. Otherwise, it will close automatically in 14 days. Thanks for your help!