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-11282] LLDB REPL code completion assertion failure #4482

Open
marcrasi mannequin opened this issue Aug 9, 2019 · 7 comments
Open

[SR-11282] LLDB REPL code completion assertion failure #4482

marcrasi mannequin opened this issue Aug 9, 2019 · 7 comments
Labels
bug Something isn't working LLDB for Swift

Comments

@marcrasi
Copy link
Mannequin

marcrasi mannequin commented Aug 9, 2019

Previous ID SR-11282
Radar rdar://problem/53519966
Original Reporter @marcrasi
Type Bug
Status Reopened
Resolution
Additional Detail from JIRA
Votes 0
Component/s LLDB for Swift
Labels Bug
Assignee None
Priority Medium

md5: 3c26071b948b95bf059140649b7d0b02

is duplicated by:

  • SR-11302 REPL: Triggering autocomplete on imported type leads to crash

Issue Description:

On the Ubuntu 18.04 2019-08-05 development snapshot,

marcrasi@marcrasi:~/Downloads/swift-toolchains/swift-DEVELOPMENT-SNAPSHOT-2019-08-05-a-ubuntu18.04$ usr/bin/swift
Welcome to Swift version 5.1-dev (LLVM 200186e28b, Swift caeb2a44a8).
Type :help for assistance.
 1> func foo(_ x: String) { print(x) }
 2> foo("hello"<TAB>

Produces this assertion failure:

 lldb: /home/buildnode/jenkins/workspace/oss-swift-package-linux-ubuntu-18_04/swift/lib/AST/Evaluator.cpp:57: void swift::Evaluator::registerRequestFunctions(uint8_t, ArrayRef<swift::AbstractRequestFunction *>): Assertion `zone.first != zoneID' failed.
/usr/local/google/home/marcrasi/Downloads/swift-toolchains/swift-DEVELOPMENT-SNAPSHOT-2019-08-05-a-ubuntu18.04/usr/bin/lldb[0x41f9f4]
/usr/local/google/home/marcrasi/Downloads/swift-toolchains/swift-DEVELOPMENT-SNAPSHOT-2019-08-05-a-ubuntu18.04/usr/bin/lldb[0x41da3c]
/usr/local/google/home/marcrasi/Downloads/swift-toolchains/swift-DEVELOPMENT-SNAPSHOT-2019-08-05-a-ubuntu18.04/usr/bin/lldb[0x41ff88]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x123a0)[0x7ff499cf43a0]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x10b)[0x7ff49155acfb]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x129)[0x7ff4915458ad]
/lib/x86_64-linux-gnu/libc.so.6(+0x2177f)[0x7ff49154577f]
/lib/x86_64-linux-gnu/libc.so.6(+0x2f542)[0x7ff491553542]
/usr/local/google/home/marcrasi/Downloads/swift-toolchains/swift-DEVELOPMENT-SNAPSHOT-2019-08-05-a-ubuntu18.04/usr/bin/../lib/liblldb.so.7svn(+0x1ed9d3c)[0x7ff494390d3c]
/usr/local/google/home/marcrasi/Downloads/swift-toolchains/swift-DEVELOPMENT-SNAPSHOT-2019-08-05-a-ubuntu18.04/usr/bin/../lib/liblldb.so.7svn(+0x13a311a)[0x7ff49385a11a]
/usr/local/google/home/marcrasi/Downloads/swift-toolchains/swift-DEVELOPMENT-SNAPSHOT-2019-08-05-a-ubuntu18.04/usr/bin/../lib/liblldb.so.7svn(+0xd227f7)[0x7ff4931d97f7]
/usr/local/google/home/marcrasi/Downloads/swift-toolchains/swift-DEVELOPMENT-SNAPSHOT-2019-08-05-a-ubuntu18.04/usr/bin/../lib/liblldb.so.7svn(+0xa793de)[0x7ff492f303de]
/usr/local/google/home/marcrasi/Downloads/swift-toolchains/swift-DEVELOPMENT-SNAPSHOT-2019-08-05-a-ubuntu18.04/usr/bin/../lib/liblldb.so.7svn(+0x9eb379)[0x7ff492ea2379]
/usr/local/google/home/marcrasi/Downloads/swift-toolchains/swift-DEVELOPMENT-SNAPSHOT-2019-08-05-a-ubuntu18.04/usr/bin/../lib/liblldb.so.7svn(+0xa893de)[0x7ff492f403de]
/usr/local/google/home/marcrasi/Downloads/swift-toolchains/swift-DEVELOPMENT-SNAPSHOT-2019-08-05-a-ubuntu18.04/usr/bin/../lib/liblldb.so.7svn(+0xa8b629)[0x7ff492f42629]
/lib/x86_64-linux-gnu/libedit.so.2(el_wgets+0x107)[0x7ff490d7e5c7]
/lib/x86_64-linux-gnu/libedit.so.2(el_gets+0x13)[0x7ff490d79cc3]
/usr/local/google/home/marcrasi/Downloads/swift-toolchains/swift-DEVELOPMENT-SNAPSHOT-2019-08-05-a-ubuntu18.04/usr/bin/../lib/liblldb.so.7svn(+0xa8b01d)[0x7ff492f4201d]
/usr/local/google/home/marcrasi/Downloads/swift-toolchains/swift-DEVELOPMENT-SNAPSHOT-2019-08-05-a-ubuntu18.04/usr/bin/../lib/liblldb.so.7svn(+0x9ebcc4)[0x7ff492ea2cc4]
/usr/local/google/home/marcrasi/Downloads/swift-toolchains/swift-DEVELOPMENT-SNAPSHOT-2019-08-05-a-ubuntu18.04/usr/bin/../lib/liblldb.so.7svn(+0x9d0346)[0x7ff492e87346]
/usr/local/google/home/marcrasi/Downloads/swift-toolchains/swift-DEVELOPMENT-SNAPSHOT-2019-08-05-a-ubuntu18.04/usr/bin/../lib/liblldb.so.7svn(+0x9d449f)[0x7ff492e8b49f]
/usr/local/google/home/marcrasi/Downloads/swift-toolchains/swift-DEVELOPMENT-SNAPSHOT-2019-08-05-a-ubuntu18.04/usr/bin/../lib/liblldb.so.7svn(+0xa931ac)[0x7ff492f4a1ac]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x7c73)[0x7ff499ce9c73]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x3f)[0x7ff49161cdef]
Aborted

The same failure does not occur on the 5.0.2 release.

@belkadan
Copy link

Fixed in master, but did not make 5.1. :-( cc @dcci

@dcci
Copy link
Mannequin

dcci mannequin commented Aug 14, 2019

Looking.

@dcci
Copy link
Mannequin

dcci mannequin commented Aug 14, 2019

Ugh, I can't reproduce on 5.1 at all :|

swift % ./build/Ninja-DebugAssert+stdlib-Debug/lldb-macosx-x86_64/bin/lldb --repl
Welcome to Swift version 5.1-dev (LLVM 688b71e2f9, Swift 20b8d4c30b).
Type :help for assistance.
  1> func foo(_ x: String) { print(x) }
  2> foo("hello"
Available completions:
     != String -> Bool                                                                                                                                                                         
     + String -> String                                                                                                                                                                        
    ... -> PartialRangeFrom<String>                                                                                                                                                            
     ... String -> ClosedRange<String>                                                                                                                                                         
     ..< String -> Range<String>                                                                                                                                                               
     < String -> Bool                                                                                                                                                                          
     <= String -> Bool                                                                                                                                                                         
     == String -> Bool                                                                                                                                                                         

In fact, the code that causes the crash which I fixed doesn't really exist on 5.1

@marcrasi
Copy link
Mannequin Author

marcrasi mannequin commented Aug 29, 2019

Do you happen to know which commit(s) fixed this? We have a branch with this problem and we might want to cherry-pick the fix onto it if possible.

@dcci
Copy link
Mannequin

dcci mannequin commented Aug 29, 2019

Sure, let me find them.

@dcci
Copy link
Mannequin

dcci mannequin commented Aug 29, 2019

These two, I think:
apple/swift-lldb#1830
apple/swift-lldb#1882

Please let me know if you still have issues and I'll try looking at them.

@swift-ci
Copy link

Comment by Yaroslav (JIRA)

I'm still facing this issue.

Issue appears on macOS 10.15.2, not on Linux.

The issue appears when I'm trying to import any module, like:

$ swift
Welcome to Apple Swift version 5.1.3 (swiftlang-1100.0.282.1 clang-1100.0.33.15).

Type :help for assistance.

  1> im<TAB>

follows this:

0  lldb                     0x0000000101923705 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37

1  lldb                     0x0000000101922d77 llvm::sys::RunSignalHandlers() + 39

2  lldb                     0x0000000101923d58 SignalHandler(int) + 264

3  libsystem_platform.dylib 0x00007fff6ceb142d _sigtramp + 29

4  libsystem_platform.dylib 000000000000000000 _sigtramp + 2467621872

5  LLDB                     0x0000000103bcfb0d (anonymous namespace)::CodeCompletionCallbacksImpl::doneParsing() + 15469

6  LLDB                     0x00000001043b621a swift::performDelayedParsing(swift::DeclContext*, swift::PersistentParserState&, swift::CodeCompletionCallbacksFactory*) + 458

7  LLDB                     0x0000000103bf396e doCodeCompletion(swift::SourceFile&, llvm::StringRef, unsigned int*, swift::CodeCompletionCallbacksFactory*) + 494

8  LLDB                     0x0000000103bf3711 swift::REPLCompletions::populate(swift::SourceFile&, llvm::StringRef) + 673

9  LLDB                     0x0000000103631599 lldb_private::SwiftREPL::CompleteCode(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, lldb_private::StringList&) + 569

10 LLDB                     0x00000001033e09b9 lldb_private::REPL::IOHandlerComplete(lldb_private::IOHandler&, char const*, char const*, char const*, int, int, lldb_private::StringList&, lldb_private::StringList&) + 489

11 LLDB                     0x0000000103354657 lldb_private::IOHandlerEditline::AutoCompleteCallback(char const*, char const*, char const*, int, int, lldb_private::StringList&, lldb_private::StringList&, void*) + 55

12 LLDB                     0x00000001033f770e lldb_private::Editline::TabCommand(int) + 110

13 LLDB                     0x00000001033f9a41 lldb_private::Editline::ConfigureEditor(bool)::$_13::__invoke(editline*, int) + 33

14 libedit.3.dylib          0x00007fff6a85b7db el_wgets + 484

15 libedit.3.dylib          0x00007fff6a8668bb el_gets + 37

16 LLDB                     0x00000001033f922e lldb_private::Editline::GetLines(int, lldb_private::StringList&, bool&) + 446

17 LLDB                     0x0000000103355003 lldb_private::IOHandlerEditline::Run() + 115

18 LLDB                     0x000000010333c4db lldb_private::Debugger::ExecuteIOHandlers() + 123

19 LLDB                     0x000000010333ef23 lldb_private::Debugger::IOHandlerThread(void*) + 19

20 LLDB                     0x00000001033e97e7 lldb_private::HostNativeThreadBase::ThreadCreateTrampoline(void*) + 103

21 libsystem_pthread.dylib  0x00007fff6cebce65 _pthread_start + 148

22 libsystem_pthread.dylib  0x00007fff6ceb883b thread_start + 15

[1]    6743 segmentation fault  swift

Issue also appears within imported methods completions within --repl.

$ swift run --repl
Launching Swift REPL with arguments: -I/Volumes/devel/Programming/swift/backend/CustomerRadar/DaDataClient/.build/x86_64-apple-macosx/debug -L/Volumes/devel/Programming/swift/backend/CustomerRadar/DaDataClient/.build/x86_64-apple-macosx/debug -lDaDataClient__REPL
Welcome to Apple Swift version 5.1.3 (swiftlang-1100.0.282.1 clang-1100.0.33.15).
Type :help for assistance.
  1> import DaDataClient
  2> var z = DaDataController(
*** DESERIALIZATION FAILURE (please include this section in any bug report) ***
module 'Swift' was not loaded
0  lldb                     0x0000000102203705 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  lldb                     0x0000000102202d77 llvm::sys::RunSignalHandlers() + 39
2  lldb                     0x0000000102203d58 SignalHandler(int) + 264
3  libsystem_platform.dylib 0x00007fff6ceb142d _sigtramp + 29
4  libsystem_platform.dylib 0x0000000106630738 _sigtramp + 2574775080
5  libsystem_c.dylib        0x00007fff6cd86a1c abort + 120
6  LLDB                     0x000000010a0a24c8 swift::ModuleFile::fatal(llvm::Error) + 760
7  LLDB                     0x00000001077a5a32 swift::DeclDeserializer::deserializeEnum(llvm::ArrayRef<unsigned long long>, llvm::StringRef) + 1090
8  LLDB                     0x000000010779fbde swift::DeclDeserializer::getDeclCheckedImpl() + 1070
9  LLDB                     0x000000010779903d swift::ModuleFile::getDeclChecked(llvm::PointerEmbeddedInt<unsigned int, 31>) + 349
10 LLDB                     0x00000001077a7ac9 swift::TypeDeserializer::deserializeNominalType(llvm::ArrayRef<unsigned long long>, llvm::StringRef) + 73
11 LLDB                     0x00000001077a725c swift::TypeDeserializer::getTypeCheckedImpl() + 940
12 LLDB                     0x000000010779ab00 swift::ModuleFile::getTypeChecked(llvm::PointerEmbeddedInt<unsigned int, 31>) + 208
13 LLDB                     0x00000001077a34fa swift::DeclDeserializer::deserializeVar(llvm::ArrayRef<unsigned long long>, llvm::StringRef) + 762
14 LLDB                     0x000000010779fad4 swift::DeclDeserializer::getDeclCheckedImpl() + 804
15 LLDB                     0x000000010779903d swift::ModuleFile::getDeclChecked(llvm::PointerEmbeddedInt<unsigned int, 31>) + 349
16 LLDB                     0x000000010779866d swift::ModuleFile::readPattern(swift::DeclContext*) + 397
17 LLDB                     0x00000001077988f9 swift::ModuleFile::readPattern(swift::DeclContext*) + 1049
18 LLDB                     0x00000001077a43f0 swift::DeclDeserializer::deserializePatternBinding(llvm::ArrayRef<unsigned long long>, llvm::StringRef) + 272
19 LLDB                     0x000000010779fc03 swift::DeclDeserializer::getDeclCheckedImpl() + 1107
20 LLDB                     0x000000010779903d swift::ModuleFile::getDeclChecked(llvm::PointerEmbeddedInt<unsigned int, 31>) + 349
21 LLDB                     0x00000001077a9564 swift::ModuleFile::loadAllMembers(swift::Decl*, unsigned long long) + 532
22 LLDB                     0x00000001079d2be0 swift::IterableDeclContext::loadAllMembers() const + 240
23 LLDB                     0x00000001079d2ade swift::IterableDeclContext::getMembers() const + 14
24 LLDB                     0x0000000107a36960 swift::NominalTypeDecl::lookupDirect(swift::DeclName, swift::OptionSet<swift::NominalTypeDecl::LookupDirectFlags, unsigned int>) + 288
25 LLDB                     0x0000000107a38675 swift::DeclContext::lookupQualified(llvm::ArrayRef<swift::NominalTypeDecl*>, swift::DeclName, swift::NLOptions, llvm::SmallVectorImpl<swift::ValueDecl*>&) const + 1317
26 LLDB                     0x0000000107a375de swift::DeclContext::lookupQualified(swift::Type, swift::DeclName, swift::NLOptions, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ValueDecl*>&) const + 318
27 LLDB                     0x000000010773c0b5 swift::TypeChecker::lookupMember(swift::DeclContext*, swift::Type, swift::DeclName, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 341
28 LLDB                     0x0000000107693554 swift::constraints::ConstraintSystem::lookupMember(swift::Type, swift::DeclName) + 196
29 LLDB                     0x0000000107631ee9 swift::constraints::ConstraintSystem::performMemberLookup(swift::constraints::ConstraintKind, swift::DeclName, swift::Type, swift::FunctionRefKind, swift::constraints::ConstraintLocator*, bool) + 2281
30 LLDB                     0x000000010763459e swift::constraints::ConstraintSystem::simplifyMemberConstraint(swift::constraints::ConstraintKind, swift::Type, swift::DeclName, swift::Type, swift::DeclContext*, swift::FunctionRefKind, llvm::ArrayRef<swift::constraints::OverloadChoice>, swift::OptionSet<swift::constraints::ConstraintSystem::TypeMatchFlags, unsigned int>, swift::constraints::ConstraintLocatorBuilder) + 190
31 LLDB                     0x0000000107705202 swift::constraints::ConstraintSystem::addValueMemberConstraint(swift::Type, swift::DeclName, swift::Type, swift::DeclContext*, swift::FunctionRefKind, llvm::ArrayRef<swift::constraints::OverloadChoice>, swift::constraints::ConstraintLocatorBuilder) + 98
32 LLDB                     0x000000010763010c swift::constraints::ConstraintSystem::simplifyConstructionConstraint(swift::Type, swift::FunctionType*, swift::OptionSet<swift::constraints::ConstraintSystem::TypeMatchFlags, unsigned int>, swift::DeclContext*, swift::FunctionRefKind, swift::constraints::ConstraintLocator*) + 780
33 LLDB                     0x000000010763928f swift::constraints::ConstraintSystem::simplifyApplicableFnConstraint(swift::Type, swift::Type, swift::OptionSet<swift::constraints::ConstraintSystem::TypeMatchFlags, unsigned int>, swift::constraints::ConstraintLocatorBuilder) + 1855
34 LLDB                     0x0000000107628d8f swift::constraints::ConstraintSystem::addConstraint(swift::constraints::ConstraintKind, swift::Type, swift::Type, swift::constraints::ConstraintLocatorBuilder, bool) + 63
35 LLDB                     0x000000010761c2aa (anonymous namespace)::ConstraintGenerator::visitApplyExpr(swift::ApplyExpr*) + 634
36 LLDB                     0x0000000107613e08 (anonymous namespace)::ConstraintWalker::walkToExprPost(swift::Expr*) + 184
37 LLDB                     0x000000010798c6a3 swift::Expr::walk(swift::ASTWalker&) + 115
38 LLDB                     0x000000010761056f swift::constraints::ConstraintSystem::generateConstraints(swift::Expr*, swift::DeclContext*) + 399
39 LLDB                     0x0000000107645f41 swift::constraints::ConstraintSystem::solveImpl(swift::Expr*&, swift::Type, swift::ExprTypeCheckListener*, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 449
40 LLDB                     0x0000000107645b4f swift::constraints::ConstraintSystem::solve(swift::Expr*&, swift::Type, swift::ExprTypeCheckListener*, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 31
41 LLDB                     0x00000001076f6ff5 swift::TypeChecker::typeCheckExpressionImpl(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener&, swift::constraints::ConstraintSystem*) + 917
42 LLDB                     0x00000001076f8614 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 740
43 LLDB                     0x00000001076f8953 swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 163
44 LLDB                     0x0000000107713684 validatePatternBindingEntries(swift::TypeChecker&, swift::PatternBindingDecl*) + 724
45 LLDB                     0x000000010770ccf5 (anonymous namespace)::DeclChecker::visit(swift::Decl*) + 1253
46 LLDB                     0x000000010770c806 swift::TypeChecker::typeCheckDecl(swift::Decl*) + 38
47 LLDB                     0x000000010777aade swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 1502
48 LLDB                     0x0000000107779bd8 bool (anonymous namespace)::StmtChecker::typeCheckStmt<swift::BraceStmt>(swift::BraceStmt*&) + 136
49 LLDB                     0x0000000107779cce swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 174
50 LLDB                     0x000000010779731e swift::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 94
51 LLDB                     0x0000000107110c3a (anonymous namespace)::CodeCompletionCallbacksImpl::doneParsing() + 3482
52 LLDB                     0x00000001078fa21a swift::performDelayedParsing(swift::DeclContext*, swift::PersistentParserState&, swift::CodeCompletionCallbacksFactory*) + 458
53 LLDB                     0x000000010713796e doCodeCompletion(swift::SourceFile&, llvm::StringRef, unsigned int*, swift::CodeCompletionCallbacksFactory*) + 494
54 LLDB                     0x0000000107137510 swift::REPLCompletions::populate(swift::SourceFile&, llvm::StringRef) + 160
55 LLDB                     0x0000000106b75599 lldb_private::SwiftREPL::CompleteCode(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, lldb_private::StringList&) + 569
56 LLDB                     0x00000001069249b9 lldb_private::REPL::IOHandlerComplete(lldb_private::IOHandler&, char const*, char const*, char const*, int, int, lldb_private::StringList&, lldb_private::StringList&) + 489
57 LLDB                     0x0000000106898657 lldb_private::IOHandlerEditline::AutoCompleteCallback(char const*, char const*, char const*, int, int, lldb_private::StringList&, lldb_private::StringList&, void*) + 55
58 LLDB                     0x000000010693b70e lldb_private::Editline::TabCommand(int) + 110
59 LLDB                     0x000000010693da41 lldb_private::Editline::ConfigureEditor(bool)::$_13::__invoke(editline*, int) + 33
60 libedit.3.dylib          0x00007fff6a85b7db el_wgets + 484
61 libedit.3.dylib          0x00007fff6a8668bb el_gets + 37
62 LLDB                     0x000000010693d22e lldb_private::Editline::GetLines(int, lldb_private::StringList&, bool&) + 446
63 LLDB                     0x0000000106899003 lldb_private::IOHandlerEditline::Run() + 115
64 LLDB                     0x00000001068804db lldb_private::Debugger::ExecuteIOHandlers() + 123
65 LLDB                     0x0000000106882f23 lldb_private::Debugger::IOHandlerThread(void*) + 19
66 LLDB                     0x000000010692d7e7 lldb_private::HostNativeThreadBase::ThreadCreateTrampoline(void*) + 103
67 libsystem_pthread.dylib  0x00007fff6cebce65 _pthread_start + 148
68 libsystem_pthread.dylib  0x00007fff6ceb883b thread_start + 15
[1]    8847 abort      swift run --repl

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

No branches or pull requests

2 participants