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-8553] CodeCompletion: abort() called – llvm::BitstreamCursor::readRecord #51071

Closed
nathawes opened this issue Aug 16, 2018 · 4 comments
Closed
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. code completion Area → source tooling: code completion compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software source tooling Area: IDE support, SourceKit, and other source tooling

Comments

@nathawes
Copy link
Collaborator

Previous ID SR-8553
Radar rdar://problem/43394725
Original Reporter @nathawes
Type Bug
Status Resolved
Resolution Cannot Reproduce
Additional Detail from JIRA
Votes 0
Component/s CodeCompletion
Labels Bug, CompilerCrash
Assignee None
Priority Medium

md5: 53f52fc259fb6266c7477ee335495808

relates to:

  • SR-8556 CodeCompletion: assertion failure: (Blob.size() % sizeof(PPEntityOffset) == 0) – clang::ASTReader::ReadASTBlock

Issue Description:

Using Xcode 10 beta 5 and the August 14 swift.org development toolchain the below steps crash SourceKitService:

git clone https://github.com/AsyncNinja/AsyncNinja.git
cd AsyncNinja
git checkout -f efc83bd21d8c25ba3896debab5f66408f683a1e7

Open the Xcode project then invoke code completion after ‘import’ at AsyncNinja/Sources/BaseProducer.swift:23:8

Thread 7 Crashed:0
   libsystem_kernel.dylib        0x00007fff5dad99a6 __pthread_kill + 101
   libsystem_pthread.dylib       0x00007fff5db77000 pthread_kill + 2852
   libsystem_c.dylib             0x00007fff5da2c13e __abort + 1443
   libsystem_c.dylib             0x00007fff5da2c0ac abort + 1424
   com.apple.SourceKitService.4.2.2018081401_osx0x000000010043fa35 fatal_error_handler(void*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool) + 535
   com.apple.SourceKitService.4.2.2018081401_osx0x000000010050cffc llvm::report_fatal_error(llvm::Twine const&, bool) + 2526
   com.apple.SourceKitService.4.2.2018081401_osx0x000000010050cefb llvm::report_fatal_error(char const*, bool) + 437
   com.apple.SourceKitService.4.2.2018081401_osx0x0000000102c8b268 llvm::BitstreamCursor::readRecord(unsigned int, llvm::SmallVectorImpl<unsigned long long>&, llvm::StringRef*) + 19928
   com.apple.SourceKitService.4.2.2018081401_osx0x000000010172ccc2 clang::ASTReader::ReadASTBlock(clang::serialization::ModuleFile&, unsigned int) + 16669
   com.apple.SourceKitService.4.2.2018081401_osx0x0000000101736ed2 clang::ASTReader::ReadAST(llvm::StringRef, clang::serialization::ModuleKind, clang::SourceLocation, unsigned int, llvm::SmallVectorImpl<clang::ASTReader::ImportedSubmodule>*) + 57810
  com.apple.SourceKitService.4.2.2018081401_osx0x00000001014e9b7e clang::CompilerInstance::loadModule(clang::SourceLocation, llvm::ArrayRef<std::__1::pair<clang::IdentifierInfo*, clang::SourceLocation> >, clang::Module::NameVisibilityKind, bool) + 1423811
  com.apple.SourceKitService.4.2.2018081401_osx0x00000001021d4397 clang::Preprocessor::HandleIncludeDirective(clang::SourceLocation, clang::Token&, clang::DirectoryLookup const*, clang::FileEntry const*, bool) + 1671112
  com.apple.SourceKitService.4.2.2018081401_osx0x00000001021d5d75 clang::Preprocessor::HandleDirective(clang::Token&) + 120513
  com.apple.SourceKitService.4.2.2018081401_osx0x00000001021a9d06 clang::Lexer::LexTokenInternal(clang::Token&, bool) + 1175014
  com.apple.SourceKitService.4.2.2018081401_osx0x00000001021a5d3e clang::Lexer::Lex(clang::Token&) + 12615
  com.apple.SourceKitService.4.2.2018081401_osx0x000000010220b484 clang::Preprocessor::Lex(clang::Token&) + 6816
  com.apple.SourceKitService.4.2.2018081401_osx0x00000001016ffe0d clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 31717
  com.apple.SourceKitService.4.2.2018081401_osx0x00000001016643e5 clang::ParseAST(clang::Sema&, bool, bool) + 46918
  com.apple.SourceKitService.4.2.2018081401_osx0x0000000101525cce clang::FrontendAction::Execute() + 7819
  com.apple.SourceKitService.4.2.2018081401_osx0x00000001014e4791 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 131320
  com.apple.SourceKitService.4.2.2018081401_osx0x00000001014eedc2 void llvm::function_ref<void ()>::callback_fn<compileModuleImpl(clang::CompilerInstance&, clang::SourceLocation, llvm::StringRef, clang::FrontendInputFile, llvm::StringRef, llvm::StringRef, llvm::function_ref<void (clang::CompilerInstance&)>, llvm::function_ref<void (clang::CompilerInstance&)>)::$_3>(long) + 13021
  com.apple.SourceKitService.4.2.2018081401_osx0x0000000100507b5e llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) + 22222
  com.apple.SourceKitService.4.2.2018081401_osx0x0000000100507d00 RunSafelyOnThread_Dispatch(void*) + 4823
  com.apple.SourceKitService.4.2.2018081401_osx0x0000000100573f1d ExecuteOnThread_Dispatch(void*) + 1324
  libsystem_pthread.dylib       0x00007fff5db74bc6 _pthread_body + 12825
  libsystem_pthread.dylib       0x00007fff5db74b32 _pthread_start + 7026
  libsystem_pthread.dylib       0x00007fff5db746f9 thread_start + 13
 
