microsoft / vscode-python

Python extension for Visual Studio Code
https://aka.ms/pvsc-marketplace
MIT License
4.31k stars 1.18k forks source link

[BUG] `Python: Restart Language Server` command fails to start the language server after shutdown #24218

Closed tboddyspargo closed 2 weeks ago

tboddyspargo commented 2 weeks ago

Type: Bug

Behaviour

I'm in a multi-root workspace. I use the command palette to run Python: Restart Language Server its failing to re-index my workspace. It fails to start up the language server again. Perhaps due to a failure to merge config values from my code-workspace file into its runtime config?

Steps to reproduce:

  1. Open the command palette
  2. Run Python: Restart Language Server

Diagnostic data

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

``` 2024-10-01 11:49:13.463 [error] [ `Failed to start language server, Class name = h, completed in 17ms, has a falsy return value, Arg 1: , Arg 2: {"id":"/Users/tyler/.pyenv/versions/3.11.6/bin/python","sysPrefix":"/Users/tyler/.pyenv/versions/3.11.6","envType":"Pyenv","envName":"3.11.6","envPath":"/Users/tyler/.pyenv/versions/3.11.6","path":"/Users/tyler/.pyenv/versions/3.11.6/bin/python","architecture":3,"sysVersion":"3.11.6 (main, Dec 8 2023, 17:46:41) [Clang 15.0.0 (clang-1500.0.40.1)]","version":{"raw":"3.11.6","major":3,"minor":11,"patch":6,"build":[],"prerelease":["final","0"]},"displayName":"Python 3.11.6 64-bit ('3.11.6')","detailedDisplayName":"Python 3.11.6 64-bit ('3.11.6': pyenv)"}, Arg 3: {"documentSelector":[{"scheme":"file","language":"python"},{"scheme":"untitled","language":"python"},{"scheme":"vscode-notebook","language":"python"},{"scheme":"vscode-notebook-cell","language":"python"},{"scheme":"vscode-interactive-input","language":"python"}],"synchronize":{"configurationSection":["python","jupyter.runStartupCommands"]},"outputChannel":{"name":"Python Language Server","logLevel":3},"revealOutputChannelOn":4,"initializationOptions":{"experimentationSupport":true,"trustedWorkspaceSupport":true},"middleware":{"serviceContainer":{"container":{"options":{"autoBindInjectable":false,"defaultScope":"Transient","skipBaseClassChecks":true},"id":0,"_bindingDictionary":{"_map":{}},"_snapshots":[],"_middleware":null,"_activations":{"_map":{}},"_deactivations":{"_map":{}},"parent":null,"_metadataReader":{},"_moduleActivationStore":{"_map":{}}}},"serverVersion":"2024.9.2","lastCaptured":{},"nextWindow":0,"eventCount":0,"workspace":{},"connectedPromise":{"scope":null,"_resolved":true,"_rejected":false,"_promise":{}},"notebooks":{},"eventName":"LANGUAGE_SERVER.REQUEST"}}, Return Value: undefined`, Error: LanguageStatusItem with id 'python.analysis.typeCheckingMode' ALREADY exists at createLanguageStatusItem (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:161:163942) at Object.createLanguageStatusItem (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:171:38483) at _0x479bca.createStatusItem (/Users/tyler/.vscode/extensions/ms-python.vscode-pylance-2024.9.2/dist/extension.bundle.js:1:267528) at _0x479bca.updateStatusItem (/Users/tyler/.vscode/extensions/ms-python.vscode-pylance-2024.9.2/dist/extension.bundle.js:1:281177) at _0x479bca.activate (/Users/tyler/.vscode/extensions/ms-python.vscode-pylance-2024.9.2/dist/extension.bundle.js:1:265027) at _0x15ea08 (/Users/tyler/.vscode/extensions/ms-python.vscode-pylance-2024.9.2/dist/extension.bundle.js:1:312410) at _0x330591 (/Users/tyler/.vscode/extensions/ms-python.vscode-pylance-2024.9.2/dist/extension.bundle.js:1:237816) at processTicksAndRejections (node:internal/process/task_queues:95:5) at _0x42f377._startClient (/Users/tyler/.vscode/extensions/ms-python.vscode-pylance-2024.9.2/dist/extension.bundle.js:1:184147) at _0x42f377._createNewRequest (/Users/tyler/.vscode/extensions/ms-python.vscode-pylance-2024.9.2/dist/extension.bundle.js:1:183667) at _0x42f377._enqueueRequestAndWaitForRun (/Users/tyler/.vscode/extensions/ms-python.vscode-pylance-2024.9.2/dist/extension.bundle.js:1:182870) at _0x42f377.startClient (/Users/tyler/.vscode/extensions/ms-python.vscode-pylance-2024.9.2/dist/extension.bundle.js:1:182351) at h.start (/Users/tyler/.vscode/extensions/ms-python.python-2024.14.1-darwin-arm64/out/client/extension.js:2:39659) ] 2024-10-01 11:49:13.463 [error] [ 'Starting language server, Class name = d, completed in 18ms, has a falsy return value, , Return Value: undefined', Error: LanguageStatusItem with id 'python.analysis.typeCheckingMode' ALREADY exists at createLanguageStatusItem (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:161:163942) at Object.createLanguageStatusItem (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:171:38483) at _0x479bca.createStatusItem (/Users/tyler/.vscode/extensions/ms-python.vscode-pylance-2024.9.2/dist/extension.bundle.js:1:267528) at _0x479bca.updateStatusItem (/Users/tyler/.vscode/extensions/ms-python.vscode-pylance-2024.9.2/dist/extension.bundle.js:1:281177) at _0x479bca.activate (/Users/tyler/.vscode/extensions/ms-python.vscode-pylance-2024.9.2/dist/extension.bundle.js:1:265027) at _0x15ea08 (/Users/tyler/.vscode/extensions/ms-python.vscode-pylance-2024.9.2/dist/extension.bundle.js:1:312410) at _0x330591 (/Users/tyler/.vscode/extensions/ms-python.vscode-pylance-2024.9.2/dist/extension.bundle.js:1:237816) at processTicksAndRejections (node:internal/process/task_queues:95:5) at _0x42f377._startClient (/Users/tyler/.vscode/extensions/ms-python.vscode-pylance-2024.9.2/dist/extension.bundle.js:1:184147) at _0x42f377._createNewRequest (/Users/tyler/.vscode/extensions/ms-python.vscode-pylance-2024.9.2/dist/extension.bundle.js:1:183667) at _0x42f377._enqueueRequestAndWaitForRun (/Users/tyler/.vscode/extensions/ms-python.vscode-pylance-2024.9.2/dist/extension.bundle.js:1:182870) at _0x42f377.startClient (/Users/tyler/.vscode/extensions/ms-python.vscode-pylance-2024.9.2/dist/extension.bundle.js:1:182351) at h.start (/Users/tyler/.vscode/extensions/ms-python.python-2024.14.1-darwin-arm64/out/client/extension.js:2:39659) ] 2024-10-01 11:49:13.463 [error] [ 'Restarting language server, Class name = d, completed in 39ms, has a falsy return value, , Return Value: undefined', Error: LanguageStatusItem with id 'python.analysis.typeCheckingMode' ALREADY exists at createLanguageStatusItem (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:161:163942) at Object.createLanguageStatusItem (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:171:38483) at _0x479bca.createStatusItem (/Users/tyler/.vscode/extensions/ms-python.vscode-pylance-2024.9.2/dist/extension.bundle.js:1:267528) at _0x479bca.updateStatusItem (/Users/tyler/.vscode/extensions/ms-python.vscode-pylance-2024.9.2/dist/extension.bundle.js:1:281177) at _0x479bca.activate (/Users/tyler/.vscode/extensions/ms-python.vscode-pylance-2024.9.2/dist/extension.bundle.js:1:265027) at _0x15ea08 (/Users/tyler/.vscode/extensions/ms-python.vscode-pylance-2024.9.2/dist/extension.bundle.js:1:312410) at _0x330591 (/Users/tyler/.vscode/extensions/ms-python.vscode-pylance-2024.9.2/dist/extension.bundle.js:1:237816) at processTicksAndRejections (node:internal/process/task_queues:95:5) at _0x42f377._startClient (/Users/tyler/.vscode/extensions/ms-python.vscode-pylance-2024.9.2/dist/extension.bundle.js:1:184147) at _0x42f377._createNewRequest (/Users/tyler/.vscode/extensions/ms-python.vscode-pylance-2024.9.2/dist/extension.bundle.js:1:183667) at _0x42f377._enqueueRequestAndWaitForRun (/Users/tyler/.vscode/extensions/ms-python.vscode-pylance-2024.9.2/dist/extension.bundle.js:1:182870) at _0x42f377.startClient (/Users/tyler/.vscode/extensions/ms-python.vscode-pylance-2024.9.2/dist/extension.bundle.js:1:182351) at h.start (/Users/tyler/.vscode/extensions/ms-python.python-2024.14.1-darwin-arm64/out/client/extension.js:2:39659) ] 2024-10-01 11:49:13.463 [error] [ 'Failed to restart language server, Class name = d, completed in 39ms, has a falsy return value, , Return Value: undefined', Error: LanguageStatusItem with id 'python.analysis.typeCheckingMode' ALREADY exists at createLanguageStatusItem (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:161:163942) at Object.createLanguageStatusItem (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:171:38483) at _0x479bca.createStatusItem (/Users/tyler/.vscode/extensions/ms-python.vscode-pylance-2024.9.2/dist/extension.bundle.js:1:267528) at _0x479bca.updateStatusItem (/Users/tyler/.vscode/extensions/ms-python.vscode-pylance-2024.9.2/dist/extension.bundle.js:1:281177) at _0x479bca.activate (/Users/tyler/.vscode/extensions/ms-python.vscode-pylance-2024.9.2/dist/extension.bundle.js:1:265027) at _0x15ea08 (/Users/tyler/.vscode/extensions/ms-python.vscode-pylance-2024.9.2/dist/extension.bundle.js:1:312410) at _0x330591 (/Users/tyler/.vscode/extensions/ms-python.vscode-pylance-2024.9.2/dist/extension.bundle.js:1:237816) at processTicksAndRejections (node:internal/process/task_queues:95:5) at _0x42f377._startClient (/Users/tyler/.vscode/extensions/ms-python.vscode-pylance-2024.9.2/dist/extension.bundle.js:1:184147) at _0x42f377._createNewRequest (/Users/tyler/.vscode/extensions/ms-python.vscode-pylance-2024.9.2/dist/extension.bundle.js:1:183667) at _0x42f377._enqueueRequestAndWaitForRun (/Users/tyler/.vscode/extensions/ms-python.vscode-pylance-2024.9.2/dist/extension.bundle.js:1:182870) at _0x42f377.startClient (/Users/tyler/.vscode/extensions/ms-python.vscode-pylance-2024.9.2/dist/extension.bundle.js:1:182351) at h.start (/Users/tyler/.vscode/extensions/ms-python.python-2024.14.1-darwin-arm64/out/client/extension.js:2:39659) ] ```

Output for Python Language Server in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

``` 2024-10-01 11:49:13.441 [info] (56951) WorkspaceFactory 0 clear 2024-10-01 11:49:13.451 [info] (Client) Experiment 'pythonRecommendTensorboardExt' is active 2024-10-01 11:49:13.451 [info] (Client) Experiment 'pythonTerminalEnvVarActivation' is active 2024-10-01 11:49:13.451 [info] (Client) Experiment 'pythonTestAdapter' is active 2024-10-01 11:49:13.866 [info] [Info - 11:49:13 AM] Server process exited successfully ```

Extension version: 2024.14.1 VS Code version: Code 1.93.1 (Universal) (38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40, 2024-09-11T17:20:05.685Z) OS version: Darwin arm64 24.0.0 Modes:

User Settings

``` Multiroot scenario, following user settings may not apply: envFile: "" languageServer: "Pylance" testing • pytestArgs: "" ```

Installed Extensions |Extension Name|Extension Id|Version| |---|---|---| |autoDocstring - Python Docstring Generator|njpwerner.autodocstring|0.6.1| |Babel JavaScript|mgmcdermott.vscode-language-babel|0.0.40| |Better Comments|aaron-bond.better-comments|3.0.2| |Bookmarks|alefragnani.Bookmarks|13.5.0| |Code Spell Checker|streetsidesoftware.code-spell-checker|3.0.1| |Data Preview|RandomFractalsInc.vscode-data-preview|2.3.0| |Database Client JDBC|cweijan.dbclient-jdbc|1.3.6| |Docker|ms-azuretools.vscode-docker|1.29.3| |DotENV|mikestead.dotenv|1.0.1| |ERB Formatter/Beautify|aliariff.vscode-erb-beautify|0.5.0| |ESLint|dbaeumer.vscode-eslint|3.0.10| |Even Better TOML|tamasfe.even-better-toml|0.19.2| |GitHub Actions|github.vscode-github-actions|0.27.0| |GitHub Copilot|GitHub.copilot|1.234.0| |GitHub Copilot Chat|GitHub.copilot-chat|0.20.3| |GitHub Markdown Preview|bierner.github-markdown-preview|0.3.0| |GitHub Pull Requests|GitHub.vscode-pull-request-github|0.96.0| |GitLens — Git supercharged|eamodio.gitlens|15.5.1| |Go|golang.go|0.42.1| |hadolint|exiasr.hadolint|1.1.2| |HashiCorp Terraform|hashicorp.terraform|2.32.3| |Ini for VSCode|DavidWang.ini-for-vscode|0.0.4| |JavaScript Debugger|ms-vscode.js-debug|1.93.0| |JavaScript Debugger Companion Extension|ms-vscode.js-debug-companion|1.1.3| |JavaScript Docstrings|Massi.javascript-docstrings|1.1.1| |Jupyter|ms-toolsai.jupyter|2024.8.1| |Jupyter Cell Tags|ms-toolsai.vscode-jupyter-cell-tags|0.1.9| |Jupyter Keymap|ms-toolsai.jupyter-keymap|1.1.2| |Jupyter Notebook Renderers|ms-toolsai.jupyter-renderers|1.0.19| |Jupyter Slide Show|ms-toolsai.vscode-jupyter-slideshow|0.1.6| |just|skellock.just|2.0.0| |Kubernetes|ms-kubernetes-tools.vscode-kubernetes-tools|1.3.16| |Makefile Tools|ms-vscode.makefile-tools|0.11.13| |Markdown Checkboxes|bierner.markdown-checkbox|0.4.0| |Markdown Emoji|bierner.markdown-emoji|0.3.0| |Markdown Footnotes|bierner.markdown-footnotes|0.1.1| |Markdown Preview Github Styling|bierner.markdown-preview-github-styles|2.1.0| |Markdown Preview Mermaid Support|bierner.markdown-mermaid|1.25.0| |Markdown yaml Preamble|bierner.markdown-yaml-preamble|0.1.0| |markdownlint|DavidAnson.vscode-markdownlint|0.56.0| |MySQL|cweijan.vscode-mysql-client2|7.6.2| |NGINX Configuration|william-voyek.vscode-nginx|0.7.2| |Prettier - Code formatter|esbenp.prettier-vscode|11.0.0| |Pylance|ms-python.vscode-pylance|2024.9.2| |Python|ms-python.python|2024.14.1| |Python Debugger|ms-python.debugpy|2024.10.0| |Ruff|charliermarsh.ruff|2024.50.0| |Scalene|EmeryBerger.scalene|0.0.9| |SCSS Formatter|sibiraj-s.vscode-scss-formatter|3.0.0| |ShellCheck|timonwong.shellcheck|0.37.1| |Table Visualizer for JavaScript Profiles|ms-vscode.vscode-js-profile-table|1.0.9| |Thunder Client|rangav.vscode-thunder-client|2.25.9| |Visual Studio Code Commitizen Support|KnisterPeter.vscode-commitizen|1.1.0| |VS Code Speech|ms-vscode.vscode-speech|0.10.0| |YAML|redhat.vscode-yaml|1.15.0|
System Info |Item|Value| |---|---| |CPUs|Apple M1 Max (10 x 2400)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off| |Load (avg)|15, 10, 7| |Memory (System)|32.00GB (0.46GB free)| |Process Argv|--crash-reporter-id 9c8b74e5-efe2-4756-b68a-91b9fde0fa03| |Screen Reader|no| |VM|0%|
A/B Experiments ``` vsliv368:30146709 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscod805:30301674 binariesv615:30325510 vsaa593cf:30376535 py29gd2263:31024239 c4g48928:30535728 azure-dev_surveyone:30548225 a9j8j154:30646983 962ge761:30959799 pythongtdpath:30769146 welcomedialog:30910333 pythonnoceb:30805159 asynctok:30898717 pythonmypyd1:30879173 h48ei257:31000450 pythontbext0:30879054 accentitlementst:30995554 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 dsvsc021:30996838 01bff139:31013167 a69g1124:31058053 dvdeprecation:31068756 dwnewjupytercf:31046870 2f103344:31071589 impr_priority:31102340 nativerepl1:31139838 refactort:31108082 pythonrstrctxt:31112756 flighttreat:31134774 wkspc-onlycs-t:31132770 wkspc-ranged-t:31125599 cf971741:31144450 defaultse:31146405 ei213698:31121563 iacca1:31144502 cc771715:31146322 ```
rchiodo commented 2 weeks ago

Closing as dupe of https://github.com/microsoft/pylance-release/issues/6378