Skip to content
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

[SR-14980] Sourcekit-LSP crash after interrupting an incomplete completion #518

Closed
swift-ci opened this issue Jul 27, 2021 · 7 comments
Closed
Labels
bug Something isn't working

Comments

@swift-ci
Copy link

Previous ID SR-14980
Radar rdar://problem/81277873
Original Reporter wibe (JIRA User)
Type Bug
Status Closed
Resolution Invalid
Additional Detail from JIRA
Votes 0
Component/s SourceKit-LSP
Labels Bug
Assignee wibe (JIRA)
Priority Medium

md5: 4181e452d8e664e1f6b7f5ec72f3ff7e

Issue Description:

  1. Expected Behaviour:
    the server not to crash and return results.
  1. Current Behaviour :
    the server crashed and only empty results after that
  1. Steps to reproduce:
  • install sourcekit-lsp: https://github.com/emacs-lsp/lsp-sourcekit on emacs

  • install the swift toolchain

  • open a swift file

  • type "fun", select the "func"- option from the dropdown

  • try typing out "hello(name: string)" ignoring any suggestion

  1. Context:

os: osx, editor: emacs, toolchain: 5.4.2

  1. Detailed description:
    if done so as described above the sourcekit-lsp crashes
    ```
    func hello(na
    --------------^ here
    ```
    it seems after the return message "request cancelled" with the code "-32800" the process sourcekit-lsp only provides empty responses. i included such an empty response in the following stacktrace, which starts from the point where I have selected the "func" option
    and ends one message after the crash.

https://termbin.com/kwyw

the error from sourcekit-lsp:
2021-07-21 02:46:22.001 sourcekit-lsp[47:a15a5700] triggerFromIncompleteCompletions with incompatible completion session; expected DocumentURI(storage: \url{file:///work/cards/service/test/Sources/test/main.swift})@29, but got DocumentURI(storage: \url{file:///work/cards/service/test/Sources/test/main.swift})@35

@typesanitizer
Copy link

cc @benlangmuir

@typesanitizer
Copy link

@swift-ci create

@benlangmuir
Copy link
Member

Can you clarify why you think sourcekit has crashed? Did you see a crash log for SourceKitService or sourcekit-lsp process? If so, are you able to attach it or otherwise capture the backtrace? From your logs it looks to me like sourcekit-lsp cannot have crashed, since it continued to reply, and there is no way to tell if sourcekitd crashed from what is in the log.

it seems after the return message "request cancelled" with the code "-32800" the process sourcekit-lsp only provides empty responses.

Can you clarify "only provides empty responses" or perhaps include more of the log? Is this to all requests or only to completion requests? Does the completion just keep using "triggerKind 3" without ever using a different trigger kind? The incomplete trigger kind (3) is only supposed to be used if it's considered part of the same completion as before. Does invoking code-completion manually somewhere else work?

Incidentally, in Swift 5.5 we added '(' to the code-completion trigger characters, so I would expect the editor to perform a fresh completion after the '('.

@swift-ci
Copy link
Author

swift-ci commented Aug 2, 2021

Comment by wibe (JIRA)

the following link points to the full stack trace:
https://termbin.com/0x2n

it show clearly how the plugin tries to continuously query the sourcekit-lsp but gets no response back.
i have not managed to attach a debugger such as lldb to the running process. it either forks the process but becomes
unreachable to the ide or cannot establish a connection.

to further elaborate on the "empty responses", from the stack trace one can deduce 2 different kinds of "cancel requests".

  • "received response 'nil ...'"

  • "received response 'textDocument/completion - ...'"
    only latter leads, which comes with above stated error, to follow up empty responses. after that the completion mechanics stops working over all swift files.

i am not at all sure the sourcekit-lsp is solely responsible. But reporting this might improve the stability of the program

@swift-ci
Copy link
Author

swift-ci commented Aug 2, 2021

Comment by wibe (JIRA)

after evaluating further i must admit, that i have been in the wrong.

the process is still running and is returning messages.
just not completion messages because there are no more completion requests.

i have opened an issue here if further question arise:
emacs-lsp/lsp-mode#3028

@swift-ci
Copy link
Author

swift-ci commented Aug 2, 2021

Comment by wibe (JIRA)

invalid for the client is at fault

@benlangmuir
Copy link
Member

Thanks for following up!

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 9, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants