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

Language server crashes on broken symlinks #1102

Closed
josiah-skydio opened this issue Mar 29, 2021 · 7 comments
Closed

Language server crashes on broken symlinks #1102

josiah-skydio opened this issue Mar 29, 2021 · 7 comments
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version

Comments

@josiah-skydio
Copy link

Environment data

  • Language Server version: 2021.3.3 (pyright be28f16e)
  • OS and version: Ubuntu 16.04
  • Python version (& distribution if applicable, e.g. Anaconda): 2.7

Expected behaviour

Language server does not crash

Actual behaviour

The issue persists across reboots along with a fresh install of pylance/vscode.

Logs

[Info  - 2:51:01 PM] Server root directory: /home/josiah/.vscode-server/extensions/ms-python.vscode-pylance-2021.3.3/dist
[Info  - 2:51:01 PM] No configuration file found.
[Info  - 2:51:01 PM] Setting pythonPath for service "<redacted>": "/home/josiah/<redacted>"
Search paths found for configured python interpreter:
 <redacted>
  /usr/lib/python2.7
  /usr/lib/python2.7/plat-x86_64-linux-gnu
  /usr/lib/python2.7/lib-tk
  /usr/lib/python2.7/lib-dynload
  /home/josiah/.local/lib/python2.7/site-packages
  /usr/local/lib/python2.7/dist-packages
  /usr/lib/python2.7/dist-packages
  /usr/lib/python2.7/dist-packages/gtk-2.0
  /usr/lib/python2.7/dist-packages/wx-3.0-gtk2
[Warn  - 2:51:02 PM] stubPath /home/josiah/<redacted> is not a valid directory.
[Warn  - 2:51:02 PM] Python version 2.7 from interpreter is unsupported
[Info  - 2:51:02 PM] Assuming Python platform Linux
[Info  - 2:51:02 PM] Searching for source files
[Info  - 2:51:56 PM] Background analysis(1) root directory: /home/josiah/.vscode-server/extensions/ms-python.vscode-pylance-2021.3.3/dist
[Info  - 2:51:56 PM] Background analysis(1) started
Background analysis message: setConfigOptions
Background analysis message: markFilesDirty
Background analysis message: markFilesDirty
Background analysis message: markFilesDirty
Background analysis message: markFilesDirty
Background analysis message: markFilesDirty
Background analysis message: markFilesDirty
Background analysis message: markFilesDirty
[Info  - 2:51:56 PM] Searching for source files
Error: ENOENT: no such file or directory, lstat '/run/systemd/generator/dev-disk-by'
    at Object.realpathSync (fs.js:1621:7)
    at h.realpathSync (/home/josiah/.vscode-server/extensions/ms-python.vscode-pylance-2021.3.3/dist/pyright-internal/src/common/fileSystem.ts:158:19)
    at t.PyrightFileSystem.realpathSync (/home/josiah/.vscode-server/extensions/ms-python.vscode-pylance-2021.3.3/dist/pyright-internal/src/pyrightFileSystem.ts:123:29)
    at visitDirectory (/home/josiah/.vscode-server/extensions/ms-python.vscode-pylance-2021.3.3/dist/pyright-internal/src/analyzer/service.ts:1012:42)
    at visitDirectoryUnchecked (/home/josiah/.vscode-server/extensions/ms-python.vscode-pylance-2021.3.3/dist/pyright-internal/src/analyzer/service.ts:1004:25)
    at visitDirectory (/home/josiah/.vscode-server/extensions/ms-python.vscode-pylance-2021.3.3/dist/pyright-internal/src/analyzer/service.ts:1020:17)
    at visitDirectoryUnchecked (/home/josiah/.vscode-server/extensions/ms-python.vscode-pylance-2021.3.3/dist/pyright-internal/src/analyzer/service.ts:1004:25)
    at visitDirectory (/home/josiah/.vscode-server/extensions/ms-python.vscode-pylance-2021.3.3/dist/pyright-internal/src/analyzer/service.ts:1020:17)
    at visitDirectoryUnchecked (/home/josiah/.vscode-server/extensions/ms-python.vscode-pylance-2021.3.3/dist/pyright-internal/src/analyzer/service.ts:1004:25)
    at a (/home/josiah/.vscode-server/extensions/ms-python.vscode-pylance-2021.3.3/dist/pyright-internal/src/analyzer/service.ts:1020:17)
[Info  - 2:52:39 PM] Connection to server got closed. Server will restart.
@jakebailey
Copy link
Member

It seems like you have a symlink in your workspace that points to that file, can you check to see if that's the case?

Also note that we don't support Python 2, so you may not have good functionality.

In any case, I didn't think realpath had the potential to fail. I'll try and catch this; must be an issue with non-regular files (like that device).

@jakebailey
Copy link
Member

More likely, this was a broken symlink. Those were rare and our code didn't fully handle that case in the places that manually work with symlinks (rather than relying on them working transparently).

@josiah-skydio josiah-skydio changed the title Language server crashes after update Language server crashes on broken symlinks Mar 29, 2021
@josiah-skydio
Copy link
Author

Removing the broken symlink resolved the issue. Thanks for the quick response @jakebailey. I mistakenly thought this corresponded with a version update (updated the title to reflect the actual issue).

@jakebailey
Copy link
Member

This is still a bug that I intend to fix, so I'll leave this open (see the linked PR).

@jakebailey jakebailey reopened this Mar 29, 2021
@jakebailey
Copy link
Member

I mistakenly thought this corresponded with a version update (updated the title to reflect the actual issue).

You're not too far off; we recently added support for symlinks. Previously, they were ignored.

@jakebailey jakebailey added the fixed in next version (main) A fix has been implemented and will appear in an upcoming version label Mar 29, 2021
@jakebailey
Copy link
Member

This will be fixed in the next version.

@jakebailey
Copy link
Member

This issue has been fixed in version 2021.3.4, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/main/CHANGELOG.md#202134-31-march-2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version
Projects
None yet
Development

No branches or pull requests

2 participants