Pylance-release: Language server crashes on broken symlinks

Created on 30 Mar 2021  路  7Comments  路  Source: microsoft/pylance-release

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] Pylance language server 2021.3.3 (pyright be28f16e) starting [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.

    bug fixed in next version

    All 7 comments

    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).

    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).

    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).

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

    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.

    This will be fixed in the next version.

    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

    Was this page helpful?
    0 / 5 - 0 ratings