You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Language Client to should log stderr on launch failures #1185
There was a issue with one of the libraries we use for Jedi language server. The error object that we got from client.start() did not have the right info the diagnose the problem. The problem was reported to stderr, and that was captures it would have been easier to diagnose.
The exception that we got back did not contain any content from stderr.
This is the error that we got by default:
Unhandled Promise Rejection with the message Error: Pending response rejected since connection got disposed, Error, Pending response rejected since connection got disposed, Error: Pending response rejected since connection got disposed
at Object.dispose (/home/runner/work/vscode-python/vscode-python/tmp/ext/smokeTestExtensionsFolder/out/client/extension.js:2:2010343)
at Object.dispose (/home/runner/work/vscode-python/vscode-python/tmp/ext/smokeTestExtensionsFolder/out/client/extension.js:2:2062116)
at w.handleConnectionClosed (/home/runner/work/vscode-python/vscode-python/tmp/ext/smokeTestExtensionsFolder/out/client/extension.js:2:2062394)
at w.handleConnectionClosed (/home/runner/work/vscode-python/vscode-python/tmp/ext/smokeTestExtensionsFolder/out/client/extension.js:2:2217075)
at /home/runner/work/vscode-python/vscode-python/tmp/ext/smokeTestExtensionsFolder/out/client/extension.js:2:2062204
at invoke (/home/runner/work/vscode-python/vscode-python/tmp/ext/smokeTestExtensionsFolder/out/client/extension.js:2:2012056)
at o.fire (/home/runner/work/vscode-python/vscode-python/tmp/ext/smokeTestExtensionsFolder/out/client/extension.js:2:2012821)
at Z (/home/runner/work/vscode-python/vscode-python/tmp/ext/smokeTestExtensionsFolder/out/client/extension.js:2:1998699)
at invoke (/home/runner/work/vscode-python/vscode-python/tmp/ext/smokeTestExtensionsFolder/out/client/extension.js:2:2012056)
at o.fire (/home/runner/work/vscode-python/vscode-python/tmp/ext/smokeTestExtensionsFolder/out/client/extension.js:2:2012821)
at fireClose (/home/runner/work/vscode-python/vscode-python/tmp/ext/smokeTestExtensionsFolder/out/client/extension.js:2:2020641)
at Socket.<anonymous> (/home/runner/work/vscode-python/vscode-python/tmp/ext/smokeTestExtensionsFolder/out/client/extension.js:2:2022197)
at Socket.emit (node:events:538:35)
at Pipe.<anonymous> (node:net:687:12)
I had to manually launch the server and capture the stderr, I was expecting this info to be available somewhere
stderr: Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.11.1/x64/lib/python3.11/importlib/metadata/__init__.py", line 563, in from_name
return next(cls.discover(name=name))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
StopIteration
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/runner/work/vscode-python/vscode-python/tmp/ext/smokeTestExtensionsFolder/pythonFiles/run-jedi-language-server.py", line 9, in <module>
from jedi_language_server.cli import cli
File "/home/runner/work/vscode-python/vscode-python/tmp/ext/smokeTestExtensionsFolder/pythonFiles/lib/jedilsp/jedi_language_server/__init__.py", line 9, in <module>
__version__ = version("jedi-language-server")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.1/x64/lib/python3.11/importlib/metadata/__init__.py", line 1008, in version
return distribution(distribution_name).version
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.1/x64/lib/python3.11/importlib/metadata/__init__.py", line [981](https://github.com/microsoft/vscode-python/actions/runs/4058684315/jobs/6985942719#step:3:995), in distribution
return Distribution.from_name(distribution_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.1/x64/lib/python3.11/importlib/metadata/__init__.py", line 565, in from_name
raise PackageNotFoundError(name)
importlib.metadata.PackageNotFoundError: No package metadata was found for jedi-language-server
ERROR: Error: Command failed: /opt/hostedtoolcache/Python/3.11.1/x64/bin/python /home/runner/work/vscode-python/vscode-python/tmp/ext/smokeTestExtensionsFolder/pythonFiles/run-jedi-language-server.py
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.11.1/x64/lib/python3.11/importlib/metadata/__init__.py", line 563, in from_name
return next(cls.discover(name=name))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
StopIteration
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/runner/work/vscode-python/vscode-python/tmp/ext/smokeTestExtensionsFolder/pythonFiles/run-jedi-language-server.py", line 9, in <module>
from jedi_language_server.cli import cli
File "/home/runner/work/vscode-python/vscode-python/tmp/ext/smokeTestExtensionsFolder/pythonFiles/lib/jedilsp/jedi_language_server/__init__.py", line 9, in <module>
__version__ = version("jedi-language-server")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.1/x64/lib/python3.11/importlib/metadata/__init__.py", line 1008, in version
return distribution(distribution_name).version
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.1/x64/lib/python3.11/importlib/metadata/__init__.py", line 981, in distribution
return Distribution.from_name(distribution_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.1/x64/lib/python3.11/importlib/metadata/__init__.py", line 565, in from_name
raise PackageNotFoundError(name)
importlib.metadata.PackageNotFoundError: No package metadata was found for jedi-language-server
at ChildProcess.exithandler (node:child_process:408:12)
at ChildProcess.emit (node:events:526:28)
at maybeClose (node:internal/child_process:1092:16)
at Socket.<anonymous> (node:internal/child_process:451:11)
at Socket.emit (node:events:526:28)
at Pipe.<anonymous> (node:net:687:12)
Unhandled Promise Rejection with the message Error: Pending response rejected since connection got disposed, Error, Pending response rejected since connection got disposed, Error: Pending response rejected since connection got disposed
at Object.dispose (/home/runner/work/vscode-python/vscode-python/tmp/ext/smokeTestExtensionsFolder/out/client/extension.js:2:2010529)
at Object.dispose (/home/runner/work/vscode-python/vscode-python/tmp/ext/smokeTestExtensionsFolder/out/client/extension.js:2:2062302)
at w.handleConnectionClosed (/home/runner/work/vscode-python/vscode-python/tmp/ext/smokeTestExtensionsFolder/out/client/extension.js:2:2062580)
at w.handleConnectionClosed (/home/runner/work/vscode-python/vscode-python/tmp/ext/smokeTestExtensionsFolder/out/client/extension.js:2:2217261)
at /home/runner/work/vscode-python/vscode-python/tmp/ext/smokeTestExtensionsFolder/out/client/extension.js:2:2062390
at invoke (/home/runner/work/vscode-python/vscode-python/tmp/ext/smokeTestExtensionsFolder/out/client/extension.js:2:2012242)
at o.fire (/home/runner/work/vscode-python/vscode-python/tmp/ext/smokeTestExtensionsFolder/out/client/extension.js:2:2013007)
at Z (/home/runner/work/vscode-python/vscode-python/tmp/ext/smokeTestExtensionsFolder/out/client/extension.js:2:1998885)
at invoke (/home/runner/work/vscode-python/vscode-python/tmp/ext/smokeTestExtensionsFolder/out/client/extension.js:2:2012242)
at o.fire (/home/runner/work/vscode-python/vscode-python/tmp/ext/smokeTestExtensionsFolder/out/client/extension.js:2:2013007)
at fireClose (/home/runner/work/vscode-python/vscode-python/tmp/ext/smokeTestExtensionsFolder/out/client/extension.js:2:2020827)
at Socket.<anonymous> (/home/runner/work/vscode-python/vscode-python/tmp/ext/smokeTestExtensionsFolder/out/client/extension.js:2:2022383)
at Socket.emit (node:events:538:35)
at Pipe.<anonymous> (node:net:687:12)
Dirk Bäumer (@dbaeumer) the output channel certainly has that data. But when running in CI there is no easy way to see this. What do you suggest? Is there a way to get client to log to console as well as output channel?
There is currently no support for this and I don't want to log to the dev console all the time. This is why we have the output channels in VS Code. I think we would need a special command line flag that tells VS Code that it runs in such a CI environment and then I could also log to the dev console.
Activity
dbaeumer commentedon Feb 1, 2023
I do this for all code paths except when the server options is a function and the extension author is responsible for starting the server. See
vscode-languageserver-node/client/src/node/main.ts
Line 248 in 56baebb
How do you start the server?
karthiknadig commentedon Feb 1, 2023
We create it using the
commandandargsserver options:https://github.com/microsoft/vscode-python/blob/92d2d853e41bae2fe5044a6fb782fbde3f7a04f6/src/client/activation/jedi/languageClientFactory.ts#L18-L32
This is where we call
client.start():https://github.com/microsoft/vscode-python/blob/92d2d853e41bae2fe5044a6fb782fbde3f7a04f6/src/client/activation/jedi/languageServerProxy.ts#L55-L64
The
exceptionthat we got back did not contain any content fromstderr.This is the error that we got by default:
I had to manually launch the server and capture the stderr, I was expecting this info to be available somewhere
dbaeumer commentedon Feb 2, 2023
Then you should go through this code:
vscode-languageserver-node/client/src/node/main.ts
Line 465 in 56baebb
The stderr should be printed to the output channel using one of these lines:
vscode-languageserver-node/client/src/node/main.ts
Line 470 in 56baebb
Can you debug the client and see if any of the
serverProcess.stderr.on('data'will be hit in our case?karthiknadig commentedon Feb 7, 2023
Dirk Bäumer (@dbaeumer) the output channel certainly has that data. But when running in CI there is no easy way to see this. What do you suggest? Is there a way to get client to log to console as well as output channel?
dbaeumer commentedon Feb 8, 2023
There is currently no support for this and I don't want to log to the dev console all the time. This is why we have the output channels in VS Code. I think we would need a special command line flag that tells VS Code that it runs in such a CI environment and then I could also log to the dev console.