-
Notifications
You must be signed in to change notification settings - Fork 465
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-10319] sourcekit-lsp crashing when opening a swift package with VSC #618
Comments
I can reproduce this from 18.10 running in docker. |
This reproduces on 18.04 as well. Maybe the |
This reproduces in master branch development snapshots as well. I tested some historical snapshots and found:
The crash is not coming from the compiled code, but from the runtime libraries. If I run sourcekit-lsp built with 03-17-a using the runtime libraries from 03-25-a is also crashes, and if I run code built with 03-25-a using the 03-17-a libraries it does not crash. I believe this was triggered by a change to libdispatch, based on the stack trace and the fact there were some huge changes to dispatch in this time period. Note these are on both master and 5.0 branches.
We already had a compile-time crash in clang related to #447 (worked around in #466). |
This seems to be triggered by the QoS we're trying to set. On Linux we don't have `qos.h`, so we use the old DISPATCH_QUEUE_PRIORITY_LOW, which is documented as being equivalent to UTILITY. Here's a reproducer (I have the toolchain installed in ~/swift, so you may need to fix the paths). This reproduces with any recent master development toolchain. It fails while copying the 3rd block. $ cat test.cpp
#include <dispatch/dispatch.h>
#include <Block.h>
#include <stdio.h>
int main() {
auto q = dispatch_queue_create("myqueue", 0);
dispatch_async(q, ^{
puts("myBlock1\n");
});
dispatch_async(q, dispatch_block_create(DISPATCH_BLOCK_INHERIT_QOS_CLASS, ^{
puts("myBlock2\n");
}));
dispatch_async(q, dispatch_block_create_with_qos_class(DISPATCH_BLOCK_INHERIT_QOS_CLASS, DISPATCH_QUEUE_PRIORITY_LOW, 0, ^{
puts("myBlock3\n");
}));
dispatch_main();
}
$ ~/swift/usr/bin/clang test.cpp -I ~/swift/usr/lib/swift/ -I ~/swift/usr/lib/swift/Block/ -fblocks -ldispatch -lBlocksRuntime -L ~/swift/usr/lib/ -o test
$ LD_LIBRARY_PATH=$HOME/swift/usr/lib ./test
myBlock1
myBlock2
Illegal instruction |
I put a workaround into indexstore-db (swiftlang/indexstore-db#27 so if anyone is hitting this in sourcekit-lsp, please update to the latest master (or swift-5.1-branch) and try again (make sure to `swift package update` to get the latest indexstore-db version). |
Attachment: Download
Environment
OS:
Ubuntu 18.04 and 18.10 64-bit
toolchain:
swift-5.0-RELEASE-ubuntu18.04
Additional Detail from JIRA
md5: 973ab2af9bcd0cc9584a10897d3e9f9e
Issue Description:
When I open a package directory in Visual Studio Code, the language server crashes immediately. If package was never built, or I delete the .build directory, the language server works perfectly.
Steps to reproduce:
More info about how I got here is in this thread: https://forums.swift.org/t/using-sourcekit-lsp-on-ubuntu-18-10/22598
lldb output:
The text was updated successfully, but these errors were encountered: