vlang / vls

V language server. (Old V language server - see v-analyzer)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

VLS keeps crashing when file is edited

dfrnoch opened this issue · comments

System Information

V doctor

OS: linux, Linux version 5.10.102.1-microsoft-standard-WSL2 (oe-user@oe-host) (x86_64-msft-linux-gcc (GCC) 9.3.0, GNU ld (GNU Binutils) 2.34.0.20200220) #1 SMP Wed Mar 2 00:30:59 UTC 2022 (WSL 2)
Processor: 4 cpus, 64bit, little endian, Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz
CC version: cc (GCC) 11.2.0

getwd: /mnt/e/Microsoft VS Code Insiders
vmodules: /home/lynx/.vmodules
vroot: /home/lynx/bin/v
vexe: /home/lynx/bin/v/v
vexe mtime: 2022-04-23 13:03:29
is vroot writable: true
is vmodules writable: true
V full version: V 0.2.4 3388caa.9355048

Git version: git version 2.36.0
Git vroot status: weekly.2022.16-47-g9355048b
.git/config present: true
thirdparty/tcc status: thirdparty-linux-amd64 eee03626

VLS info

vls version: 0.0.1.
vls server arguments: --child --timeout 15

Problem Description

After installing VSCode extension and enabling VLS in settings, every time I open any V file vls will crash.

Expected Output

Error highlighting, formatting and other things language server should do.

Actual Output

signal 11: segmentation fault
| 0x55c15f636f53 | /home/lynx/.vls/bin/vls(+0x95f53)
| 0x55c15f5eee2d | /home/lynx/.vls/bin/vls(+0x4de2d)
| 0x55c15f63cc06 | /home/lynx/.vls/bin/vls(+0x9bc06)
| 0x55c15f5fc981 | /home/lynx/.vls/bin/vls(+0x5b981)
| 0x55c15f5c68cc | /home/lynx/.vls/bin/vls(+0x258cc)
| 0x7f09d9e3c5c2 | /usr/lib/libc.so.6(+0x8d5c2)
| 0x7f09d9ec1584 | /usr/lib/libc.so.6(clone+0x44)

Steps to Reproduce

Same as written in description

Last Recorded LSP Requests

Request

[2022-04-23 13:29:33] {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":4357,"clientInfo":{"name":"Visual Studio Code - Insiders","version":"1.67.0-insider"},"locale":"en","rootPath":"/home/lynx/code/vlang/ahoj","rootUri":"file:///home/lynx/code/vlang/ahoj","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true,"resourceOperations":["create","rename","delete"],"failureHandling":"textOnlyTransactional","normalizesLineEndings":true,"changeAnnotationSupport":{"groupsOnLabel":true}},"didChangeConfiguration":{"dynamicRegistration":true},"didChangeWatchedFiles":{"dynamicRegistration":true},"symbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"tagSupport":{"valueSet":[1]}},"codeLens":{"refreshSupport":true},"executeCommand":{"dynamicRegistration":true},"configuration":true,"workspaceFolders":true,"semanticTokens":{"refreshSupport":true},"fileOperations":{"dynamicRegistration":true,"didCreate":true,"didRename":true,"didDelete":true,"willCreate":true,"willRename":true,"willDelete":true}},"textDocument":{"publishDiagnostics":{"relatedInformation":true,"versionSupport":false,"tagSupport":{"valueSet":[1,2]},"codeDescriptionSupport":true,"dataSupport":true},"synchronization":{"dynamicRegistration":true,"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":{"dynamicRegistration":true,"contextSupport":true,"completionItem":{"snippetSupport":true,"commitCharactersSupport":true,"documentationFormat":["markdown","plaintext"],"deprecatedSupport":true,"preselectSupport":true,"tagSupport":{"valueSet":[1]},"insertReplaceSupport":true,"resolveSupport":{"properties":["documentation","detail","additionalTextEdits"]},"insertTextModeSupport":{"valueSet":[1,2]}},"completionItemKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]}},"hover":{"dynamicRegistration":true,"contentFormat":["markdown","plaintext"]},"signatureHelp":{"dynamicRegistration":true,"signatureInformation":{"documentationFormat":["markdown","plaintext"],"parameterInformation":{"labelOffsetSupport":true},"activeParameterSupport":true},"contextSupport":true},"definition":{"dynamicRegistration":true,"linkSupport":true},"references":{"dynamicRegistration":true},"documentHighlight":{"dynamicRegistration":true},"documentSymbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"hierarchicalDocumentSymbolSupport":true,"tagSupport":{"valueSet":[1]},"labelSupport":true},"codeAction":{"dynamicRegistration":true,"isPreferredSupport":true,"disabledSupport":true,"dataSupport":true,"resolveSupport":{"properties":["edit"]},"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"honorsChangeAnnotations":false},"codeLens":{"dynamicRegistration":true},"formatting":{"dynamicRegistration":true},"rangeFormatting":{"dynamicRegistration":true},"onTypeFormatting":{"dynamicRegistration":true},"rename":{"dynamicRegistration":true,"prepareSupport":true,"prepareSupportDefaultBehavior":1,"honorsChangeAnnotations":true},"documentLink":{"dynamicRegistration":true,"tooltipSupport":true},"typeDefinition":{"dynamicRegistration":true,"linkSupport":true},"implementation":{"dynamicRegistration":true,"linkSupport":true},"colorProvider":{"dynamicRegistration":true},"foldingRange":{"dynamicRegistration":true,"rangeLimit":5000,"lineFoldingOnly":true},"declaration":{"dynamicRegistration":true,"linkSupport":true},"selectionRange":{"dynamicRegistration":true},"callHierarchy":{"dynamicRegistration":true},"semanticTokens":{"dynamicRegistration":true,"tokenTypes":["namespace","type","class","enum","interface","struct","typeParameter","parameter","variable","property","enumMember","event","function","method","macro","keyword","modifier","comment","string","number","regexp","operator"],"tokenModifiers":["declaration","definition","readonly","static","deprecated","abstract","async","modification","documentation","defaultLibrary"],"formats":["relative"],"requests":{"range":true,"full":{"delta":true}},"multilineTokenSupport":false,"overlappingTokenSupport":false},"linkedEditingRange":{"dynamicRegistration":true}},"window":{"showMessage":{"messageActionItem":{"additionalPropertiesSupport":true}},"showDocument":{"support":true},"workDoneProgress":true},"general":{"regularExpressions":{"engine":"ECMAScript","version":"ES2020"},"markdown":{"parser":"marked","version":"1.1.0"}}},"trace":"off","workspaceFolders":[{"uri":"file:///home/lynx/code/vlang/ahoj","name":"ahoj"}]}}

[2022-04-23 13:29:33] {"jsonrpc":"2.0","method":"initialized","params":{}}

[2022-04-23 13:29:33] {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///home/lynx/code/vlang/ahoj/ahoj.v","languageId":"v","version":3,"text":"module main\n\nfn main() {\n\tprintln('Hello World!')\n}\n"}}}

[2022-04-23 13:29:49] {"jsonrpc":"2.0","id":1,"method":"textDocument/documentSymbol","params":{"textDocument":{"uri":"file:///home/lynx/code/vlang/ahoj/ahoj.v"}}}

[2022-04-23 13:29:50] {"jsonrpc":"2.0","id":2,"method":"textDocument/codeLens","params":{"textDocument":{"uri":"file:///home/lynx/code/vlang/ahoj/ahoj.v"}}}

[2022-04-23 13:29:50] {"jsonrpc":"2.0","id":3,"method":"textDocument/foldingRange","params":{"textDocument":{"uri":"file:///home/lynx/code/vlang/ahoj/ahoj.v"}}}

[2022-04-23 13:29:50] {"jsonrpc":"2.0","id":4,"method":"textDocument/codeLens","params":{"textDocument":{"uri":"file:///home/lynx/code/vlang/ahoj/ahoj.v"}}}

[2022-04-23 13:29:52] {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"file:///home/lynx/code/vlang/ahoj/ahoj.v","version":4},"contentChanges":[{"range":{"start":{"line":4,"character":0},"end":{"line":4,"character":1}},"rangeLength":1,"text":""}]}}

Response

[2022-04-23 13:29:33] {"jsonrpc":"2.0","method":"window/showMessage","params":{"type":2,"message":"VLS is a work-in-progress, pre-alpha language server. It may not be guaranteed to work reliably due to memory issues and other related factors. We encourage you to submit an issue if you encounter any problems."}}

[2022-04-23 13:29:33] {"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"VLS Version: 0.0.1., OS: linux 64"}}

[2022-04-23 13:29:33] {"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"VLS executable path: /home/lynx/.vls/bin/vls"}}Content-Length: 103

{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"VLS build with V 3388caa"}}Content-Length: 152

{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Client / Editor: Visual Studio Code - Insiders 1.67.0-insider (PID: 4357)"}}Content-Length: 117

{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Using V path (VROOT): /home/lynx/bin/v"}}

[2022-04-23 13:29:33] {"jsonrpc":"2.0","id":0,"result":{"capabilities":{"textDocumentSync":2,"hoverProvider":true,"completionProvider":{"resolveProvider":false,"triggerCharacters":["=",".",":","{",",","("," "]},"signatureHelpProvider":{"triggerCharacters":["("],"retriggerCharacters":[","," "]},"definitionProvider":true,"typeDefinitionProvider":false,"implementationProvider":true,"referencesProvider":false,"documentHightlightProvider":false,"documentSymbolProvider":true,"workspaceSymbolProvider":true,"codeActionProvider":false,"codeLensProvider":{"resolveProvider":false},"documentFormattingProvider":true,"documentOnTypeFormattingProvider":{"firstTriggerCharacter":"","moreTriggerCharacter":[]},"renameProvider":false,"documentLinkProvider":false,"colorProvider":false,"declarationProvider":false,"executeCommandProvider":"","foldingRangeProvider":true,"experimental":{}}}}

[2022-04-23 13:29:33] {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/lynx/code/vlang/ahoj/ahoj.v","diagnostics":[]}}

[2022-04-23 13:29:49] {"jsonrpc":"2.0","id":1,"result":[{"name":"main","kind":12,"deprecated":false,"location":{"uri":"file:///home/lynx/code/vlang/ahoj/ahoj.v","range":{"start":{"line":2,"character":3},"end":{"line":2,"character":7}}},"containerName":""}]}

[2022-04-23 13:29:50] {"jsonrpc":"2.0","id":2,"result":null}

[2022-04-23 13:29:50] {"jsonrpc":"2.0","id":3,"result":[{"startLine":2,"startCharacter":10,"endLine":4,"endCharacter":1,"kind":"region"}]}

[2022-04-23 13:29:50] {"jsonrpc":"2.0","id":4,"result":null}

[2022-04-23 13:29:52] {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/lynx/code/vlang/ahoj/ahoj.v","diagnostics":[]}}

I think I have a simmilar problem, the language becomes very difficult to work with when there isnt a langauge server :/

Same issue @ Windows 10 / Sublime 4 / VLS 0.0.1.5fbfe67.
Exits with 139 in hello world on any input or command.

@lnxcz can you please paste the V code it crashed on?

commented

@keiviv This issue is Linux-specific. Please post a separate issue for your problem. Thanks 😃

commented

@lnxcz Can you post a code that we can use to reproduce this problem? This will help us solve your problem without messing your codebase for privacy concerns. Thanks

The code can be anything, in my case it was a basic hello world. I noticed that when I reopen the project vls will work and show errors and whatsoever, but even inserting a single character it'll crash.

Always crashing. :(

[Info  - 10:19:17 PM] VLS Version: 0.0.1., OS: linux 64
[Info  - 10:19:17 PM] VLS executable path: /home/fatih/.vls/bin/vls
[Info  - 10:19:17 PM] VLS build with V 634796a
[Info  - 10:19:17 PM] Client / Editor: Visual Studio Code 1.67.0 (PID: 6498)
[Info  - 10:19:17 PM] Using V path (VROOT): /home/fatih/projects/v
[Info  - 10:21:55 PM] Connection to server got closed. Server will restart.
[Error - 10:21:55 PM] Request textDocument/foldingRange failed.
Error: Connection got disposed.
	at Object.dispose (/home/fatih/.vscode/extensions/vlanguage.vscode-vlang-0.1.11/out/extension.js:29:4057)
	at Object.dispose (/home/fatih/.vscode/extensions/vlanguage.vscode-vlang-0.1.11/out/extension.js:34:9518)
	at Uf.handleConnectionClosed (/home/fatih/.vscode/extensions/vlanguage.vscode-vlang-0.1.11/out/extension.js:36:9070)
	at Uf.handleConnectionClosed (/home/fatih/.vscode/extensions/vlanguage.vscode-vlang-0.1.11/out/extension.js:39:12255)
	at n (/home/fatih/.vscode/extensions/vlanguage.vscode-vlang-0.1.11/out/extension.js:36:8752)
	at Tu.invoke (/home/fatih/.vscode/extensions/vlanguage.vscode-vlang-0.1.11/out/extension.js:2:9583)
	at wr.fire (/home/fatih/.vscode/extensions/vlanguage.vscode-vlang-0.1.11/out/extension.js:2:10348)
	at it (/home/fatih/.vscode/extensions/vlanguage.vscode-vlang-0.1.11/out/extension.js:3:10845)
	at Tu.invoke (/home/fatih/.vscode/extensions/vlanguage.vscode-vlang-0.1.11/out/extension.js:2:9583)
	at wr.fire (/home/fatih/.vscode/extensions/vlanguage.vscode-vlang-0.1.11/out/extension.js:2:10348)
	at Mo.fireClose (/home/fatih/.vscode/extensions/vlanguage.vscode-vlang-0.1.11/out/extension.js:3:523)
	at Socket.<anonymous> (/home/fatih/.vscode/extensions/vlanguage.vscode-vlang-0.1.11/out/extension.js:3:1297)
	at Socket.emit (node:events:390:28)
	at Pipe.<anonymous> (node:net:687:12)
[Error - 10:21:55 PM] Request textDocument/codeLens failed.
Error: Connection got disposed.
	at Object.dispose (/home/fatih/.vscode/extensions/vlanguage.vscode-vlang-0.1.11/out/extension.js:29:4057)
	at Object.dispose (/home/fatih/.vscode/extensions/vlanguage.vscode-vlang-0.1.11/out/extension.js:34:9518)
	at Uf.handleConnectionClosed (/home/fatih/.vscode/extensions/vlanguage.vscode-vlang-0.1.11/out/extension.js:36:9070)
	at Uf.handleConnectionClosed (/home/fatih/.vscode/extensions/vlanguage.vscode-vlang-0.1.11/out/extension.js:39:12255)
	at n (/home/fatih/.vscode/extensions/vlanguage.vscode-vlang-0.1.11/out/extension.js:36:8752)
	at Tu.invoke (/home/fatih/.vscode/extensions/vlanguage.vscode-vlang-0.1.11/out/extension.js:2:9583)
	at wr.fire (/home/fatih/.vscode/extensions/vlanguage.vscode-vlang-0.1.11/out/extension.js:2:10348)
	at it (/home/fatih/.vscode/extensions/vlanguage.vscode-vlang-0.1.11/out/extension.js:3:10845)
	at Tu.invoke (/home/fatih/.vscode/extensions/vlanguage.vscode-vlang-0.1.11/out/extension.js:2:9583)
	at wr.fire (/home/fatih/.vscode/extensions/vlanguage.vscode-vlang-0.1.11/out/extension.js:2:10348)
	at Mo.fireClose (/home/fatih/.vscode/extensions/vlanguage.vscode-vlang-0.1.11/out/extension.js:3:523)
	at Socket.<anonymous> (/home/fatih/.vscode/extensions/vlanguage.vscode-vlang-0.1.11/out/extension.js:3:1297)
	at Socket.emit (node:events:390:28)
	at Pipe.<anonymous> (node:net:687:12)
[Error - 10:21:55 PM] Request textDocument/documentSymbol failed.
Error: Connection got disposed.
	at Object.dispose (/home/fatih/.vscode/extensions/vlanguage.vscode-vlang-0.1.11/out/extension.js:29:4057)
	at Object.dispose (/home/fatih/.vscode/extensions/vlanguage.vscode-vlang-0.1.11/out/extension.js:34:9518)
	at Uf.handleConnectionClosed (/home/fatih/.vscode/extensions/vlanguage.vscode-vlang-0.1.11/out/extension.js:36:9070)
	at Uf.handleConnectionClosed (/home/fatih/.vscode/extensions/vlanguage.vscode-vlang-0.1.11/out/extension.js:39:12255)
	at n (/home/fatih/.vscode/extensions/vlanguage.vscode-vlang-0.1.11/out/extension.js:36:8752)
	at Tu.invoke (/home/fatih/.vscode/extensions/vlanguage.vscode-vlang-0.1.11/out/extension.js:2:9583)
	at wr.fire (/home/fatih/.vscode/extensions/vlanguage.vscode-vlang-0.1.11/out/extension.js:2:10348)
	at it (/home/fatih/.vscode/extensions/vlanguage.vscode-vlang-0.1.11/out/extension.js:3:10845)
	at Tu.invoke (/home/fatih/.vscode/extensions/vlanguage.vscode-vlang-0.1.11/out/extension.js:2:9583)
	at wr.fire (/home/fatih/.vscode/extensions/vlanguage.vscode-vlang-0.1.11/out/extension.js:2:10348)
	at Mo.fireClose (/home/fatih/.vscode/extensions/vlanguage.vscode-vlang-0.1.11/out/extension.js:3:523)
	at Socket.<anonymous> (/home/fatih/.vscode/extensions/vlanguage.vscode-vlang-0.1.11/out/extension.js:3:1297)
	at Socket.emit (node:events:390:28)
	at Pipe.<anonymous> (node:net:687:12)
[Info  - 10:21:55 PM] Connection to server got closed. Server will restart.

@fatihusta can you post the most minimal example of the V source code that resulted in the crash?

I'm using the tutorial project of v. https://github.com/vlang/v/tree/master/tutorials/building_a_simple_web_blog_with_vweb

I think I reproduce the problem. It's strange.
Crashing vls when I press the backspace/delete button on keyboard.
For example.

json.encode() // after I'm pressing backpsace/delete button then that's happen.

Keeps working If I didn't press the backspace/delete button.

Thanks, will fix asap.

Thank you for your quick response. 👍

Any progress on this?

commented

@fatihusta @FireAndIceFrog i have checked this one. please try again using our prebuilt binaries and follow this procedure on how to use the recently downloaded binary into VSCode.

it's more likely that the vscode extension used the old way of compiling VLS which is prone to crashes. please use the one i have mentioned earlier while we are fixing this.

Just built vls from source and hooked it up to vscode - i'm not experiencing any more crashes so far. Seems like this is basically fixed in the newest code already. Cheers!

@fatihusta @FireAndIceFrog i have checked this one. please try again using our prebuilt binaries and follow this procedure on how to use the recently downloaded binary into VSCode.

it's more likely that the vscode extension used the old way of compiling VLS which is prone to crashes. please use the one i have mentioned earlier while we are fixing this.

I downloaded prebuilded vls binary from github and it worked. Thanks.

commented

@lnxcz Before I close this issue, just a follow up, have you tried updating VLS?

@lnxcz Before I close this issue, just a follow up, have you tried updating VLS?

By the way. I tried the build from scratch from vscode but didn't worked. (Ctrl+shift+P then V: Update vls)

I will try build from source code manually today.

@lnxcz Before I close this issue, just a follow up, have you tried updating VLS?

Yes, I updated VLS and it worked. Thank you for your help!

commented

Great. Will close this issue then 😄

Sorry for late response.
I build from source and it worked.
Thanks.