language-tools: Volar crashes quickly using VS Code remote containers on Docker

Description

I’m using Volar extension is a TS/Vue project, in a devcontainer on VS Code. When building the container, everything works as expected, but at some point in the time (I can’t determine when exactly), the volar extension crashes. This means the extension does not work as expected and I keep getting lots of error for anything.

Here is part of the content of the logs in vs code:

Volar - Document

[Info  - 10:39:57 AM] Connection to server got closed. Server will restart.
[Error - 10:39:57 AM] Request textDocument/documentLink failed.
Error: Connection got disposed.
	at Object.dispose (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-jsonrpc/lib/common/connection.js:1072:27)
	at Object.dispose (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-languageclient/lib/common/client.js:73:35)
	at LanguageClient.handleConnectionClosed (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-languageclient/lib/common/client.js:2492:42)
	at LanguageClient.handleConnectionClosed (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-languageclient/lib/node/main.js:159:15)
	at closeHandler (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-languageclient/lib/common/client.js:2479:18)
	at CallbackList.invoke (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-jsonrpc/lib/common/events.js:55:39)
	at Emitter.fire (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-jsonrpc/lib/common/events.js:117:36)
	at closeHandler (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-jsonrpc/lib/common/connection.js:260:26)
	at CallbackList.invoke (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-jsonrpc/lib/common/events.js:55:39)
	at Emitter.fire (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-jsonrpc/lib/common/events.js:117:36)
	at IPCMessageReader.fireClose (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-jsonrpc/lib/common/messageReader.js:40:27)
	at ChildProcess.<anonymous> (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-jsonrpc/lib/node/main.js:33:45)
	at ChildProcess.emit (events.js:327:22)
	at maybeClose (internal/child_process.js:1048:16)
	at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
(node:1195) UnhandledPromiseRejectionWarning: Error: Unhandled method vue/docVersion
    at handleResponse (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-jsonrpc/lib/common/connection.js:498:48)
    at processMessageQueue (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-jsonrpc/lib/common/connection.js:296:17)
    at Immediate.<anonymous> (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-jsonrpc/lib/common/connection.js:280:13)
    at processImmediate (internal/timers.js:461:21)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:1195) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)

Volar - API

[Error - 10:44:53 AM] Connection to server is erroring. Shutting down server.
[Error - 10:44:53 AM] Connection to server is erroring. Shutting down server.
[Error - 10:44:53 AM] Connection to server is erroring. Shutting down server.
[Error - 10:44:53 AM] Connection to server is erroring. Shutting down server.
[Error - 10:44:53 AM] Connection to server is erroring. Shutting down server.
[Error - 10:44:53 AM] Connection to server got closed. Server will not be restarted.
[Error - 10:44:53 AM] Request textDocument/codeAction failed.
Error: Connection got disposed.
	at Object.dispose (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-jsonrpc/lib/common/connection.js:1072:27)
	at Object.dispose (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-languageclient/lib/common/client.js:73:35)
	at LanguageClient.handleConnectionClosed (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-languageclient/lib/common/client.js:2492:42)
	at LanguageClient.handleConnectionClosed (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-languageclient/lib/node/main.js:159:15)
	at closeHandler (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-languageclient/lib/common/client.js:2479:18)
	at CallbackList.invoke (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-jsonrpc/lib/common/events.js:55:39)
	at Emitter.fire (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-jsonrpc/lib/common/events.js:117:36)
	at closeHandler (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-jsonrpc/lib/common/connection.js:260:26)
	at CallbackList.invoke (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-jsonrpc/lib/common/events.js:55:39)
	at Emitter.fire (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-jsonrpc/lib/common/events.js:117:36)
	at IPCMessageReader.fireClose (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-jsonrpc/lib/common/messageReader.js:40:27)
	at ChildProcess.<anonymous> (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-jsonrpc/lib/node/main.js:33:45)
	at ChildProcess.emit (events.js:327:22)
	at maybeClose (internal/child_process.js:1048:16)
	at Socket.<anonymous> (internal/child_process.js:439:11)
	at Socket.emit (events.js:315:20)
	at Pipe.<anonymous> (net.js:673:12)