@nathawes
Copy link
Collaborator Author

@swift-ci create

@rintaro
Copy link
Mannequin

rintaro mannequin commented Aug 17, 2018

Triggering thread:

Thread 3:
0   libsystem_kernel.dylib          0x00007fff6a18ffc6 __ulock_wait + 10
1   libsystem_pthread.dylib         0x00007fff6a22f761 _pthread_join + 356
2   com.apple.SourceKitService.4.2.2018081601_osx   0x000000010fa3621a llvm::llvm_execute_on_thread(void (*)(void*), void*, unsigned int) + 90
3   com.apple.SourceKitService.4.2.2018081601_osx   0x000000010f9ca771 llvm::CrashRecoveryContext::RunSafelyOnThread(llvm::function_ref<void ()>, unsigned int) + 81
4   com.apple.SourceKitService.4.2.2018081601_osx   0x000000011099a6d6 compileModuleImpl(clang::CompilerInstance&, clang::SourceLocation, llvm::StringRef, clang::FrontendInputFile, llvm::StringRef, llvm::StringRef, llvm::function_ref<void (clang::CompilerInstance&)>, llvm::function_ref<void (clang::CompilerInstance&)>) + 3766
5   com.apple.SourceKitService.4.2.2018081601_osx   0x0000000110997bb4 clang::CompilerInstance::loadModule(clang::SourceLocation, llvm::ArrayRef<std::__1::pair<clang::IdentifierInfo*, clang::SourceLocation> >, clang::Module::NameVisibilityKind, bool) + 14116
6   com.apple.SourceKitService.4.2.2018081601_osx   0x0000000110310755 swift::ClangImporter::loadModule(swift::SourceLoc, llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >)::$_6::operator()(llvm::ArrayRef<std::__1::pair<clang::IdentifierInfo*, clang::SourceLocation> >, bool) const + 405
7   com.apple.SourceKitService.4.2.2018081601_osx   0x0000000110310377 swift::ClangImporter::loadModule(swift::SourceLoc, llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >) + 599
8   com.apple.SourceKitService.4.2.2018081601_osx   0x0000000110401a23 swift::ASTContext::getModule(llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >) + 115
9   com.apple.SourceKitService.4.2.2018081601_osx   0x00000001101d1fae swift::performNameBinding(swift::SourceFile&, unsigned int) + 2078
10  com.apple.SourceKitService.4.2.2018081601_osx   0x000000010faa8e20 swift::CompilerInstance::parseLibraryFile(unsigned int, swift::CompilerInstance::ImplicitImports const&, swift::PersistentParserState&, swift::DelayedParsingCallbacks*, swift::DelayedParsingCallbacks*) + 304
11  com.apple.SourceKitService.4.2.2018081601_osx   0x000000010faa8762 swift::CompilerInstance::parsePartialModulesAndLibraryFiles(swift::CompilerInstance::ImplicitImports const&, swift::PersistentParserState&, swift::DelayedParsingCallbacks*, swift::DelayedParsingCallbacks*) + 354
12  com.apple.SourceKitService.4.2.2018081601_osx   0x000000010faa751f swift::CompilerInstance::parseAndCheckTypesUpTo(swift::CompilerInstance::ImplicitImports const&, swift::SourceFile::ASTStage_t) + 495
13  com.apple.SourceKitService.4.2.2018081601_osx   0x000000010faa6ae3 swift::CompilerInstance::performSemaUpTo(swift::SourceFile::ASTStage_t) + 627
14  com.apple.SourceKitService.4.2.2018081601_osx   0x000000010f916780 void SourceKit::WorkQueue::DispatchData::callAndDelete<(anonymous namespace)::ASTProducer::getASTUnitAsync(SourceKit::SwiftASTManager::Implementation&, llvm::ArrayRef<llvm::IntrusiveRefCntPtr<SourceKit::ImmutableTextSnapshot> >, std::__1::function<void (llvm::IntrusiveRefCntPtr<SourceKit::ASTUnit>, llvm::StringRef)>)::$_3>(void*) + 5360
15  libdispatch.dylib               0x00007fff69fecdcb _dispatch_client_callout + 8
16  libdispatch.dylib               0x00007fff69fefb68 _dispatch_block_invoke_direct + 260
17  com.apple.SourceKitService.4.2.2018081601_osx   0x000000011235039f executeBlock(void*) + 15
18  com.apple.SourceKitService.4.2.2018081601_osx   0x000000010fa3623d ExecuteOnThread_Dispatch(void*) + 13
19  libsystem_pthread.dylib         0x00007fff6a22b881 _pthread_body + 126
20  libsystem_pthread.dylib         0x00007fff6a22b7f3 _pthread_start + 70
21  libsystem_pthread.dylib         0x00007fff6a22b3bd thread_start + 13

@akyrtzi
Copy link
Member

akyrtzi commented Nov 6, 2018

This should have been fixed via these commits:

To github.com:apple/swift-clang.git
c35eea7a180..2d6f167106f swift-5.0-branch -> swift-5.0-branch

To github.com:apple/swift-clang.git
d92b076e6cc..c692cc7ca84 upstream-with-swift -> upstream-with-swift

From rdar://43533418

@nathawes
Copy link
Collaborator Author

This no longer reproduces, so looks like the fixes above worked.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added crash Bug: A crash, i.e., an abnormal termination of software compiler The Swift compiler in itself labels Dec 12, 2022
@AnthonyLatsis AnthonyLatsis added the source tooling Area: IDE support, SourceKit, and other source tooling label Feb 6, 2023
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. code completion Area → source tooling: code completion compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software source tooling Area: IDE support, SourceKit, and other source tooling
Projects
None yet
Development

No branches or pull requests

3 participants