-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Language Server segfaults when used from an editor #394
Comments
Got some more information. The segmentation fault occurs when using the TCP Server mode as well. I ended up having to use it because I couldn't find another way to debug the communication between the editor and the language server. I've attached the asy LSP output and the data that was going over the TCP socket. I'm not sure how to debug this using the normal stdio model, but I think it's caused by a bug somewhere in the parsing.
Content-Length: 4261
{
"id": 1,
"params": {
"rootUri": null,
"initializationOptions": {},
"capabilities": {
"workspace": {
"workspaceEdit": {
"failureHandling": "abort",
"documentChanges": true
},
"didChangeConfiguration": {
"dynamicRegistration": true
},
"executeCommand": {},
"applyEdit": true,
"semanticTokens": {
"refreshSupport": true
},
"configuration": true,
"symbol": {
"symbolKind": {
"valueSet": [
16,
23,
10,
21,
9,
3,
5,
13,
17,
18,
4,
11,
7,
25,
1,
15,
22,
14,
20,
2,
12,
26,
8,
24,
6,
19
]
},
"dynamicRegistration": true,
"tagSupport": {
"valueSet": [
1
]
}
},
"diagnostics": {
"refreshSupport": true
},
"codeLens": {
"refreshSupport": true
},
"workspaceFolders": true,
"inlayHint": {
"refreshSupport": true
}
},
"textDocument": {
"completion": {
"dynamicRegistration": true,
"completionItemKind": {
"valueSet": [
22,
16,
15,
11,
13,
4,
7,
6,
9,
21,
8,
10,
24,
18,
17,
12,
20,
19,
3,
1,
25,
5,
23,
2,
14
]
},
"completionList": {
"itemDefaults": [
"editRange",
"insertTextFormat",
"data"
]
},
"completionItem": {
"labelDetailsSupport": true,
"documentationFormat": [
"markdown",
"plaintext"
],
"insertTextModeSupport": {
"valueSet": [
2
]
},
"resolveSupport": {
"properties": [
"detail",
"documentation",
"additionalTextEdits"
]
},
"snippetSupport": true,
"deprecatedSupport": true,
"insertReplaceSupport": true,
"tagSupport": {
"valueSet": [
1
]
}
},
"insertTextMode": 2
},
"typeHierarchy": {
"dynamicRegistration": true
},
"implementation": {
"dynamicRegistration": true,
"linkSupport": true
},
"typeDefinition": {
"dynamicRegistration": true,
"linkSupport": true
},
"documentHighlight": {
"dynamicRegistration": true
},
"selectionRange": {
"dynamicRegistration": true
},
"publishDiagnostics": {
"dataSupport": true,
"versionSupport": true,
"relatedInformation": true,
"codeDescriptionSupport": true,
"tagSupport": {
"valueSet": [
1,
2
]
}
},
"documentLink": {
"dynamicRegistration": true,
"tooltipSupport": true
},
"formatting": {
"dynamicRegistration": true
},
"inlayHint": {
"dynamicRegistration": true,
"resolveSupport": {
"properties": [
"textEdits",
"label.command"
]
}
},
"signatureHelp": {
"dynamicRegistration": true,
"contextSupport": true,
"signatureInformation": {
"parameterInformation": {
"labelOffsetSupport": true
},
"activeParameterSupport": true,
"documentationFormat": [
"markdown",
"plaintext"
]
}
},
"diagnostic": {
"dynamicRegistration": true,
"relatedDocumentSupport": true
},
"semanticTokens": {
"formats": [
"relative"
],
"augmentsSyntaxTokens": true,
"tokenModifiers": [
"abstract",
"async",
"declaration",
"documentation",
"readonly",
"static",
"modification",
"definition",
"defaultLibrary",
"deprecated"
],
"requests": {
"range": true,
"full": {
"delta": true
}
},
"tokenTypes": [
"struct",
"decorator",
"number",
"enum",
"namespace",
"class",
"type",
"string",
"method",
"event",
"interface",
"property",
"operator",
"comment",
"enumMember",
"modifier",
"function",
"typeParameter",
"macro",
"variable",
"keyword",
"parameter",
"regexp"
],
"dynamicRegistration": true,
"overlappingTokenSupport": false,
"multilineTokenSupport": true
},
"declaration": {
"dynamicRegistration": true,
"linkSupport": true
},
"callHierarchy": {
"dynamicRegistration": true
},
"references": {
"dynamicRegistration": true
},
"colorProvider": {
"dynamicRegistration": true
},
"rename": {
"prepareSupport": true,
"dynamicRegistration": true,
"prepareSupportDefaultBehavior": 1
},
"documentSymbol": {
"symbolKind": {
"valueSet": [
16,
23,
10,
21,
9,
3,
5,
13,
17,
18,
4,
11,
7,
25,
1,
15,
22,
14,
20,
2,
12,
26,
8,
24,
6,
19
]
},
"dynamicRegistration": true,
"hierarchicalDocumentSymbolSupport": true,
"tagSupport": {
"valueSet": [
1
]
}
},
"rangeFormatting": {
"dynamicRegistration": true
},
"definition": {
"dynamicRegistration": true,
"linkSupport": true
},
"codeLens": {
"dynamicRegistration": true
},
"synchronization": {
"dynamicRegistration": true,
"willSaveWaitUntil": true,
"willSave": true,
"didSave": true
},
"codeAction": {
"dataSupport": true,
"dynamicRegistration": true,
"isPreferredSupport": true,
"resolveSupport": {
"properties": [
"edit"
]
},
"codeActionLiteralSupport": {
"codeActionKind": {
"valueSet": [
"quickfix",
"refactor",
"refactor.extract",
"refactor.inline",
"refactor.rewrite",
"source.fixAll",
"source.organizeImports"
]
}
}
},
"hover": {
"dynamicRegistration": true,
"contentFormat": [
"markdown",
"plaintext"
]
}
},
"general": {
"regularExpressions": {
"engine": "ECMAScript"
},
"markdown": {
"version": "3.2.2",
"parser": "Python-Markdown"
}
},
"window": {
"workDoneProgress": true,
"showDocument": {
"support": true
},
"showMessage": {
"messageActionItem": {
"additionalPropertiesSupport": true
}
}
}
},
"clientInfo": {
"version": "1.25.0",
"name": "Sublime Text LSP"
},
"rootPath": null,
"workspaceFolders": null,
"processId": 16463
},
"jsonrpc": "2.0",
"method": "initialize"
} |
Did a bit more digging, the segfault occurs at |
Done more digging. It seems to segfault if any property value in the JSON is greater in length than 1295. It also seems to segfault depending on the number of child objects in |
Also, if it's of use, the commit hash I used when compiling from source was
|
Does commit 081db9d solve the problem? |
Is this issue still present with Asymptote 2.87? |
I’ll check later today and get back to you.Many Thanks,Ennis MasseyOn 28/02/2024, at 8:22 AM, John Bowman ***@***.***> wrote:
Is this issue still present with Asymptote 2.87?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Unfortunately it doesn't seem to have been resolved, in 2.87 or compiling from git. Behaviour is identical, although I haven't done a deep dive into it. I'm running it on Arch Linux, I haven't tested it in WSL or other distros.
and
|
Can you please detail the steps to reproduce this? (In particular, which asymptote file are you working with - if possible, strip out any confidential data, or are you in a project?) - this would help me quite a bit |
It's unfortunately not a specific file, any attempt to use the LSP from any editor causes the issue. However, after pulling the most recent version and compiling it with -O0 and -g, I get exceptions instead of segfaults. This occurs with both stdio and TCP server modes. The exception is shown below:
|
The file I'm using to debug with is: int a = 3;
struct Test {
int a;
int b;
};
Test l = new Test;
l.a; |
Another exception, different this time, now compiled with -O2 instead of -O0
|
Thanks for the information. I'll look into this further. My apologies for not getting this done sooner |
Suspect this might be a race condition somehow considering boost::asio. I'll try to add mutexes |
@MicroTransactionsMatterToo Do you mind trying the changes in PR #440? (The build system is cmake since I'm developing this on my windows machine which does not have access to make - I did include build instructions in the branch) This change might mitigate some of the issues you're seeing, but please let me know if it works (or doesn't) |
Sorry for taking so long to get back to you, have been busy with personal stuff. Unfortunately the issue remains the same as before. Output is:
|
Running it under debugging gets a bit farther, it doesn't constantly throw errors, however it still doesn't seem to be working, it never returns any completion information Sublime Text Logs
LSP Output
|
Okay, on further testing, some stuff does work, hovering, getting functions definitions and that's about it. Looking at it, it seems that the completion endpoint isn't implemented, which would explain that issue. But there's something else going wrong if it won't run when not being debugged |
The language server crashes with a segfault when I try to use it from within Emacs, or any other editor. Executing
asy -lsp
from the terminal works correctly, but when I try to actually use it, it always segfaults. I haven't been able to figure out why. I'm certain that LSP is enabled. I haven't been able to replicate the issue outside of an editor. As best I can tell, it's not the lack of a TTY, so I'm kind of stumped.The text was updated successfully, but these errors were encountered: