clangd / vscode-clangd

Visual Studio Code extension for clangd
https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.vscode-clangd
MIT License
641 stars 113 forks source link

Crash after updating to 0.1.32. #734

Closed Kidsunbo closed 20 hours ago

Kidsunbo commented 20 hours ago

Crash after updating to 0.1.32. Downgrade to 0.1.31 works fine.

Logs

[Error - 6:16:11 AM] Client Clang Language Server: connection to server is erroring. Shutting down server.
[Error - 6:16:11 AM] Stopping server failed
Error: Client is not running and can't be stopped. It's current state is: starting
    at oc.shutdown (/config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:39:8633)
    at oc.stop (/config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:39:8212)
    at oc.stop (/config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:39:51156)
    at oc.handleConnectionError (/config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:39:13298)
    at errorHandler (/config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:39:11963)
    at /config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:39:21662
    at y1.invoke (/config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:2:15350)
    at Xn.fire (/config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:2:16144)
    at writeErrorHandler (/config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:3:7088)
    at y1.invoke (/config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:2:15350)
    at Xn.fire (/config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:2:16144)
    at qs.fireError (/config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:3:430)
    at Socket.<anonymous> (/config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:3:1263)
    at Socket.emit (node:events:519:28)
    at emitErrorNT (node:internal/streams/destroy:169:8)
    at emitErrorCloseNT (node:internal/streams/destroy:128:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
[Info  - 6:16:11 AM] Connection to server got closed. Server will restart.
[Error - 6:16:11 AM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 6:16:11 AM] Clang Language Server client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Info  - 6:16:11 AM] Connection to server got closed. Server will restart.
[Error - 6:16:11 AM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 6:16:11 AM] Clang Language Server client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 6:16:11 AM] Client Clang Language Server: connection to server is erroring. Shutting down server.
[Error - 6:16:11 AM] Stopping server failed
Error: Client is not running and can't be stopped. It's current state is: startFailed
    at oc.shutdown (/config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:39:8633)
    at oc.stop (/config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:39:8212)
    at oc.stop (/config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:39:51156)
    at oc.handleConnectionError (/config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:39:13298)
    at errorHandler (/config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:39:11963)
    at /config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:39:21662
    at y1.invoke (/config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:2:15350)
    at Xn.fire (/config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:2:16144)
    at writeErrorHandler (/config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:3:7088)
    at y1.invoke (/config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:2:15350)
    at Xn.fire (/config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:2:16144)
    at qs.fireError (/config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:3:430)
    at Socket.<anonymous> (/config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:3:1263)
    at Socket.emit (node:events:519:28)
    at emitErrorNT (node:internal/streams/destroy:169:8)
    at emitErrorCloseNT (node:internal/streams/destroy:128:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
[Info  - 6:16:11 AM] Connection to server got closed. Server will restart.
[Error - 6:16:11 AM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 6:16:11 AM] Clang Language Server client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 6:16:11 AM] Restarting server failed
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Info  - 6:16:11 AM] Connection to server got closed. Server will restart.
[Error - 6:16:11 AM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 6:16:11 AM] Clang Language Server client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 6:16:11 AM] Restarting server failed
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 6:16:11 AM] Client Clang Language Server: connection to server is erroring. Shutting down server.
[Error - 6:16:11 AM] Stopping server failed
Error: Client is not running and can't be stopped. It's current state is: startFailed
    at oc.shutdown (/config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:39:8633)
    at oc.stop (/config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:39:8212)
    at oc.stop (/config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:39:51156)
    at oc.handleConnectionError (/config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:39:13298)
    at errorHandler (/config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:39:11963)
    at /config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:39:21662
    at y1.invoke (/config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:2:15350)
    at Xn.fire (/config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:2:16144)
    at writeErrorHandler (/config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:3:7088)
    at y1.invoke (/config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:2:15350)
    at Xn.fire (/config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:2:16144)
    at qs.fireError (/config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:3:430)
    at Socket.<anonymous> (/config/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32-universal/out/bundle.js:3:1263)
    at Socket.emit (node:events:519:28)
    at emitErrorNT (node:internal/streams/destroy:169:8)
    at emitErrorCloseNT (node:internal/streams/destroy:128:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
[Error - 6:16:11 AM] The Clang Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
[Error - 6:16:11 AM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 6:16:11 AM] Clang Language Server client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 6:16:11 AM] Restarting server failed
  Message: Pending response rejected since connection got disposed
  Code: -32097 

System information Clangd version (from the log, or clangd --version):

clangd version 18.1.3 (https://github.com/llvm/llvm-project c13b7485b87909fcf739f62cfa382b55407433c0)
Features: linux+grpc
Platform: x86_64-unknown-linux-gnu

clangd extension version: 0.1.32 Operating system: Ubuntu

HighCommander4 commented 20 hours ago

cc @JVApen

Does the crash happen on clangd startup (i.e. as soon as you open a C/C++ source file), or in response to something specific?

Do you have any settings in VSCode user or workspace settings starting with "clangd"?

Kidsunbo commented 20 hours ago

cc @JVApen

Does the crash happen on clangd startup (i.e. as soon as you open a C/C++ source file), or in response to something specific?

Do you have any settings in VSCode user or workspace settings starting with "clangd"?

No, I use code-server rather than VSCode. It's a pretty new environment.

No settings changed with clangd. I just install clangd and CMake Tools, and create a project with cmake. As soon as I open C++ source file without any editing, the error happens.

fire332 commented 20 hours ago

Hi. I'm having the exact same issue. The extension suddenly started failing to start clangd without any changes to settings or files. This happens on both WSL and Windows, and it happens on startup.

When opening a file in Windows, the error message is different:

[Error - 10:28:58 PM] Clang Language Server client: couldn't create connection to server.
Launching server using command "C:\Program Files\LLVM\bin\clangd.EXE" failed. Error: spawn false ENOENT

I can copy-paste the exact same path to powershell and clangd will start successfully.

EDIT: I use VSCode. EDIT 2: Downgrading to 0.1.31 resolves the issue.

Rheinhauss commented 20 hours ago

Hi. I'm having the exact same issue with 0.1.32 too. Downgrade to 0.1.31 works fine. I use VSCode in devcontainer. edit: clangd version

Ubuntu clangd version 19.1.5 (++20241119043734+51dee6b64fda-1~exp1~20241119163748.65)
Features: linux+grpc
Platform: x86_64-pc-linux-gnu
JVApen commented 20 hours ago

@HighCommander4 I don't understand, I've extensively tested this (on Linux, as I cannot build it on Windows). I have holidays for the next 11 days so won't be able to look into it. Can you revert once again? I'm really sorry.

clovis01 commented 20 hours ago

Hi. I'm having the exact same issue with 0.1.32 too. Downgrade to 0.1.31 works fine. I use vscode-server

wgqimut commented 20 hours ago

same issue with 0.1.32, I use vscode with remote ssh, the remote clangd is crashed when I upgrade clangd extension from 0.1.31, downgrade to 0.1.31, then everything is fine, the log is:

[Error - 2:52:02 PM] Client Clang Language Server: connection to server is erroring. Shutting down server.
[Error - 2:52:02 PM] Stopping server failed
Error: Client is not running and can't be stopped. It's current state is: starting
    at oc.shutdown (/home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:39:8633)
    at oc.stop (/home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:39:8212)
    at oc.stop (/home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:39:51156)
    at oc.handleConnectionError (/home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:39:13298)
    at errorHandler (/home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:39:11963)
    at /home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:39:21662
    at y1.invoke (/home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:2:15350)
    at Xn.fire (/home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:2:16144)
    at writeErrorHandler (/home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:3:7088)
    at y1.invoke (/home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:2:15350)
    at Xn.fire (/home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:2:16144)
    at qs.fireError (/home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:3:430)
    at Socket.<anonymous> (/home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:3:1263)
    at Socket.emit (node:events:519:28)
    at emitErrorNT (node:internal/streams/destroy:169:8)
    at emitErrorCloseNT (node:internal/streams/destroy:128:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
[Info  - 2:52:02 PM] Connection to server got closed. Server will restart.
[Error - 2:52:02 PM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 2:52:02 PM] Clang Language Server client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Info  - 2:52:02 PM] Connection to server got closed. Server will restart.
[Error - 2:52:02 PM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 2:52:02 PM] Clang Language Server client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 2:52:02 PM] Client Clang Language Server: connection to server is erroring. Shutting down server.
[Error - 2:52:02 PM] Stopping server failed
Error: Client is not running and can't be stopped. It's current state is: startFailed
    at oc.shutdown (/home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:39:8633)
    at oc.stop (/home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:39:8212)
    at oc.stop (/home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:39:51156)
    at oc.handleConnectionError (/home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:39:13298)
    at errorHandler (/home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:39:11963)
    at /home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:39:21662
    at y1.invoke (/home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:2:15350)
    at Xn.fire (/home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:2:16144)
    at writeErrorHandler (/home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:3:7088)
    at y1.invoke (/home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:2:15350)
    at Xn.fire (/home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:2:16144)
    at qs.fireError (/home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:3:430)
    at Socket.<anonymous> (/home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:3:1263)
    at Socket.emit (node:events:519:28)
    at emitErrorNT (node:internal/streams/destroy:169:8)
    at emitErrorCloseNT (node:internal/streams/destroy:128:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
[Info  - 2:52:02 PM] Connection to server got closed. Server will restart.
[Error - 2:52:02 PM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 2:52:02 PM] Clang Language Server client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 2:52:02 PM] Restarting server failed
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Info  - 2:52:02 PM] Connection to server got closed. Server will restart.
[Error - 2:52:02 PM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 2:52:02 PM] Clang Language Server client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 2:52:02 PM] Restarting server failed
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 2:52:03 PM] Client Clang Language Server: connection to server is erroring. Shutting down server.
[Error - 2:52:03 PM] Stopping server failed
Error: Client is not running and can't be stopped. It's current state is: startFailed
    at oc.shutdown (/home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:39:8633)
    at oc.stop (/home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:39:8212)
    at oc.stop (/home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:39:51156)
    at oc.handleConnectionError (/home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:39:13298)
    at errorHandler (/home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:39:11963)
    at /home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:39:21662
    at y1.invoke (/home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:2:15350)
    at Xn.fire (/home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:2:16144)
    at writeErrorHandler (/home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:3:7088)
    at y1.invoke (/home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:2:15350)
    at Xn.fire (/home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:2:16144)
    at qs.fireError (/home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:3:430)
    at Socket.<anonymous> (/home/user/.vscode-server/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.32/out/bundle.js:3:1263)
    at Socket.emit (node:events:519:28)
    at emitErrorNT (node:internal/streams/destroy:169:8)
    at emitErrorCloseNT (node:internal/streams/destroy:128:3)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
[Error - 2:52:03 PM] The Clang Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
[Error - 2:52:03 PM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 2:52:03 PM] Clang Language Server client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 2:52:03 PM] Restarting server failed
  Message: Pending response rejected since connection got disposed
  Code: -32097 
M1Z3 commented 20 hours ago

It seems like a new parameter was introduced: clangd.useScriptAsExecutable

Not sure if the default is handled correctly. Defining it in the settings.json seems to work: "clangd.useScriptAsExecutable": false,

Rheinhauss commented 20 hours ago

It seems like a new parameter was introduced: clangd.useScriptAsExecutable

Not sure if the default is handled correctly. Defining it in the settings.json seems to work: "clangd.useScriptAsExecutable": false,

This works for me

HighCommander4 commented 20 hours ago

Reverted the regressing change in https://github.com/clangd/vscode-clangd/pull/736 and put out version 0.1.33 which contains the revert.

Apologies to everyone for the churn.

We really need a way to create nightly/unstable releases for this plugin, to be able to test out changes without pushing them to the entire user population; I'll see if I can find some time to set up a CI action for that.