The Kotlin Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted.
See original GitHub issueI have just installed this extension in VS Code Insiders 1.26.0 on a Windows 10 x64 machine. However, when opening Kotlin projects, I get the message I put in the title. The Kotlin output window only shows this:
[Info - 9:52:56 AM] Connection to server got closed. Server will restart.
[Info - 9:52:56 AM] Connection to server got closed. Server will restart.
[Info - 9:52:56 AM] Connection to server got closed. Server will restart.
[Info - 9:52:56 AM] Connection to server got closed. Server will restart.
[Error - 9:52:56 AM] Connection to server got closed. Server will not be restarted.
And when looking in DevTools, I see this:
ERR Message header must separate key and value using :: Error: Message header must separate key and value using :
at C:\Users\Noah\.vscode-insiders\extensions\fwcd.kotlin-0.1.7\node_modules\vscode-jsonrpc\lib\messageReader.js:68:23
at Array.forEach (<anonymous>)
at MessageBuffer.tryReadHeaders (C:\Users\Noah\.vscode-insiders\extensions\fwcd.kotlin-0.1.7\node_modules\vscode-jsonrpc\lib\messageReader.js:65:17)
at StreamMessageReader.onData (C:\Users\Noah\.vscode-insiders\extensions\fwcd.kotlin-0.1.7\node_modules\vscode-jsonrpc\lib\messageReader.js:194:43)
at Socket.<anonymous> (C:\Users\Noah\.vscode-insiders\extensions\fwcd.kotlin-0.1.7\node_modules\vscode-jsonrpc\lib\messageReader.js:185:19)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
at Socket.Readable.push (_stream_readable.js:208:10)
at Pipe.onread (net.js:594:20)
That message is repeated 4 or 5 times in fast succession. Any solutions to this?
C:\Users\Noah\Desktop\kotlin> java -version
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)
C:\Users\Noah\Desktop\kotlin> kotlin -version
Kotlin version 1.2.60-eap-75 (JRE 1.8.0_151-b12)
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:18 (3 by maintainers)
Top Results From Across the Web
The Language Support for Java server crashed 5 times in the ...
The Language Support for Java server crashed 5 times in the last 3 minutes. The server will not be restarted · The problem...
Read more >The Kotlin Language Client server crashed 5 times in the last ...
The Kotlin Language Client server crashed 5 times in the last 3 minutes. The server will not be restarted.
Read more >Flutter/Kotlin/Gradle Unsupported class file in VS Code
The Kotlin Language Client server crashed 5 times in the last 3 minutes. The server will not be restarted. …and in the Output...
Read more >The language server crashed 5 times in the last 3 minutes. In c ...
I worked on a medium sized C project and at times it became so slow that I constantly have to restart VSCode. Check...
Read more >Server Down: What to Do When My Server Crashes?
So, a little disclaimer, providing solutions to every type of server crash is not within the scope of this article. What this tutorial...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I experienced this issue on VS Code with WSL2. I have installed the extension within WSL2 and tried to use it on Windows 10 2004. What I did (in part based on @Polarbear08’s solution):
openjdk-14-jdk-headless
on WSL2.Now the language server starts up properly.
WSL2’s OS: Debian Linux bullseye
I have the same issue. My project is a huge android project with hundreds of modules and it has at least 15000 Kotlin files.
After tracing the source codes, I found the Kotlin Language Server failed on the following method:
https://github.com/fwcd/kotlin-language-server/blob/master/shared/src/main/kotlin/org/javacs/kt/classpath/DefaultClassPathResolver.kt#L22
This method is looking for all the maven / gradle / shell modules from the project root to its subfolder recursively. For example, it searches all of “.build.gradle" or ".build.gradle.kts” to identify it is gradle module or not. The reason to do that is it wants to resolve the dependencies on each maven / gradle / shell module. But this search takes too much time, especially for the huge project. Although it ignores not necessary folders from the project root’s “.gitignore”, it still causes the Kotlin Language Server failed. My android project has a flat structure and it only has two layers of structure. So it doesn’t need to search so deeply. I modify this method to only run two levels of recursion and this modification works for my project. But this solution only works for your projects has two layers of the structure. I have not idea how to traverse the project trees efficiently to resolve all of the dependencies.