microsoft / pylance-release

Documentation and issues for Pylance
Creative Commons Attribution 4.0 International
1.69k stars 769 forks source link

Pylance has crashed. Would you like to try using a Node.js executable to run the language server? #6154

Open GXY0116 opened 1 month ago

GXY0116 commented 1 month ago

Pylance has crashed. Would you like to try using a Node.js executable to run the language server?

2024-07-17 14:56:44.584 [info] [Error - 2:56:44 PM] Sending document notification textDocument/didSave failed. 2024-07-17 14:56:44.597 [info] Error: Connection is disposed. at de (/dssg/home/acct-seeshb/seeshb-user1/.vscode-server/extensions/ms-python.python-2024.10.0-linux-x64/out/client/extension.js:2:1948291) at Object.sendNotification (/dssg/home/acct-seeshb/seeshb-user1/.vscode-server/extensions/ms-python.python-2024.10.0-linux-x64/out/client/extension.js:2:1949134) at S.sendNotification (/dssg/home/acct-seeshb/seeshb-user1/.vscode-server/extensions/ms-python.python-2024.10.0-linux-x64/out/client/extension.js:2:1992950) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async t (/dssg/home/acct-seeshb/seeshb-user1/.vscode-server/extensions/ms-python.python-2024.10.0-linux-x64/out/client/extension.js:2:2073066) 2024-07-17 14:56:44.901 [info] [Error - 2:56:44 PM] Notify file events failed. 2024-07-17 14:56:44.901 [info] Error: Connection is disposed. at de (/dssg/home/acct-seeshb/seeshb-user1/.vscode-server/extensions/ms-python.python-2024.10.0-linux-x64/out/client/extension.js:2:1948291) at Object.sendNotification (/dssg/home/acct-seeshb/seeshb-user1/.vscode-server/extensions/ms-python.python-2024.10.0-linux-x64/out/client/extension.js:2:1949134) at S.sendNotification (/dssg/home/acct-seeshb/seeshb-user1/.vscode-server/extensions/ms-python.python-2024.10.0-linux-x64/out/client/extension.js:2:1992950) at async t.Delayer. (/dssg/home/acct-seeshb/seeshb-user1/.vscode-server/extensions/ms-python.python-2024.10.0-linux-x64/out/client/extension.js:2:2004892) 2024-07-17 14:56:44.964 [info] [Error - 2:56:44 PM] Sending document notification textDocument/didSave failed. 2024-07-17 14:56:44.964 [info] Error: Connection is disposed. at de (/dssg/home/acct-seeshb/seeshb-user1/.vscode-server/extensions/ms-python.python-2024.10.0-linux-x64/out/client/extension.js:2:1948291) at Object.sendNotification (/dssg/home/acct-seeshb/seeshb-user1/.vscode-server/extensions/ms-python.python-2024.10.0-linux-x64/out/client/extension.js:2:1949134) at S.sendNotification (/dssg/home/acct-seeshb/seeshb-user1/.vscode-server/extensions/ms-python.python-2024.10.0-linux-x64/out/client/extension.js:2:1992950) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async t (/dssg/home/acct-seeshb/seeshb-user1/.vscode-server/extensions/ms-python.python-2024.10.0-linux-x64/out/client/extension.js:2:2073066) 2024-07-17 14:56:45.322 [info] [Error - 2:56:45 PM] Notify file events failed.

debonte commented 1 month ago

The log above looks like the log from the Python extension. Assuming that you are using Pylance as your language server (that's the default), could you please provide the Pylance log. It appears as "Python Language Server" in the Output pane.

umarbutler commented 1 month ago

+1 Pylance has been crashing and short circuiting much more than normal and I am now getting the error 'Pylance has crashed. Would you like to try using a Node.js executable to run the language server?'.

I've noticed that a variable will grey out of a sudden and then this error may come later.

umarbutler commented 1 month ago

For others who have been experiencing this issue, it seems to correlate with the release of 2024.7.1, so I have downgraded to 2024.6.1.

debonte commented 1 month ago

@umarbutler, can you provide a "Python Language Server" log from a case where Pylance crashed?

GXY0116 commented 1 month ago

The log above looks like the log from the Python extension. Assuming that you are using Pylance as your language server (that's the default), could you please provide the Pylance log. It appears as "Python Language Server" in the Output pane. 1721292703629 Thanks, that's the log of python language server

debonte commented 1 month ago

@GXY0116, can you provide the entire log? Drag it into the log as an attachment, assuming it's large.

GXY0116 commented 1 month ago

@GXY0116, can you provide the entire log? Drag it into the log as an attachment, assuming it's large.

Thanks, that's the entire log. log.txt

debonte commented 1 month ago

2024-07-19 00:23:45.268 [info] [Info - 12:23:45 AM] (2577591) Heap stats: total_heap_size=289MB, used_heap_size=256MB, cross_worker_used_heap_size=256MB, total_physical_size=289MB, total_available_size=3882MB, heap_size_limit=4144MB ... 2024-07-19 00:24:15.581 [info] [Error - 12:24:15 AM] Server process exited with signal SIGKILL.

Our best guess based on the log output above is that Pylance was killed by the Linux kernel when the machine ran low on memory. You could confirm that by checking dmesg after Pylance is killed. Here's dmesg output from my machine after I forced a process to be killed by Linux's OOM killer:

erikd@ERIKD:~$ (echo "li = []" ; echo "for r in range(9999999999999999): li.append(str(r))") | python3
Killed
erikd@ERIKD:~$ dmesg | tail -7
[146590.568889] [ 223208]     0 223208      572        0    40960       29             0 SessionLeader
[146590.568892] [ 223209]     0 223209      576        0    40960       31             0 Relay(183022)
[146590.568894] [ 223212]  1000 223212     2411        2    49152     1316             0 bash
[146590.568919] [ 223967]  1000 223967 10228732  7976248 81420288  2042808             0 python3
[146590.568921] [ 224465]     0 224465      509       19    36864        0             0 systemctl
[146590.568924] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/,task=python3,pid=223967,uid=1000
[146590.568954] Out of memory: Killed process 223967 (python3) total-vm:40914928kB, anon-rss:31904992kB, file-rss:0kB, shmem-rss:0kB, UID:1000 pgtables:79512kB oom_score_adj:0

Given that the total available physical memory is so small, I assume this is a container or virtual machine of some sort? Can you allocate more memory to the machine?

We have some guidance on ways to reduce the amount of memory that Pylance uses here: https://github.com/microsoft/pylance-release/wiki/Pylance-Configuration-Tips.

umarbutler commented 1 month ago

I have 64GB of RAM.

debonte commented 1 month ago

@umarbutler we don't have any evidence yet that the two of you are hitting the same issue. Can you file a new issue and attach a log file? We can always resolve one of them as a duplicate of the other if we determine that they are the same.

umarbutler commented 1 month ago

@debonte I'll be building a new PC within the next week or two so it makes more sense for me to use the older version, however, if the issue appears again (which would be on a completely new, more powerful build), I'll create a new ticket.

otavio-silva commented 1 month ago

Had the same error today. The language server was randomly disconnecting when running a Jupyter notebook. After installing the Pylance extension in the WSL distro instead of running in Windows, I got this: image

otavio-silva commented 1 month ago

I could reproduce the error running the notebook again, here's the log: pylance_wsl_log.txt

rchiodo commented 1 month ago

@otavio-silva's problem is this: Error: Debug Failure. False expression: Chained file path undefined doesn't match cellFilePaths file:///home/azakun/Documents/Code/Python/notebooks/Stable%20Diffusion%20XL/StableDiffisionXL.ipynb.py#X14sdnNjb2RlLXJlbW90ZQ%3D%3D at _0x2ee97f (/home/azakun/.vscode-server/extensions/ms-python.vscode-pylance-2024.7.1/dist/server.bundle.js:1:888452) at /home/azakun/.vscode-server/extensions/ms-python.vscode-pylance-2024.7.1/dist/server.bundle.js:1:817188

Not likely the same issue as the original poster. I'll link a new bug.

rhuanbarros commented 1 month ago

I have the same issue running in a devcontainer

heejaechang commented 1 month ago

@rhuanbarros can you open new issue. that error message is generic message for any crash. so having your own issue will help us to track your issue better.

wujhsu commented 1 month ago

I hope the method in this picture can help you. image

github-actions[bot] commented 2 days ago

Hey @debonte, this issue might need further attention.

@GXY0116, you can help us out by closing this issue if the problem no longer exists, or adding more information.