pylance-release
pylance-release copied to clipboard
Unexplained Crash in Pylance
Pylance crashes on me regularly and I cannot use it. Worse, Jedi
seems to want a python folder that doesn't exist so I have no python language server available. I am using VS Code and Pylance in an Ubuntu 22.04 server that is running inside a docker container on my Mac, using Python 3.11.3 in that ubuntu server.
Environment data
- Language Server version: v2023.11.10
- OS and version: Mac OS 14.1.1/Ubuntu 22.04 in Docker
- Python version (& distribution if applicable, e.g. Anaconda): 3.11.3
Code Snippet
It does not appear to be code related. I see lots of binding
/parsing
pairs in the Output, followed by occasional Heap Stat lines
Example:
2023-12-08 15:48:39.464 [info] [Info - 3:48:39 PM] (4943) Heap stats: total_heap_size=486MB, used_heap_size=436MB, total_physical_size=485MB, total_available_size=1651MB, heap_size_limit=2096MB
Then suddenly, a bunch of
2023-12-08 15:56:08.318 [info] [Error - 3:56:08 PM] Client Pylance: connection to server is erroring.
write EPIPE
Then many:
Shutting down server.
2023-12-08 15:56:08.320 [info] [Error - 3:56:08 PM] Stopping server failed
2023-12-08 15:56:08.320 [info] TypeError: e.clear is not a function
at _.cleanUp (/root/.vscode-server/extensions/ms-python.python-2023.22.0/out/client/extension.js:2:2396933)
at _.shutdown (/root/.vscode-server/extensions/ms-python.python-2023.22.0/out/client/extension.js:2:2396109)
at _.stop (/root/.vscode-server/extensions/ms-python.python-2023.22.0/out/client/extension.js:2:2395537)
at _.stop (/root/.vscode-server/extensions/ms-python.python-2023.22.0/out/client/extension.js:2:2561925)
at _.handleConnectionError (/root/.vscode-server/extensions/ms-python.python-2023.22.0/out/client/extension.js:2:2402056)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2023-12-08 15:56:08.320 [info] [Error - 3:56:08 PM] Stopping server failed
2023-12-08 15:56:08.320 [info] Error: Client is stopping but no stop promise available.
Then finally, a lot of:
2023-12-08 15:56:08.384 [info] [Error - 3:56:08 PM] Sending document notification textDocument/didChange failed
2023-12-08 15:56:08.384 [info] Message: Client is not running
Code: -32096
And that's all.
Expected behavior
Pylance won't crash
Logs
See above. I can provide full logs if necessary, but it doesn't matter what
[info] TypeError: e.clear is not a function
This is a dupe of https://github.com/microsoft/pylance-release/issues/5000, which has been fixed in our prerelease builds.
@debonte I switched to the prerelease version and now I'm getting a different issue. VS Code repeatedly had to "reconnect to server" to get back into the Docker container, and after 3 of those cycles, I received a bunch of:
2023-12-08 22:13:32.390 [info] [Error - 10:13:32 PM] Client Pylance: connection to server is erroring.
Channel closed
Shutting down server.
followed by:
2023-12-08 22:13:32.390 [info] [Error - 10:13:32 PM] Server process exited with signal SIGKILL.
2023-12-08 22:13:32.390 [info] (75546) [IDX(2)] parsing: /usr/local/lib/python3.11/site-packages/cryptography/__about__.py [fs read 8ms] (26ms)
2023-12-08 22:13:32.393 [info] [Error - 10:13:32 PM] Connection to server got closed. Server will not be restarted.
2023-12-08 22:13:32.394 [info] [Error - 10:13:32 PM] Stopping server failed
2023-12-08 22:13:32.394 [info] Message: Pending response rejected since connection got disposed
Code: -32097
You may have fixed one issue, but Pylance is still completely unusable for me.
Ok, I'll see if I can reproduce this.
Could you provide a complete log file?
Also, is your code publicly available somewhere?
My code is not publicly available, unfortunately. I’m away from my desk at the moment but will provide a complete log file. I assume it’s just a log file of the Python Language Server from VS Code startup to final crash of Pylance?
On Dec 8, 2023, at 4:46 PM, Erik De Bonte @.***> wrote:
Ok, I'll see if I can reproduce this.
Could you provide a complete log file?
Also, is your code publicly available somewhere?
— Reply to this email directly, view it on GitHub https://github.com/microsoft/pylance-release/issues/5230#issuecomment-1847936545, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMHNFJPEDKRLDXJGOKB2QTYIOKFNAVCNFSM6AAAAABAM32PNGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBXHEZTMNJUGU. You are receiving this because you authored the thread.
I assume it’s just a log file of the Python Language Server from VS Code startup to final crash of Pylance?
Yes, please.
This appears to actually be a problem with pylance in the docker container when the docker container runs out of memory allocated to it. I started having problems with pytest
inside the container as well, and my suspicions were aroused when I looked at the container usage and saw it was around 90%. I allocated more memory to the docker container, and restarted, and ever since then I haven't had pylance crash (or pytest). Sounds like a situation where handling with better logging would help. I think this can be closed (or converted into a "improve logging in low memory situations" ticket
did you see something like this in other output window? like this issue? https://github.com/microsoft/pylance-release/issues/5236
that's usually what should happen when OOM happened.
<--- Last few GCs --->
[7640:000002A8D5000000] 106 ms: Scavenge 2.3 (3.0) -> 2.2 (4.0) MB, 2.1 / 0.0 ms (average mu = 0.150, current mu = 0.000) allocation failure
[7640:000002A8D5000000] 153 ms: Scavenge 3.8 (4.5) -> 3.7 (4.5) MB, 2.2 / 0.0 ms (average mu = 0.150, current mu = 0.000) allocation failure
[7640:000002A8D5000000] 202 ms: Scavenge 4.4 (5.0) -> 4.3 (5.0) MB, 2.4 / 0.0 ms (average mu = 0.150, current mu = 0.000) allocation failure
<--- JS stacktrace --->
==== JS stack trace =========================================
0: ExitFrame [pc: 00007FF618D4C5C1]
1: StubFrame [pc: 00007FF618D547A3]
Security context: 0x0037f08c08d1 <JSObject>
2: /* anonymous */ [0000037F08C07439] [D:\Work\project\node_modules\some-module\index.js:~100] [pc=000003A2D5DCD69A](this=0x037f08c28219 <JSGlobal Object>,0x037f08c2c2a1 <String[68]: Error: ENOMEM: not enough memory, read>,0x037f08c2c2a1 <String[68]: Error: ENOMEM: not en...
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 00007FF6186EFD0A v8::internal::GCIdleTimeHandler::GCIdleTimeHandler+4506
2: 00007FF6186C88A6 node::MakeCallback+4534
3: 00007FF6186C9250 node_module_register+2032
4: 00007FF6189F1DEE v8::internal::FatalProcessOutOfMemory+846
5: 00007FF6189F1CFF v8::internal::FatalProcessOutOfMemory+639
6: 00007FF618BD37B4 v8::internal::Heap::MaxHeapGrowingFactor+9620
7: 00007FF618BCA5E6 v8::internal::ScavengeJob::operator=+24550
8: 00007FF618BC8C5C v8::internal::ScavengeJob::operator=+17980
9: 00007FF618BD1C17 v8::internal::Heap::MaxHeapGrowingFactor+2327
10: 00007FF618BD1C6F v8::internal::Heap::MaxHeapGrowingFactor+2431
11: 00007FF618D4C5C1 v8::internal::Factory::NewFillerObject+209
12: 00007FF618D547A3 v8::internal::operator<<+73427
13: 000003A2D5DCD69A
@heejaechang I do not recall seeing anything like this in any other window, but did not look at every output window. I have not had a recurrence of this since increasing the memory allocation for docker
@heejaechang and @debonte I just received a Pylance crash just now. I don't know if this is a new issue, or similar. The Window
output log shows:
at /root/.vscode-server/extensions/ms-python.vscode-pylance-2023.12.1/dist/extension.bundle.js:1:139672
at _0x1be708 (/root/.vscode-server/extensions/ms-python.vscode-pylance-2023.12.1/dist/extension.bundle.js:1:152856)
at async $e.provideCompletionItems (/root/.vscode-server/bin/05047486b6df5eb8d44b2ecd70ea3bdf775fd937/out/vs/workbench/api/node/extensionHostProcess.js:150:99151)
2024-02-02 14:18:11.962 [info] Extension host (Remote) is unresponsive.
2024-02-02 14:18:21.023 [info] Extension host (Remote) is responsive.
2024-02-02 14:19:51.632 [info] Extension host (Remote) is unresponsive.
2024-02-02 14:20:01.583 [info] Extension host (Remote) is responsive.
2024-02-02 14:20:04.840 [info] Extension host (Remote) is unresponsive.
2024-02-02 14:20:07.446 [info] Extension host (Remote) is responsive.
2024-02-02 14:22:13.061 [error] Cannot read properties of undefined (reading 'data'): TypeError: Cannot read properties of undefined (reading 'data')
at /root/.vscode-server/extensions/ms-python.vscode-pylance-2023.12.1/dist/extension.bundle.js:1:139672
at _0x1be708 (/root/.vscode-server/extensions/ms-python.vscode-pylance-2023.12.1/dist/extension.bundle.js:1:152856)
at async $e.provideCompletionItems (/root/.vscode-server/bin/05047486b6df5eb8d44b2ecd70ea3bdf775fd937/out/vs/workbench/api/node/extensionHostProcess.js:150:99151)
2024-02-02 14:31:27.325 [info] Extension host (Remote) is unresponsive.
2024-02-02 14:31:27.630 [info] Extension host (Remote) is responsive.
2024-02-02 14:31:57.798 [info] Extension host (Remote) is unresponsive.
2024-02-02 14:32:01.208 [info] Extension host (Remote) is responsive.
2024-02-02 14:32:57.504 [info] Extension host (Remote) is unresponsive.
2024-02-02 14:32:58.472 [info] Extension host (Remote) is responsive.
2024-02-02 14:33:40.996 [info] Extension host (Remote) is unresponsive.
2024-02-02 14:33:42.085 [info] Extension host (Remote) is responsive.
The Pylance output shows identical to what it was doing when I originally filed this bug, which is:
2024-02-02 20:33:42.201 [info] [Error - 8:33:42 PM] Server process exited with signal SIGKILL.
2024-02-02 20:33:42.205 [info] [Error - 8:33:42 PM] The Pylance server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
My Docker memory usage is 12.9 GB out of 15GB. High, but not so high as to run out of memory.
I just received a Pylance crash just now.
@holyoaks, that looks like https://github.com/microsoft/pylance-release/issues/5301. So far we've been unable to reproduce that issue. If you're able to reproduce it and can provide repro steps with code, that would be very helpful.
Closing as both issues reported by the user are dupes -- #5000 (which has been fixed) and #5301 (which was closed due to lack of info).
@holyoaks, if you are still seeing #5301, please help us out by adding more details on that issue.