[Error - 10:44:53 AM] Request textDocument/completion failed.
Error: Connection got disposed.
	at Object.dispose (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-jsonrpc/lib/common/connection.js:1072:27)
	at Object.dispose (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-languageclient/lib/common/client.js:73:35)
	at LanguageClient.handleConnectionClosed (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-languageclient/lib/common/client.js:2492:42)
	at LanguageClient.handleConnectionClosed (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-languageclient/lib/node/main.js:159:15)
	at closeHandler (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-languageclient/lib/common/client.js:2479:18)
	at CallbackList.invoke (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-jsonrpc/lib/common/events.js:55:39)
	at Emitter.fire (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-jsonrpc/lib/common/events.js:117:36)
	at closeHandler (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-jsonrpc/lib/common/connection.js:260:26)
	at CallbackList.invoke (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-jsonrpc/lib/common/events.js:55:39)
	at Emitter.fire (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-jsonrpc/lib/common/events.js:117:36)
	at IPCMessageReader.fireClose (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-jsonrpc/lib/common/messageReader.js:40:27)
	at ChildProcess.<anonymous> (/root/.vscode-server/extensions/johnsoncodehk.volar-0.27.23/node_modules/vscode-jsonrpc/lib/node/main.js:33:45)
	at ChildProcess.emit (events.js:327:22)
	at maybeClose (internal/child_process.js:1048:16)
	at Socket.<anonymous> (internal/child_process.js:439:11)
	at Socket.emit (events.js:315:20)
	at Pipe.<anonymous> (net.js:673:12)
[Error - 10:44:53 AM] Stopping server failed

Bug Reproduction:

To be honest, I don’t know how to reproduce it, it seems unpredictable. The only things I’m sure is that it does occur after some time, because at the beginning everything is fine.

Versions:

  • volar: v0.27.23
  • node: v16.9.1
  • npm: 7.21.1
  • VS Code: 1.60.1
  • vue-next: 3.1.12
  • vite: 2.5.10
  • typescript: 4.4.2
  • docker: 4.0.1

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 11
  • Comments: 38 (10 by maintainers)

Most upvoted comments

I think this problem is specific to docker, and almost no people use volar in docker. :S

Error on VsCode@1.60.1

But no error on VsCode@1.59.1

Same here.

I think I’ve sorted the issue on my side. I have 2 days without crashes so far, and it used to happen multiple times during the day. The problem was lack of memory for the ts checker. And probably WSL.

  1. I had WSL capped at 6 GB, I’ve increased it to 12 GB (.wslconfig file).
  2. I’ve increased the memory for ts checker, fork-ts-checker-webpack-plugin (got help on Quasar’s Discord channel):
tsCheckerConfig: {
    eslint: {
        enabled: true,
        files: './src/**/*.{ts,tsx,js,jsx,vue}',
        memoryLimit: 8192 // previously 4096
    },
    typescript: {
        memoryLimit: 8192 // previously the default, 2048
    }
}

The memoryLimit config param is the one passed to node as max-old-space-size: /usr/local/bin/node --max-old-space-size=8192 /your-project/node_modules/fork-ts-checker-webpack-plugin/lib/typescript-reporter/reporter/TypeScriptReporterRpcService.js

Because I have 2 VSCode instanced attached to containers all the time and a couple of servers running, the memory usage on WSL when doing nothing is around 4.2 GB (free -mh). Which left little memory for when ts checker needed to scan the code.

@ddahan See if increasing these values fixes it for you as well. I think each Vscode instance takes about 1.5 GB.

I have been seeing this, its just running out of memory, see this screenshot each “sawtooth” is Volar crashing:

image

Doubling the available memory seems to fix it:

image

I’m also getting this Unhandled method vue/docVersion error - no docker, no remote stuff - simple vue3 project with vite. Results in the volar extension turning itself off.

Q1 [Error]: Unhandled method vue/docVersion
    at ee (/Users/andy/.vscode/extensions/vue.volar-0.34.14-darwin-arm64/dist/node/server.js:4:241)
    at H (/Users/andy/.vscode/extensions/vue.volar-0.34.14-darwin-arm64/dist/node/server.js:3:6734)
    at Immediate.<anonymous> (/Users/andy/.vscode/extensions/vue.volar-0.34.14-darwin-arm64/dist/node/server.js:3:6577)
    at processImmediate (node:internal/timers:464:21) {
  code: -32601,
  data: undefined
}
[Info  - 9:56:44 AM] Connection to server got closed. Server will restart.
/Users/andy/.vscode/extensions/vue.volar-0.34.14-darwin-arm64/dist/node/server.js:4
${JSON.stringify(ae.error,void 0,4)}`):i.error("Received response message without id. No further error information provided.")

The Volar - Language Features Server server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.

Request textDocument/documentLink failed.

Request completionItem/resolve failed.

We are experiencing the same error without Docker - but while using Live Share instead (to collaborate together for pair coding sessions). Any ideas or pointers at least at what we should look?

We are all on MacOS and without any docker instances. The repo is indeed a monorepo, but a very small one (recently created with only handful of components shared across 2 apps).

Really appreciate any help or ideas!

I get this error on the project I’m working on without Docker or anything remote

[Info  - 11:27:20 PM] Connection to server got closed. Server will restart.
load volar.config.js failed in /home/stan/projects/personal/WeakAurasCompanion
/home/stan/.vscode-server/extensions/johnsoncodehk.volar-0.33.10/dist/node/server.js:2115
                responsePromise.reject(new messages_1.ResponseError(error2.code, error2.message, error2.data));
                                       ^

ResponseError: Unhandled method vue/docVersion
    at handleResponse (/home/stan/.vscode-server/extensions/johnsoncodehk.volar-0.33.10/dist/node/server.js:2115:40)
    at processMessageQueue (/home/stan/.vscode-server/extensions/johnsoncodehk.volar-0.33.10/dist/node/server.js:1940:13)
    at Immediate.<anonymous> (/home/stan/.vscode-server/extensions/johnsoncodehk.volar-0.33.10/dist/node/server.js:1926:11)
    at processImmediate (node:internal/timers:464:21) {
  code: -32601,
  data: undefined
}

@ddahan, @ovidiuc since the problem is memory, is your project a monorepo?

@ddahan and you can also track #577, it just like Vetur with disabled experimental template interpolation, and memory usage should be less.

@ddahan WSL is Windows Subsystem for Linux. If you don’t have it, no configuration needed. Glad you’ve found a “solution”. But yeah, I agree with you, it should not crash.

@johnsoncodehk Thanks, the setting didn’t have much effect. Maybe the problem is not that Volar is using too much memory, but that when the system runs out of memory, Volar doesn’t know what to do. Or node, or docker, or eslint. Have no idea which is to blame here, have no experience in extension building. Too many variables and when the container becomes unresponsive, you have no way to run commands on it and see what’s going on.

I think you can open a issue to https://github.com/microsoft/vscode-remote-release/issues, should have more chance of getting some enlightenment.

almost no people use volar in docker. :S

To be more specific, I’m using VS Code dev containers: https://code.visualstudio.com/docs/remote/containers From what I see, more and more people are using and enjoying this feature as it allows people sandboxing their dev environements.

I think this problem is specific to docker

It could, but there no evidence here 😕 I use Docker and dev containers for all my projects and have 0 issue with any extension. And I used to use Volar on another project with Docker, without any issue too. It suddently happened on all my projects. That makes me think there is something wrong with a new version of something (which could be Docker, or not). Or as stated by 2256184693, it could be related to the tsconfig.

But since the crash happens after some time, this is very hard to debug by testing all versions of everything. Anyway, I understand it’s almost impossible for you to debug it, if I can not reproduce it. Let’s hope someone else has the same problem and understand better than me what’s happening here.

EDIT

I do not need to restart Docker to make it work again, just closing the connection to remote server in vs code.

My error is because of my own wrong in tsconfig.json. sorry

@2256184693 how did you solve it?

My error is because of my own wrong in tsconfig.json. sorry