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

Can't format. Language client is never ready #2171

Closed
aartoni opened this issue Jun 22, 2018 · 8 comments
Closed

Can't format. Language client is never ready #2171

aartoni opened this issue Jun 22, 2018 · 8 comments
Labels
bug Language Service not reproing We're not able to reproduce the issue (it's unlikely to get fixed until we find one). reliability

Comments

@aartoni
Copy link

aartoni commented Jun 22, 2018

Bug description

  • OS and Version: macOS 10.13.5
  • VS Code Version: 1.24.1
  • C/C++ Extension Version: 0.17.5
  • Other extensions installed: ARM (dan-c-underwood.arm), Code Runner, Java Extension Pack, LaTeX Workshop, VSC-Prolog, Italian Language Pack. Disabling them didn't fix the issue.

Extension's log states that "Language client is not ready yet" each time I try to format a C/C++ document, every other feature is still working.

Expected behavior

File should be formatted.

Log

[2018-06-22 19:11:02.221] [renderer1] [error] Language client is not ready yet: Error: Language client is not ready yet
	at LanguageClient.sendRequest (/Users/atro/.vscode/extensions/ms-vscode.cpptools-0.17.5/node_modules/vscode-languageclient/lib/client.js:1473:19)
	at provideDocumentFormattingEdits (/Users/atro/.vscode/extensions/ms-vscode.cpptools-0.17.5/node_modules/vscode-languageclient/lib/client.js:1049:27)
	at me.requestWhenReady (/Users/atro/.vscode/extensions/ms-vscode.cpptools-0.17.5/out/src/LanguageServer/protocolFilter.js:15:42)
	at DefaultClient.requestWhenReady (/Users/atro/.vscode/extensions/ms-vscode.cpptools-0.17.5/out/src/LanguageServer/client.js:295:20)
	at Object.invoke3 (/Users/atro/.vscode/extensions/ms-vscode.cpptools-0.17.5/out/src/LanguageServer/protocolFilter.js:15:19)
	at Object.provideDocumentFormattingEdits (/Users/atro/.vscode/extensions/ms-vscode.cpptools-0.17.5/node_modules/vscode-languageclient/lib/client.js:1058:34)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:692:344
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:103:887
	at new n.Class.derive._oncancel (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:83:776)
	at Object.t.asWinJsPromise (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:103:850)
	at e.provideDocumentFormattingEdits (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:692:298)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:705:793
	at e._withAdapter (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:701:385)
	at e.$provideDocumentFormattingEdits (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:705:755)
	at e._doInvokeHandler (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:636:832)
	at e._invokeHandler (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:636:550)
	at e._receiveRequest (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:635:631)
	at e._receiveOneMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:635:400)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:634:315
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:637:395
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:95:432
	at e.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:96:764)
	at Socket.<anonymous> (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:154:338)
	at emitOne (events.js:96:13)
	at Socket.emit (events.js:191:7)
	at readableAddChunk (_stream_readable.js:178:18)
	at Socket.Readable.push (_stream_readable.js:136:10)
	at Pipe.onread (net.js:560:20)

Additional context

Everything was fine until i closed and quickly opened the same .c file.
Rebooting, uninstalling and reinstalling the extension didn't fix the issue.
formatOnSave didn't work either.
clang-format is working.

Thanks in advance.

@sean-mcmanus
Copy link
Collaborator

sean-mcmanus commented Jun 22, 2018

@bobbrow @grdowns Is anyone else able to repro this? I'm not able to.

@sean-mcmanus sean-mcmanus added bug Language Service reliability not reproing We're not able to reproduce the issue (it's unlikely to get fixed until we find one). labels Jun 22, 2018
@bobbrow
Copy link
Member

bobbrow commented Jun 22, 2018

@AlessioAtroni do you see any Microsoft.VSCode.CPP.Extension.darwin processes running on your Mac? This isn't an error we've seen before. It comes from the LSP implementation (this repo) that communicates with our language service and implies that our service is either not running, not responsive, or crashed.

If you set "C_Cpp.loggingLevel": "Debug" do you see any messages in the Output panel when the "C/C++" filter is applied? Or does the "C/C++" filter not exist in the dropdown box?

@aartoni
Copy link
Author

aartoni commented Jun 22, 2018

@bobbrow Process Microsoft.VSCode.CPP.Extension.darwin isn't running

But C/C++ filter does appear, here is the log

Log (Debug level)

initialized
workspace/didChangeConfiguration
IntelliSense Engine = Default.
The extension will use the Tag Parser for IntelliSense when #includes don't resolve.
Autocomplete is enabled.
Error squiggles are enabled.
File exclude: **/.git
File exclude: **/.svn
File exclude: **/.hg
File exclude: **/CVS
File exclude: **/.DS_Store
File exclude: **/.class
File exclude: **/*.aux
File exclude: **/*.fdb_latexmk
File exclude: **/*.fls
File exclude: **/*.synctex.gz
File exclude: **/*.toc
File exclude: **/*.out
File exclude: **/*.log
File exclude: **/*.pdf
File exclude: **/*.class
File exclude: **/*.dSYM
File exclude: **/.vscode
Search exclude: **/node_modules
Search exclude: **/bower_components
Search exclude: **/.vscode
textDocument/didOpen
cpptools/queryCompilerDefaults
Attempting to get defaults from compiler found on the machine: '/usr/bin/clang'
terminating child process: 2530
Attempting to get defaults from compiler found on the machine: '/usr/bin/clang'
terminating child process: 2532
cpptools/activeDocumentChange
cpptools/textEditorSelectionChange
textDocument/codeAction
cpptools/didChangeFolderSettings
Warning: Database safety check failed. Recreating database.
[rc=0x80004005] (DB: false, Expected: true)
Code browsing service initialized

@sean-mcmanus
Copy link
Collaborator

The Language client is not ready message can occur when our main process crashes. I just hit this when I had a includePath with just "**" in it: #2174 , which we should have a fix for in our next update. If you can attach a debugger and/or get a call stack of the crash we can confirm if it's the same crash or a different one.

@aartoni
Copy link
Author

aartoni commented Jun 23, 2018

Additional context

I noticed this only happens if I format the file with no opened folder in VSCode, this happens for both .c and .cpp files.

Debug console output (from git-cloned extension)

/Applications/Visual Studio Code.app/Contents/MacOS/Electron --debugBrkPluginHost=33668 --debugId=8a698322-0917-4dad-8d27-dd123d0d888d --extensionDevelopmentPath=/Users/atro/Downloads/vscode-cpptools/Extension 
activating extension
extension.js:35
starting language server
extension.js:119
AssertionError: 'oldOwner' should not be in the list of clients to consider
events.js:74
	at Console.assert (console.js:95:23)
	at ClientCollection.transferOwnership (/Users/atro/Downloads/vscode-cpptools/Extension/out/src/LanguageServer/clientCollection.js:122:17)
	at __dirname.replace.client.TrackedDocuments.forEach.document (/Users/atro/Downloads/vscode-cpptools/Extension/out/src/LanguageServer/clientCollection.js:80:66)
	at Set.forEach (native)
	at ClientCollection.replace (/Users/atro/Downloads/vscode-cpptools/Extension/out/src/LanguageServer/clientCollection.js:80:41)
	at Object.closed (/Users/atro/Downloads/vscode-cpptools/Extension/out/src/LanguageServer/client.js:188:52)
	at LanguageClient.handleConnectionClosed (/Users/atro/Downloads/vscode-cpptools/Extension/node_modules/vscode-languageclient/lib/client.js:1868:55)
	at LanguageClient.handleConnectionClosed (/Users/atro/Downloads/vscode-cpptools/Extension/node_modules/vscode-languageclient/lib/main.js:106:15)
	at closeHandler (/Users/atro/Downloads/vscode-cpptools/Extension/node_modules/vscode-languageclient/lib/client.js:1852:18)
	at CallbackList.invoke (/Users/atro/Downloads/vscode-cpptools/Extension/node_modules/vscode-jsonrpc/lib/events.js:71:39)
	at Emitter.fire (/Users/atro/Downloads/vscode-cpptools/Extension/node_modules/vscode-jsonrpc/lib/events.js:135:36)
	at closeHandler (/Users/atro/Downloads/vscode-cpptools/Extension/node_modules/vscode-jsonrpc/lib/main.js:221:26)
	at CallbackList.invoke (/Users/atro/Downloads/vscode-cpptools/Extension/node_modules/vscode-jsonrpc/lib/events.js:71:39)
	at Emitter.fire (/Users/atro/Downloads/vscode-cpptools/Extension/node_modules/vscode-jsonrpc/lib/events.js:135:36)
	at StreamMessageWriter.AbstractMessageWriter.fireClose (/Users/atro/Downloads/vscode-cpptools/Extension/node_modules/vscode-jsonrpc/lib/messageWriter.js:57:27)
	at Socket.<anonymous> (/Users/atro/Downloads/vscode-cpptools/Extension/node_modules/vscode-jsonrpc/lib/messageWriter.js:79:63)
	at emitOne (events.js:96:13)
	at Socket.emit (events.js:191:7)
	at Pipe.Socket._destroy.cb._handle.close [as _onclose] (net.js:510:12)
Assertion failed: 'oldOwner' should not be in the list of clients to consider
clientCollection.ts:172
    at transferOwnership (/Users/atro/Downloads/vscode-cpptools/Extension/src/LanguageServer/clientCollection.ts:172:17)
    at __dirname.replace.client.TrackedDocuments.forEach.document (/Users/atro/Downloads/vscode-cpptools/Extension/src/LanguageServer/clientCollection.ts:114:66)
    at replace (/Users/atro/Downloads/vscode-cpptools/Extension/src/LanguageServer/clientCollection.ts:114:41)
    at closed (/Users/atro/Downloads/vscode-cpptools/Extension/src/LanguageServer/client.ts:355:86)
    at handleConnectionClosed (/Users/atro/Downloads/vscode-cpptools/Extension/node_modules/vscode-languageclient/lib/client.js:1868:54)
    at handleConnectionClosed (/Users/atro/Downloads/vscode-cpptools/Extension/node_modules/vscode-languageclient/lib/main.js:106:14)
    at closeHandler (/Users/atro/Downloads/vscode-cpptools/Extension/node_modules/vscode-languageclient/lib/client.js:1852:17)
    at CallbackList.invoke (/Users/atro/Downloads/vscode-cpptools/Extension/node_modules/vscode-jsonrpc/lib/events.js:71:38)
    at Emitter.fire (/Users/atro/Downloads/vscode-cpptools/Extension/node_modules/vscode-jsonrpc/lib/events.js:135:35)
    at closeHandler (/Users/atro/Downloads/vscode-cpptools/Extension/node_modules/vscode-jsonrpc/lib/main.js:221:25)
    at CallbackList.invoke (/Users/atro/Downloads/vscode-cpptools/Extension/node_modules/vscode-jsonrpc/lib/events.js:71:38)
    at Emitter.fire (/Users/atro/Downloads/vscode-cpptools/Extension/node_modules/vscode-jsonrpc/lib/events.js:135:35)
    at AbstractMessageWriter.fireClose (/Users/atro/Downloads/vscode-cpptools/Extension/node_modules/vscode-jsonrpc/lib/messageWriter.js:57:26)
    at (anonymous) (/Users/atro/Downloads/vscode-cpptools/Extension/node_modules/vscode-jsonrpc/lib/messageWriter.js:79:62)
    at emitOne (events.js:96:12)
    at emit (events.js:191:6)
    at Socket._destroy.cb._handle.close (net.js:510:11)
ApplicationInsights:Sender
Logging.js:20

@greennerve
Copy link

I encountered the same issue.

Log:

initialized
workspace/didChangeConfiguration
IntelliSense Engine = Default.
The extension will use the Tag Parser for IntelliSense when #includes don't resolve.
Autocomplete is enabled.
Error squiggles are enabled.
File exclude: **/.git
File exclude: **/.svn
File exclude: **/.hg
File exclude: **/CVS
File exclude: **/.DS_Store
File exclude: **/.vscode
Search exclude: **/node_modules
Search exclude: **/bower_components
Search exclude: **/.vscode
textDocument/didOpen
cpptools/queryCompilerDefaults
Attempting to get defaults from compiler found on the machine: '/usr/bin/clang'
terminating child process: 6962
cpptools/activeDocumentChange
cpptools/textEditorSelectionChange
textDocument/codeAction
cpptools/didChangeFolderSettings
Warning: Database safety check failed. Recreating database.
[rc=0x80004005] (DB: false, Expected: true)
Code browsing service initialized

@sean-mcmanus
Copy link
Collaborator

Is this fixed with 0.17.6? We fixed some issues that could cause it.

@greennerve
Copy link

It's working now after upgrading to 0.17.6

@github-actions github-actions bot locked and limited conversation to collaborators Oct 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Language Service not reproing We're not able to reproduce the issue (it's unlikely to get fixed until we find one). reliability
Projects
None yet
Development

No branches or pull requests

4 participants