VSCode: Extension host terminated unexpectedly

I'm using the rust-analyzer v0.2.368 with VSCode, and everything is working well. However, I've started getting "Extension host terminated unexpectedly" every several minutes. It's easy enough to restart it, but some features aren't available or are very slow while it's indexing.

Hard to say what's wrong! Is there any useful info after doing troubleshooting steps? https://rust-analyzer.github.io/manual.html#troubleshooting

Of course, the problem hasn't occurred since I posted this topic.

I've set up trace.server=verbose and trace.extension=true in my VSCode settings. I have rust-analyzer version: 2020-11-02 (86d3b78). Status shows

workspaces:
247 packages loaded

analysis:
4471 (56mb) files
0 (0b) index symbols
3144 trees, 128 retained
54182 trees, 130 retained (macros)
0b total


requests:
 6988 rust-analyzer/inlayHints            52ms
 6989 rust-analyzer/inlayHints            26ms
 6990 rust-analyzer/inlayHints            25ms
*6981 textDocument/codeAction             7ms
 6982 textDocument/hover                  0ms
 6983 textDocument/documentHighlight      1ms
 6984 textDocument/codeAction             8ms
 6985 textDocument/hover                  1ms
 6986 textDocument/codeAction             5ms
 6987 textDocument/codeAction             6ms

The output for Rust Analyzer Client is big. Is there anything in particular I should look for?

I just got the error. The last few entries on the console on the developer tools are

 ERR Unexpected end of JSON input: SyntaxError: Unexpected end of JSON input
	at JSON.parse (<anonymous>)
	at SymbolInformationParser.parseJson (/Users/alan/.vscode/extensions/kalitaalexey.vscode-rust-0.4.2/out/src/components/symbol_provision/symbol_information_parser.js:20:34)
	at /Users/alan/.vscode/extensions/kalitaalexey.vscode-rust-0.4.2/out/src/components/symbol_provision/symbol_search_manager.js:28:66
	at ChildProcess.exithandler (child_process.js:311:5)
	at ChildProcess.emit (events.js:223:5)
	at maybeClose (internal/child_process.js:1021:16)
	at Socket.<anonymous> (internal/child_process.js:430:11)
	at Socket.emit (events.js:223:5)
	at Pipe.<anonymous> (net.js:664:12)
log.ts:197   ERR Unexpected end of JSON input: SyntaxError: Unexpected end of JSON input
	at JSON.parse (<anonymous>)
	at SymbolInformationParser.parseJson (/Users/alan/.vscode/extensions/kalitaalexey.vscode-rust-0.4.2/out/src/components/symbol_provision/symbol_information_parser.js:20:34)
	at /Users/alan/.vscode/extensions/kalitaalexey.vscode-rust-0.4.2/out/src/components/symbol_provision/symbol_search_manager.js:28:66
	at ChildProcess.exithandler (child_process.js:311:5)
	at ChildProcess.emit (events.js:223:5)
	at maybeClose (internal/child_process.js:1021:16)
	at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
abstractExtensionService.ts:467 Extension host terminated unexpectedly. Code:  null  Signal:  SIGPIPE
_onExtensionHostCrashed @ abstractExtensionService.ts:438
log.ts:197   ERR Extension host terminated unexpectedly. The following extensions were running: vscode.microsoft-authentication, vscode.configuration-editing, vscode.extension-editing, vscode.json-language-features, ms-vscode.js-debug, vscode.npm, nickdemayo.vscode-json-editor, vscode.debug-auto-launch, vscode.emmet, vscode.git, vscode.merge-conflict, vscode.search-result, hiro-sun.vscode-emacs, vadimcn.vscode-lldb, matklad.rust-analyzer, vscode.github-authentication, ms-vscode-remote.remote-containers, vscode.github, vscode.typescript-language-features, vscode.grunt, vscode.gulp, vscode.jake, vscode.docker, vscode.yaml, ms-azuretools.vscode-docker, kalitaalexey.vscode-rust, vscode.debug-server-ready
notificationsAlerts.ts:40 Extension host terminated unexpectedly.
onDidChangeNotification @ breadcrumbsModel.ts:39
notificationsAlerts.ts:40 Canceled
onDidChangeNotification @ breadcrumbsModel.ts:39

Edit: The box is only showing part of what I pasted. I can see it in the preview pane, but not on the page. Here's the last few records.

abstractExtensionService.ts:467 Extension host terminated unexpectedly. Code:  null  Signal:  SIGPIPE
_onExtensionHostCrashed @ abstractExtensionService.ts:438
log.ts:197   ERR Extension host terminated unexpectedly. The following extensions were running: vscode.microsoft-authentication, vscode.configuration-editing, vscode.extension-editing, vscode.json-language-features, ms-vscode.js-debug, vscode.npm, nickdemayo.vscode-json-editor, vscode.debug-auto-launch, vscode.emmet, vscode.git, vscode.merge-conflict, vscode.search-result, hiro-sun.vscode-emacs, vadimcn.vscode-lldb, matklad.rust-analyzer, vscode.github-authentication, ms-vscode-remote.remote-containers, vscode.github, vscode.typescript-language-features, vscode.grunt, vscode.gulp, vscode.jake, vscode.docker, vscode.yaml, ms-azuretools.vscode-docker, kalitaalexey.vscode-rust, vscode.debug-server-ready
notificationsAlerts.ts:40 Extension host terminated unexpectedly.
onDidChangeNotification @ breadcrumbsModel.ts:39
notificationsAlerts.ts:40 Canceled
onDidChangeNotification @ breadcrumbsModel.ts:39

It just happened again. The console shows

ExtensionHostFailed

I'm including a screen shot because cut/paste doesn't include the text in red.

@alanhkarp, can you create an issue against the rust-analyzer repo with the information you've posted here?

The rust analyzer started failing every few minutes. I closed the VSCode window for one of my projects (I have two projects open.) and reopened my project. The analyzer hasn't failed since (about an hour). Could the problem be a memory leak?

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.