Skip to content

[SR-10319] sourcekit-lsp crashing when opening a swift package with VSC #618

Open
@swift-ci

Description

@swift-ci
Previous ID SR-10319
Radar None
Original Reporter cukier (JIRA User)
Type Bug

Attachment: Download

Environment

OS:
Ubuntu 18.04 and 18.10 64-bit

toolchain:
swift-5.0-RELEASE-ubuntu18.04

Additional Detail from JIRA
Votes 0
Component/s libdispatch, SourceKit-LSP
Labels Bug
Assignee ktopley-apple (JIRA)
Priority Medium

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:

$mkdir bug_report_package
$cd bug_report_package
$swift package init --type executable
$swift run
$code .
click on main.swift file in VSC

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:

cukier@papryka:~$ sudo /home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/bin/lldb
(lldb) process attach -n sourcekit-lsp
Process 10513 stopped
* thread #​1, name = 'sourcekit-lsp', stop reason = signal SIGSTOP
    frame #​0: 0x00007f30c0e6a3f6 libc.so.6`__GI___sigsuspend(set=0x00007f30c1b5b950) at sigsuspend.c:26:10
  thread #​2, name = 'sourcekit-lsp', stop reason = signal SIGSTOP
    frame #​0: 0x00007f30c2bfa142 libpthread.so.0`do_futex_wait at futex-internal.h:205:13
  thread #​3, name = 'sourcekit-lsp', stop reason = signal SIGSTOP
    frame #​0: 0x00007f30c2bfa142 libpthread.so.0`do_futex_wait at futex-internal.h:205:13
  thread #​4, name = 'sourcekit-lsp', stop reason = signal SIGSTOP
    frame #​0: 0x00007f30c2bfa142 libpthread.so.0`do_futex_wait at futex-internal.h:205:13
  thread #​5, name = 'sourcekit-lsp', stop reason = signal SIGSTOP
    frame #​0: 0x00007f30c2bfa142 libpthread.so.0`do_futex_wait at futex-internal.h:205:13
  thread #​6, name = 'sourcekit-lsp', stop reason = signal SIGSTOP
    frame #​0: 0x00007f30c2bfa142 libpthread.so.0`do_futex_wait at futex-internal.h:205:13
  thread #​7, name = 'sourcekit-lsp', stop reason = signal SIGSTOP
    frame #​0: 0x00007f30c2bfa142 libpthread.so.0`do_futex_wait at futex-internal.h:205:13
  thread #​8, name = 'sourcekit-lsp', stop reason = signal SIGSTOP
    frame #​0: 0x00007f30c2bfa142 libpthread.so.0`do_futex_wait at futex-internal.h:205:13
  thread #​9, name = 'sourcekit-lsp', stop reason = signal SIGSTOP
    frame #​0: 0x00007f30c0f4410f libc.so.6`epoll_wait(epfd=3, events=0x00007f30b1ffaa30, maxevents=16, timeout=-1) at epoll_wait.c:30:10
  thread #​10, name = 'sourcekit-lsp', stop reason = signal SIGSTOP
    frame #​0: 0x00007f30c2bf72eb libpthread.so.0`__pthread_cond_wait at futex-internal.h:88:13
  thread #​11, name = 'sourcekit-lsp', stop reason = signal SIGSTOP
    frame #​0: 0x00007f30c2bfa142 libpthread.so.0`do_futex_wait at futex-internal.h:205:13
  thread #​12, name = 'sourcekit-lsp', stop reason = signal SIGSTOP
    frame #​0: 0x00007f30c2bfac24 libpthread.so.0`__libc_read at read.c:26:10
  thread #​13, name = 'sourcekit-lsp', stop reason = signal SIGSTOP
    frame #​0: 0x00007f30c2bfac24 libpthread.so.0`__libc_read at read.c:26:10
Target 0: (sourcekit-lsp) stopped.

Executable module set to "/home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/sourcekit-lsp".
Architecture set to: x86_64--linux-gnu.
(lldb) continue
Process 10513 resuming
Process 10513 stopped and restarted: thread 1 received signal: SIGCHLD
(lldb) error: ld-linux-x86-64.so.2 0xffffffff0005f117: adding range [0x14167-0x141ca) which has a base that is less than the function's low PC 0x148c0. Please file a bug and attach the file at the start of this error message
error: ld-linux-x86-64.so.2 0xffffffff0005f117: adding range [0x141e0-0x141e6) which has a base that is less than the function's low PC 0x148c0. Please file a bug and attach the file at the start of this error message
error: ld-linux-x86-64.so.2 0xffffffff0005f184: adding range [0x14167-0x141ca) which has a base that is less than the function's low PC 0x148c0. Please file a bug and attach the file at the start of this error message
error: ld-linux-x86-64.so.2 0xffffffff0005f184: adding range [0x141e0-0x141e6) which has a base that is less than the function's low PC 0x148c0. Please file a bug and attach the file at the start of this error message
Process 10513 stopped
* thread #​14, name = 'sourcekit-lsp', stop reason = signal SIGILL: illegal instruction operand
    frame #​0: 0x00007f30c1b3d5cc libdispatch.so`_dispatch_Block_copy + 44
libdispatch.so`_dispatch_Block_copy:
->  0x7f30c1b3d5cc <+44>: ud2    
    0x7f30c1b3d5ce:       nop    
libdispatch.so`_dispatch_call_block_and_release:
    0x7f30c1b3d5d0 <+0>:  pushq  %rbx
    0x7f30c1b3d5d1 <+1>:  movq   %rdi, %rbx
Target 0: (sourcekit-lsp) stopped.
(lldb) bt
* thread #&#8203;14, name = 'sourcekit-lsp', stop reason = signal SIGILL: illegal instruction operand
  * frame #&#8203;0: 0x00007f30c1b3d5cc libdispatch.so`_dispatch_Block_copy + 44
    frame #&#8203;1: 0x00007f309c07f290
    frame #&#8203;2: 0x000055d57d60ead6 sourcekit-lsp`std::_Function_handler<void (indexstore::IndexStore::UnitEventNotification), (anonymous namespace)::IndexDatastoreImpl::init(std::shared_ptr<indexstore::IndexStore>, std::shared_ptr<IndexStoreDB::index::SymbolIndex>, std::shared_ptr<IndexStoreDB::index::IndexSystemDelegate>, std::shared_ptr<IndexStoreDB::CanonicalPathCache>, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)::$_6>::_M_invoke(__functor=0x00007f309c04c580, __args=0x00007f30abffe708) at std_function.h:297:2
    frame #&#8203;3: 0x000055d57d61eb8b sourcekit-lsp`std::function<void (indexstore::IndexStore::UnitEventNotification)>::operator(this=0x00007f309c04c580, __args=UnitEventNotification @ 0x00007f30abffe708)(indexstore::IndexStore::UnitEventNotification) const at std_function.h:687:14
    frame #&#8203;4: 0x000055d57d61ea34 sourcekit-lsp`indexstore::IndexStore::setUnitEventHandler(this=0x00007f309c04c580, evt_note=0x00007f30abffe800)>)::'lambda'(void*)::operator()(void*) const at IndexStoreCXX.h:220:9
    frame #&#8203;5: 0x000055d57d61e5c2 sourcekit-lsp`std::_Function_handler<void (void*), indexstore::IndexStore::setUnitEventHandler(std::function<void (indexstore::IndexStore::UnitEventNotification)>)::'lambda'(void*)>::_M_invoke(__functor=0x00007f309c07f340, __args=0x00007f30abffe7b0) at std_function.h:297:2
    frame #&#8203;6: 0x000055d57d61eeb8 sourcekit-lsp`std::function<void (void*)>::operator(this=0x00007f309c07f340, __args=0x00007f30abffe800)(void*) const at std_function.h:687:14
    frame #&#8203;7: 0x000055d57d61e345 sourcekit-lsp`indexstore::IndexStore::event_handler(ctx=0x00007f309c07f340, evt=0x00007f30abffe800) at IndexStoreCXX.h:230:5
    frame #&#8203;8: 0x00007f30b8f9c703 libIndexStore.so`std::_Function_handler<void (clang::index::IndexDataStore::UnitEventNotification), indexstore_store_set_unit_event_handler_f::$_1>::_M_invoke(std::_Any_data const&, clang::index::IndexDataStore::UnitEventNotification&&) + 35
    frame #&#8203;9: 0x00007f30b8f9e054 libIndexStore.so`std::_Function_handler<void (llvm::ArrayRef<clang::DirectoryWatcher::Event>, bool), (anonymous namespace)::IndexDataStoreImpl::startEventListening(bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)::$_0>::_M_invoke(std::_Any_data const&, llvm::ArrayRef<clang::DirectoryWatcher::Event>&&, bool&&) + 468
    frame #&#8203;10: 0x00007f30b8fb26cc libIndexStore.so`clang::DirectoryWatcher::Implementation::initialize(llvm::StringRef, std::function<void (llvm::ArrayRef<clang::DirectoryWatcher::Event>, bool)>, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)::$_1::operator()() const + 1868
    frame #&#8203;11: 0x00007f30c10ea63f libstdc++.so.6`___lldb_unnamed_symbol439$$libstdc++.so.6 + 15
    frame #&#8203;12: 0x00007f30c2bf1164 libpthread.so.0`start_thread(arg=<unavailable>) at pthread_create.c:486:8
    frame #&#8203;13: 0x00007f30c0f43def libc.so.6`__GI___clone at clone.S:95
(lldb) 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions