vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

IntelliSense not working on Remote SSH "Request canceled by server"

Open RahulSisondia opened this issue 2 years ago • 14 comments

Environment

  • OS and Version: Mac Ventura 13.5.2
  • VS Code Version: 1.84.2 / downgrading to 1.83.1 had no effect
  • C/C++ Extension Version: 1.84.5 / upgrading to 1.90 had no effect
  • If using SSH remote, specify OS of remote machine: Linux el9 5.15.0-103.114.4.el9uek.x86_64

Bug Summary and Steps to Reproduce

Bug Summary:

Hi, I'm trying to develop c++ on a linux machine using remote ssh. The connect is fine, open file is fine. However Intellisense seems not working. It keeps on the indexing, selecting "go to definition" does nothing, hovering mouse over a symbol doesn't show the preview. It seems Intellisense has stopped working due to some cancellation request by the language server. AFAICT, it is regression from the recent versions because this was working until last week.

Steps to reproduce: (1 )Download the Remote - SSH extension and C/C++ extension (2) Connect to remote (3) Install the C/C++ extension on the remote (4) Open the workspace that contains mysql source (5) Open any cpp file and observe and try to navigate or hover the mouse over a symbol. Notice indexing and rescanning taking forever but never completes.
image

Expected behavior: Hovering over a symbol must show details about that symbol. Must be able to navigate to the definitions.

Everything was working fine until Friday. Seems regression due to latest upgrades.
Downgrading the vscode and upgrading the c_cpp extension to 1.90 had no effect

Configuration and Logs

- Configurations in c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**",
                "/export/home/tmp/rahul/build/dev_build/include"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/gcc",
            "cStandard": "gnu23",
            "cppStandard": "gnu++23",
           "intelliSenseMode": "linux-gcc-x64"
        }
    ],
    "version": 4
} 


- Logs from running C/C++: Log Diagnostics from the VS Code command palette

Did not notice any. 

- Logs from the language server logging

loggingLevel: Debug
LSP: (received) cpptools/initialize (id: 1)
LSP: (invoked) cpptools/initialize (id: 1)
cpptools version (TypeScript): 1.18.5
cpptools version (native): 1.18.3.0
Autocomplete is enabled.
Error squiggles are enabled.
Hover is enabled.
IntelliSense Engine = default.
LSP: (received) cpptools/queryCompilerDefaults (id: 2)
LSP: (invoked) cpptools/queryCompilerDefaults (id: 2)
LSP: (received) cpptools/didChangeCppProperties (id: 3)
LSP: (received) cpptools/queryCompilerDefaults (id: 4)
Querying compiler for default C++ language standard using command line: /usr/bin/clang -x c++ -E -dM /dev/null
Detected language standard version: c++17
Querying compiler's default target using command line: "/usr/bin/clang" -dumpmachine
Compiler returned default target value: x86_64-redhat-linux-gnu
Compiler query command line: /usr/bin/clang -std=c17 -m64 -Wp,-v -fno-blocks -E -dM -x c /dev/null
Attempting to get defaults from C compiler in "compilerPath" property: '/usr/bin/clang'
Compiler query command line: /usr/bin/clang -std=c++17 -m64 -Wp,-v -fno-blocks -E -dM -x c++ /dev/null
Attempting to get defaults from C++ compiler in "compilerPath" property: '/usr/bin/clang'
LSP: (invoked) cpptools/didChangeCppProperties (id: 3)
Code browsing service initialized
Querying compiler for default C++ language standard using command line: /usr/bin/gcc -x c++ -E -dM /dev/null
Detected language standard version: gnu++17
Querying compiler's default target using command line: "/usr/bin/gcc" -dumpmachine
Compiler returned default target value: x86_64-redhat-linux
Compiler query command line: /usr/bin/gcc -std=gnu++23 -m64 -Wp,-v -E -dM -x c++ /dev/null
Attempting to get defaults from C++ compiler in "compilerPath" property: '/usr/bin/gcc'
Compiler query command line: /usr/bin/gcc -std=gnu23 -m64 -Wp,-v -E -dM -x c /dev/null
Compiler query command line: /usr/bin/gcc -std=gnu2x -m64 -Wp,-v -E -dM -x c /dev/null
Attempting to get defaults from C compiler in "compilerPath" property: '/usr/bin/gcc'
  Folder: /usr/include/ will be indexed
  Folder: /usr/lib/gcc/x86_64-redhat-linux/11/include/ will be indexed
  Folder: /usr/local/include/ will be indexed
  Folder: /home/rahul/src/dev/ will be indexed
  Folder: /export/home/tmp/rahul/build/build_dev/include/ will be indexed
LSP: (invoked) cpptools/queryCompilerDefaults (id: 4)
Discovering files...
LSP: (received) cpptools/didChangeCppProperties (id: 5)
LSP: (invoked) cpptools/didChangeCppProperties (id: 5)
  Processing folder (recursive): /usr/include/
LSP: (received) textDocument/didOpen: file:///home/rahul/src/   /storage/innobase/trx/trx0purge.cc
LSP: (invoked) textDocument/didOpen: file:///home/rahul/src/dev/storage/innobase/trx/trx0purge.cc
LSP: (received) cpptools/activeDocumentChange: file:///home/rahul/src/dev/storage/innobase/trx/trx0purge.cc
LSP: (received) cpptools/textEditorSelectionChange
LSP: (received) cpptools/getDocumentSymbols: file:///home/rahul/src/dev/storage/innobase/trx/trx0purge.cc (id: 6)
LSP: (received) cpptools/getCodeActions: file:///home/rahul/src/dev/storage/innobase/trx/trx0purge.cc (id: 7)
LSP: (received) cpptools/getSemanticTokens: file:///home/rahul/src/dev/storage/innobase/trx/trx0purge.cc (id: 8)
LSP: (received) cpptools/getInlayHints: file:///home/rahul/src/dev/storage/innobase/trx/trx0purge.cc (id: 9)
LSP: (invoked) cpptools/activeDocumentChange: file:///home/rahul/src/dev/storage/innobase/trx/trx0purge.cc
LSP: (invoked) cpptools/textEditorSelectionChange
LSP: (invoked) cpptools/getDocumentSymbols: file:///home/rahul/src/dev/storage/innobase/trx/trx0purge.cc (id: 6)
LSP: (invoked) cpptools/getCodeActions: file:///home/rahul/src/dev/storage/innobase/trx/trx0purge.cc (id: 7)
LSP: (invoked) cpptools/getSemanticTokens: file:///home/rahul/src/dev/storage/innobase/trx/trx0purge.cc (id: 8)
LSP: (invoked) cpptools/getInlayHints: file:///home/rahul/src/dev/storage/innobase/trx/trx0purge.cc (id: 9)
LSP: (received) cpptools/getFoldingRanges: file:///home/rahul/src/dev/storage/innobase/trx/trx0purge.cc (id: 10)
LSP: (invoked) cpptools/getFoldingRanges: file:///home/rahul/src/dev/storage/innobase/trx/trx0purge.cc (id: 10)
  tag parsing file: /home/rahul/src/dev/storage/innobase/trx/trx0purge.cc
Checking for syntax errors: /home/rahul/src/dev/storage/innobase/trx/trx0purge.cc
LSP: (received) cpptools/getCodeActions: file:///home/rahul/src/dev/storage/innobase/trx/trx0purge.cc (id: 11)
LSP: (received) cpptools/getInlayHints: file:///home/rahul/src/dev/storage/innobase/trx/trx0purge.cc (id: 12)
LSP: $/cancelRequest (cpptools/getInlayHints, id: 9)
LSP: (invoked) cpptools/getCodeActions: file:///home/rahul/src/dev/storage/innobase/trx/trx0purge.cc (id: 11)
LSP: (invoked) cpptools/getInlayHints: file:///home/rahul/src/dev/storage/innobase/trx/trx0purge.cc (id: 12)
LSP: Request canceled by server (<unknown/completed>, code: -32802, id: 9)
Database safe to open.
LSP: (received) cpptools/getCodeActions: file:///home/rahul/src/dev/storage/innobase/trx/trx0purge.cc (id: 13)
LSP: (invoked) cpptools/getCodeActions: file:///home/rahul/src/dev/storage/innobase/trx/trx0purge.cc (id: 13)
LSP: (received) cpptools/getInlayHints: file:///home/rahul/src/dev/storage/innobase/trx/trx0purge.cc (id: 14)
LSP: (invoked) cpptools/getInlayHints: file:///home/rahul/src/dev/storage/innobase/trx/trx0purge.cc (id: 14)
LSP: Request canceled by server (cpptools/getInlayHints, code: -32802, id: 12)

Other Extensions

clang-format code Spell checker copy with line numbers Git lense

Additional context

No response

RahulSisondia avatar Nov 20 '23 01:11 RahulSisondia

I encountered the same issue, and I fixed it by setting the 'C_Cpp: Intelli Sense Engine' value to 'default'.

onlytheworld avatar Nov 20 '23 11:11 onlytheworld

I encountered the same issue, and I fixed it by setting the 'C_Cpp: Intelli Sense Engine' value to 'default'.

Thank you. In my case 'C_Cpp: Intelli Sense Engine' value was already set to 'default'.

RahulSisondia avatar Nov 20 '23 12:11 RahulSisondia

Having the same issue.

charliesabino avatar Nov 20 '23 15:11 charliesabino

@RahulSisondia Can you run the C/C++: Reset IntelliSense Database command from the command palette? Does that fix it?

sean-mcmanus avatar Nov 20 '23 16:11 sean-mcmanus

@RahulSisondia @charliesabino Is the issue fixed after downgrading to 1.17.5?

sean-mcmanus avatar Nov 20 '23 16:11 sean-mcmanus

@RahulSisondia Can you run the C/C++: Reset IntelliSense Database command from the command palette? Does that fix it?

No. it doesn't fix the issue. I restarted the vscode server processes running on the remote box but that did not help either.
In one of my vscode instance rescanning of intellisense is completed. I don't know how. Perhaps I reconnected the machine next time.

RahulSisondia avatar Nov 20 '23 17:11 RahulSisondia

@RahulSisondia @charliesabino Is the issue fixed after downgrading to 1.17.5?

@sean-mcmanus Indeed, downgrading to 1.17.5 seems to have fixed the problem. I can see intellisense rescanning in action with lot of log entries like tag parsing file: <> which was not the case with 1.19 and 1.18.5. Is it some known regression issue ?

Intellisense rescanning completed within 1-2 minutes while it is taking forever with latest versions.

I noticed log entries Request canceled by server (cpptools/getInlayHints, code: -32802, id: 31) with this extension too so my guess is that it is benign message not related to the regression.

RahulSisondia avatar Nov 20 '23 18:11 RahulSisondia

@RahulSisondia @charliesabino Is the issue fixed after downgrading to 1.17.5?

FTR, downgrading ms-vscode.cpptools-extension-pack to 1.17.5 worked for me too.

rsaim avatar Nov 21 '23 13:11 rsaim

With 1.18.5 we fixed a bug on Linux in which it wasn't using the $XDG_CACHE_HOME or $HOME/.cache. Does downgrading to 1.18.4 fix the issue? If so, there could be some issue with writing to that directory. https://github.com/microsoft/vscode-cpptools/issues/11693

sean-mcmanus avatar Nov 21 '23 19:11 sean-mcmanus

Does using these remote or workspace settings fix the issue? (or some equivalent path, FYI, the intelliSenseCache path can be shared by workspaces, but you don't want the databaseFilename to be shared).

  "C_Cpp.intelliSenseCachePath": "${workspaceFolder}/.vscode",
  "C_Cpp.default.browse.databaseFilename": "${workspaceFolder}/.vscode/vc.db"

sean-mcmanus avatar Nov 21 '23 19:11 sean-mcmanus

Does using these remote or workspace settings fix the issue? (or some equivalent path, FYI, the intelliSenseCache path can be shared by workspaces, but you don't want the databaseFilename to be shared).

  "C_Cpp.intelliSenseCachePath": "${workspaceFolder}/.vscode",
  "C_Cpp.default.browse.databaseFilename": "${workspaceFolder}/.vscode/vc.db"

This did not fix the issue. I kept the path exactly as described. I could see vc.db , vc.db-shm and vc.db-wal files were created in the ${workspaceFolder}/.vscode directory.

In the log the following errors in the log.

LSP: (invoked) cpptools/fileCreated: file:///home/rahul/src/.vscode/ipch
LSP: (received) textDocument/hover: file:///home/rahul/src/storage/innobase/fil/fil0fil.cc (id: 63)
IntelliSense client not available, using Tag Parser for go to definition.
IntelliSense client not available, using Tag Parser for quick info.
using Tag Parser for quick info
LSP: $/cancelRequest (textDocument/hover, id: 63)

RahulSisondia avatar Nov 23 '23 18:11 RahulSisondia

With 1.18.5 we fixed a bug on Linux in which it wasn't using the $XDG_CACHE_HOME or $HOME/.cache. Does downgrading to 1.18.4 fix the issue? If so, there could be some issue with writing to that directory. #11693

using 1.18.4 also doesn;t fix the problem. Intellisensne doesn't work and I continue to see the followingn errors in log.

LSP: (invoked) textDocument/hover: file:///home/rahul/src/storage/innobase/fil/fil0fil.cc (id: 30)
IntelliSense client not available, using Tag Parser for go to definition.
IntelliSense client not available, using Tag Parser for quick info.
using Tag Parser for quick info
LSP: $/cancelRequest (textDocument/hover, id: 30)
LSP: (received) textDocument/hover: file:///home/rahul/src/storage/innobase/fil/fil0fil.cc (id: 31)
LSP: $/cancelRequest (textDocument/hover, id: 31)
LSP: (invoked) textDocument/hover: file:///home/rahul/src/storage/innobase/fil/fil0fil.cc (id: 31)
IntelliSense client not available, using Tag Parser for go to definition.
IntelliSense client not available, using Tag Parser for quick info.
using Tag Parser for quick info
LSP: (received) cpptools/textEditorSelectionChange
LSP: (received) cpptools/getCodeActions: file:///home/rahul/src/storage/innobase/fil/fil0fil.cc (id: 32)
LSP: (invoked) cpptools/textEditorSelectionChange

RahulSisondia avatar Nov 23 '23 18:11 RahulSisondia

Hi @RahulSisondia . Are you able to reproduce this issue with our latest pre-release, 1.19.2? There are some significant changes to how IntelliSense passes are managed and scheduled in 1.19.2. If this still occurs for you in 1.19.2, could you provide updated logs?

Colengms avatar Feb 09 '24 02:02 Colengms

Hi @RahulSisondia . Are you able to reproduce this issue with our latest pre-release, 1.19.2? There are some significant changes to how IntelliSense passes are managed and scheduled in 1.19.2. If this still occurs for you in 1.19.2, could you provide updated logs? I had downgraded to 1.17.5 . Will try with 1.19.2 and get back.

RahulSisondia avatar Feb 09 '24 06:02 RahulSisondia

Does using these remote or workspace settings fix the issue? (or some equivalent path, FYI, the intelliSenseCache path can be shared by workspaces, but you don't want the databaseFilename to be shared).

  "C_Cpp.intelliSenseCachePath": "${workspaceFolder}/.vscode",
  "C_Cpp.default.browse.databaseFilename": "${workspaceFolder}/.vscode/vc.db"

Had a similar problem, any version higher than 1.17.5 would crash the language server. I am developing on a remote Linux SSH as well. However, the above settings did not work for me. But I remembered I used to have problems with mounted NFS directories. Long story short, my home directory (which also contains the workspace directory) is a mounted NFS directory. Thus the cache destination $HOME/.cache is NFS mounted as well and apparently something goes wrong when that is the case.

My solution:

  • Add a symbolic link to a local cache directory or use the above mentioned settings but instead of using the workspace directory refer to a local directory.

I hope this is somewhat useful for others who have the same setup. 😄

Edit: More information on the setup can be found in closed issue #7558.

magdyabdel avatar Feb 23 '24 12:02 magdyabdel

Hi @RahulSisondia . Are you able to reproduce this issue with our latest pre-release, 1.19.2? There are some significant changes to how IntelliSense passes are managed and scheduled in 1.19.2. If this still occurs for you in 1.19.2, could you provide updated logs? I had downgraded to 1.17.5 . Will try with 1.19.2 and get back.

I am sorry, I still haven't got a chance to verify with latest version or 1.19.2. Hopefully I get to verify this week. But I learnt from a colleague that problem persist with 1.19.4 as well. There were no logs provided though.

RahulSisondia avatar Feb 27 '24 10:02 RahulSisondia

Hi @RahulSisondia . Are you able to reproduce this issue with our latest pre-release, 1.19.2? There are some significant changes to how IntelliSense passes are managed and scheduled in 1.19.2. If this still occurs for you in 1.19.2, could you provide updated logs? I had downgraded to 1.17.5 . Will try with 1.19.2 and get back.

I am sorry, I still haven't got a chance to verify with latest version or 1.19.2. Hopefully I get to verify this week. But I learnt from a colleague that problem persist with 1.19.4 as well. There were no logs provided though.

I upgraded to 1.19.8 version today. I no longer see the problem.
Problem persisted till 1.19.4, but not with 1.19.8. It indicates issue is fixed after 1.19.4 release. My guess is that it is fixed either through 1.19.5 or 1.19.6 versions.

RahulSisondia avatar Mar 16 '24 13:03 RahulSisondia