Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting 'couldn't create connection to server' after update to v0.1.30 #722

Closed
0v3rt1r3d opened this issue Nov 13, 2024 · 14 comments · Fixed by #724
Closed

Getting 'couldn't create connection to server' after update to v0.1.30 #722

0v3rt1r3d opened this issue Nov 13, 2024 · 14 comments · Fixed by #724
Labels
bug Something isn't working

Comments

@0v3rt1r3d
Copy link

Today my vscode-clangd plugin had been automatically updated from 0.1.29 to 0.1.30 and I began receiving the following error message for the c++ projects I'm working with (middle-sized c++ project, single directory in the workspace if that matters).

"Clang Language Server client: couldn't create connection to server."

As I can see nothing else changed in my system. Also switching back to 0.1.29 with complete restart of vscode helps (just reloading extensions doesn't).

Logs

[Error - 10:56:29] Clang Language Server client: couldn't create connection to server.
Launching server using command "/opt/homebrew/opt/llvm@18/bin/clangd" failed. Error: spawn "/opt/homebrew/opt/llvm@18/bin/clangd" ENOENT

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

Homebrew clang version 18.1.8
Target: arm64-apple-darwin24.0.0
Thread model: posix
InstalledDir: /opt/homebrew/opt/llvm@18/bin

clangd extension version: 0.1.30
Operating system: Mac OS Sequoia 15.0

@0v3rt1r3d 0v3rt1r3d added the bug Something isn't working label Nov 13, 2024
@bburgerm
Copy link

I see same issue with "clangd.path": "/usr/bin/clangd" and /usr/bin/clangd --version:

clangd version 17.0.6 (Red Hat 17.0.6-1.module+el8.10.0+20808+e12784c0)
Features: linux
Platform: x86_64-unknown-linux-gnu; target=x86_64-redhat-linux-gnu

On RedHat 8 on Intel CPU as well as

clangd version 18.1.8 (Red Hat 18.1.8-1.module+el8.10.0+22061+3612b2ba)
Features: linux
Platform: aarch64-unknown-linux-gnu; target=aarch64-redhat-linux-gnu

on ARM CPU. Same when only using "clangd.path" : "clangd". Working again after downgrading vscode-clangd to v0.1.29

@lingkerio
Copy link

I am experiencing the same issue after the vscode-clangd extension was automatically updated to version 0.1.30. After upgrading, I started seeing the following error when opening my C++ projects.

Reverting back to version 0.1.29 and restarting VSCode resolves the issue. It seems that downgrading is the only workaround currently available.

System details:

@HighCommander4
Copy link
Contributor

cc @JVApen @quanzhuo

Regression from #708 or #715 I presume?

@xinyiZzz
Copy link

I got the same error Error: spawn clangd" ENOENT, It worked fine after rolling back to vscode-clangd v0.1.29.

It seems to be unrelated to the Clangd version, I tried Clangd v13, v16, v17, v18.

@HighCommander4
Copy link
Contributor

Regression from #708 or #715 I presume?

I posted a patch to revert these changes at #724 until we can sort this out.

@HighCommander4
Copy link
Contributor

The changes suspected of causing this regression have been backed out in 0.1.31. Please give that version a try and let me know if the issue is fixed there.

@Carryme1899
Copy link

Carryme1899 commented Nov 14, 2024

Same issue with version 0.1.29 here.
Sorry for the mix-up. This issue’s in version 0.1.30.

clangd output:

The flag `-clang-tidy-checks` is obsolete and ignored.
clangd: Unknown command line argument 'bugprone-*,'.  Try: '/usr/bin/clangd --help'
clangd: Unknown command line argument 'misc-*,'.  Try: '/usr/bin/clangd --help'
clangd: Unknown command line argument 'google-*,'.  Try: '/usr/bin/clangd --help'
clangd: Unknown command line argument 'modernize-*,'.  Try: '/usr/bin/clangd --help'
clangd: Unknown command line argument 'readability-*,'.  Try: '/usr/bin/clangd --help'
clangd: Unknown command line argument 'portability-*'.  Try: '/usr/bin/clangd --help'
[Info  - 4:08:33 PM] Connection to server got closed. Server will restart.
[Error - 4:08:33 PM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 4:08:33 PM] Clang Language Server client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 

Settings in .vscode/settings.json:

"clangd.arguments": [
    "--all-scopes-completion",
    "--background-index",
    "--clang-tidy",
    "--clang-tidy-checks=performance-*, bugprone-*, misc-*, google-*, modernize-*, readability-*, portability-*",
    "--compile-commands-dir=${workspaceFolder}/.vscode",
    "--completion-parse=auto",
    "--completion-style=detailed",
    "--enable-config",
    "--fallback-style=Microsoft",
    "--function-arg-placeholders=true",
    "--header-insertion-decorators",
    "--header-insertion=never",
    "--log=verbose",
    "--pch-storage=memory",
    "--pretty",
    "--ranking-model=decision_forest",
    "-j=8"
],

Removing the --clang-tidy-checks makes everything work as expected.

  • clangd version: 18.1.8 (Fedora 18.1.8-1.fc40)
  • OS: Fedora 40

@HighCommander4
Copy link
Contributor

@Carryme1899 could you file a new ticket for that please?

@lingkerio
Copy link

The changes suspected of causing this regression have been backed out in 0.1.31. Please give that version a try and let me know if the issue is fixed there.

After I updated the version to 0.1.31, this issue disappeared.

@JVApen
Copy link
Contributor

JVApen commented Nov 15, 2024

@0v3rt1r3d, @bburgerm, @lingkerio can you share the complete set of settings that are used for clangd? Especially "clangd.arguments"?

@bburgerm
Copy link

@JVApen my full configuration is

   "clangd.onConfigChanged": "restart",
   "clangd.arguments": [
      "--header-insertion=never",
      "--pretty",
      "--malloc-trim"
   ],
   "clangd.fallbackFlags": [
      "-std=c++20"
   ],
   "clangd.path": "/usr/bin/clangd"

but I had removed everything with 0.1.30 and had the same issues.

Not with 0.1.31 (or with 0.1.29) all working OK again.

@lingkerio
Copy link

@JVApen

  "clangd.arguments": [
    "--all-scopes-completion",
    "--background-index",
    "--clang-tidy",
    "--clang-tidy-checks=performance-*, bugprone-*, misc-*, google-*, modernize-*, readability-*, portability-*",
    "--compile-commands-dir=${workspaceFolder}/.vscode",
    "--completion-parse=auto",
    "--completion-style=detailed",
    "--enable-config",
    "--fallback-style=Webkit",
    "--function-arg-placeholders=true",
    "--header-insertion-decorators",
    "--header-insertion=iwyu",
    "--include-cleaner-stdlib",
    "--log=verbose",
    "--pch-storage=memory",
    "--pretty",
    "--ranking-model=decision_forest",
    "-j=12"
  ],
"clangd.fallbackFlags": [
    "-pedantic",
    "-Wall",
    "-Wextra",
    "-Wcast-align",
    "-Wdouble-promotion",
    "-Wformat=2",
    "-Wimplicit-fallthrough",
    "-Wmisleading-indentation",
    "-Wnon-virtual-dtor",
    "-Wnull-dereference",
    "-Wold-style-cast",
    "-Woverloaded-virtual",
    "-Wpedantic",
    "-Wshadow",
    "-Wunused",
    "-pthread",
    "-fuse-ld=lld",
    "-fsanitize=address",
    "-fsanitize=undefined"
  ],
  "clangd.checkUpdates": false,
  "clangd.onConfigChanged": "restart",
  "clangd.serverCompletionRanking": true,
  "clangd.detectExtensionConflicts": true,

@goyalyashpal
Copy link

Today my vscode-clangd plugin had been automatically updated from 0.1.29 to 0.1.30

hi! thanks for such thorough report. i am wondering if in automatically updated, then how did you find the older version you had on your system? are there some logs etc stored by vscode? thanks.

@JVApen
Copy link
Contributor

JVApen commented Nov 18, 2024

Configuration of @lingkerio can be explained with the spaces in the clang-tidy checks, similar to #725
However, the configuration of @bburgerm does not seem to have any spaces or double quotes in them. Neither in the arguments or the program.

I'm wondering what could cause the issue. Can it be these programs are symlinks? I'll test that later today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants