-
Notifications
You must be signed in to change notification settings - Fork 767
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
The Pylance server crashed 5 times in the last 3 minutes in a .py file + .ipynb opened in editor #3510
Comments
Observed exactly the same thing #3453 (comment) |
@benchoi93 yours seems not the same one as this issue. can you open new issue with log? |
@tautomer and @kryzhikov what is this setting? And this one: Can you make sure those are both enabled? Otherwise, there are incompatibilities between the jupyter extension and the pylance extension. |
Additionally, if you upgrade the jupyter extension, the python extension, and the pylance extension to the preview versions, this problem should go away. These settings are not allowed in newer versions and are always true. |
IIRC, I never checked these two settings myself, but they are both enabled. Jupyter extension is latest stable (v2022.9.1202862440). All recent pylance versions seem to have the problem. I'm using v2022.9.10 right now which has been working fine since this morning.
I never tried pre-release for all 3, only pylance. Let me test this out this afternoon. |
I'm trying to repro and it doesn't seem to crash. @tautomer can you share your python file and the notebook you used? And what actions you took after opening? It sounded like you just needed the two files open for the crash to occur? |
Hi Rich, thanks for the test. I think we can narrow down the problem even more. Another requirement to trigger the problem might be a big enough file structure. I have recorded my screen, but I'm not sure if I can share it here. National lab policies... Let me ask someone tomorrow. To briefly summarize, here is what I have for test
The log right before crash is like
/project/ml4chem/xinyang is the big_folder. If I open any child directory, it's fine. For example, the I just tested another huge folder on a different cluster and observed the same problem. For comparison, the older version 2022.9.10
It looks to me that newer versions somehow decides to restart the server when indexing takes too long. Because the folder is big, indexing is always slow, pylance will keep restart until hitting 5 times and crash. However, if only one file is opened, the log from newer pylance looks exactly the same. |
Hmm, seems like it needs something large enough that it decides to cancel indexing. I can probably artificially cause that. |
Yep, I couldn't reproduce this problem either only my local computer, unless manually create lots of dummy files. Got the permission to upload recordings if they help at all. Here is what happens when opening the grand grandparent folder (38 GB) with notebook and python side by side. Screen.Recording.2022-10-26.at.7.38.56.PM.movSame thing for the parent of grandparent (18 GB). No problem at all. Screen.Recording.2022-10-26.at.7.41.08.PM.movOr open the the grand grandparent folder, but only opening one notebook. No crash, but I think once you open another file in group 2, it will crash eventually, as pylance will decide to cancel indexing. I could be wrong here. Screen.Recording.2022-10-26.at.7.41.43.PM.mov |
@tautomer, when it crashes can you upload the pylance language server log? The crash is happening in worker when handling a message.
It would really help if I knew what the message was. The log should have it somewhere above where the error is output. It should look something like this:
You have to set logging to full trace first though. |
I'm still having trouble reproing. Even with opening a huge folder with 1000s of python files. |
Here you go. A log with full trace from window loading till pylance crashes. I suspect it's not just python files, but the total number of all file? I don't really know how pylance's indexer works though, just my guess. Another huge directory has (I think) only 3 python files indexed, but many other files are in the folder. pylance crashes as well. (I can double check this tonight.) I also did a test with one of my conda environment folders. There are almost 28K python files. Indexing is slow as well and hit 2000-file limit, but no crashes. |
Thanks that helps. It looks like it's getting semantic tokens. |
can you set "python.analysis.indexing": false in your settings.json and see whether it still repro? |
I believe I have the same problem. I don't know if this is related, but Pylance is incredibly slow at parsing my .py file with ~600 lines, taking about 10 seconds for each change I do in the file, often queueing up and resulting in very long waiting times. This mostly goes away when setting "python.analysis.indexing": false. |
for the issue above, can you provide us some logs as described in the troubleshooting guide? |
Unfortunately, now that I try again in order to provide a log, I am inexplicably unable to reproduce the slowness anymore, even though this has been a problem for a while. It now uses only 2 to 3 seconds to react to my edit. I can come back to this if the problem returns. In the meantime, here is the log from a run I did showcasing the original problem (the crash) which can still be reproduced reliably: pylance_log_crash_2.txt. Here, I launched VS Code with a notebook and a .py file side by side, and the Pylance server crashed 5 times. |
@tautomer we have a potential fix. If you'd like to try it out, I can send you a private vsix with the bits in it. Please contact me at my github id at microsoft.com if that's okay with you. |
No more crashes after setting this false.
Sent. |
@tautomer, in case it's not obvious, please turn indexing back on in the private I sent you. |
This issue has been fixed in prerelease version 2022.11.11, which we've just released. You can find the changelog here: CHANGELOG.md |
Environment data
Code Snippet
Repro Steps
Expected behavior
Pylance working smoothly
Actual behavior
Pylance crashes multiple times, if closing .py file or .ipynb file, errors disappear
Logs
Short logs
The text was updated successfully, but these errors were encountered: