swiftlang / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. This fork is used to manage Swift’s stable releases of Clang as well as support the Swift project.
https://llvm.org
Other
1.12k stars 330 forks source link

[SR-14338] lldb crash: /home/build-user/llvm-project/clang/lib/AST/ASTImporter.cpp:2738: clang::ExpectedDecl clang::ASTNodeImporter::VisitRecordDecl(clang::RecordDecl *): Assertion `FoundCXX && "Record type mismatch"' failed #4319

Open hassila opened 3 years ago

hassila commented 3 years ago
Previous ID SR-14338
Radar rdar://problem/75327826
Original Reporter @hassila
Type Bug
Environment jocke@swift511 \~/s/swiftnio511 (jh-liburing-refactor-selector) \[SIGILL\]\> uname -a Linux swift511 5.11.0-051100-generic \#202102142330 SMP Sun Feb 14 23:33:21 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux jocke@swift511 \~/s/swiftnio511 (jh-liburing-refactor-selector)\> swift --version Swift version 5.3.3 (swift-5.3.3-RELEASE) Target: x86_64-unknown-linux-gnu jocke@swift511 \~/s/swiftnio511 (jh-liburing-refactor-selector)\>
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 0 | |Component/s | LLDB for Swift | |Labels | Bug, LLDBCrash | |Assignee | None | |Priority | Medium | md5: f90b5fbd68ebd9e5b087e76b0a14b24d

Issue Description:

lldb-swift aborted when doing "po xxx"

Will attach link to reproducer.

io_uring_prep_poll_add bitPattern[201d00000004] bit[35308926140420] poll_mask[8221] fd[4] sqe[Optional(0x00007ffff4bd8a00)] bitpatternAsPointer[Optional(0x0000201d00000004)]

NIOEchoClient was compiled with optimization - stepping may behave oddly; variables may not be available.

Process 18064 stopped

* thread #​2, name = 'NIO-ELT-0-#0', stop reason = Swift runtime failure: precondition failure

    frame #​1: 0x000055555563c6f2 NIOEchoClient`specialized static Posix.close(descriptor:) [inlined] Swift.String.init(_builtinStringLiteral: Builtin.RawPointer, utf8CodeUnitCount: Builtin.Word, isASCII: Builtin.Int1) -> Swift.String at System.swift:142 [opt]

   139  

   140 private func preconditionIsNotUnacceptableErrno(err: CInt, where function: String) -> Void {

   141     // strerror is documented to return "Unknown error: ..." for illegal value so it won't ever fail

-> 142     precondition(!isUnacceptableErrno(err), "unacceptable errno \(err) \(String(cString: strerror(err)!)) in \(function))")

   143 }

   144  

   145 /*

Target 0: (NIOEchoClient) stopped.

(lldb) po err

lldb: /home/build-user/llvm-project/clang/lib/AST/ASTImporter.cpp:2738: clang::ExpectedDecl clang::ASTNodeImporter::VisitRecordDecl(clang::RecordDecl *): Assertion `FoundCXX && "Record type mismatch"' failed.

Stack dump:

0. Program arguments: lldb .build/x86_64-unknown-linux-gnu/release/NIOEchoClient 

lldb[0x420814]

lldb[0x41e99e]

lldb[0x420d95]

/lib/x86_64-linux-gnu/libpthread.so.0(+0x153c0)[0x7fc3ef6b83c0]

/lib/x86_64-linux-gnu/libc.so.6(gsignal+0xcb)[0x7fc3e52ea18b]

/lib/x86_64-linux-gnu/libc.so.6(abort+0x12b)[0x7fc3e52c9859]

/lib/x86_64-linux-gnu/libc.so.6(+0x25729)[0x7fc3e52c9729]

/lib/x86_64-linux-gnu/libc.so.6(+0x36f36)[0x7fc3e52daf36]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x4e9451d)[0x7fc3ebc5851d]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x4ec32ba)[0x7fc3ebc872ba]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x4ec3227)[0x7fc3ebc87227]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x4ec4795)[0x7fc3ebc88795]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x4e89223)[0x7fc3ebc4d223]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x4e89145)[0x7fc3ebc4d145]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x4ec3f5e)[0x7fc3ebc87f5e]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x4ec39e0)[0x7fc3ebc879e0]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x4ecbfa6)[0x7fc3ebc8ffa6]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x4e99856)[0x7fc3ebc5d856]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x4e9929f)[0x7fc3ebc5d29f]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x4ec32f3)[0x7fc3ebc872f3]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x4ec3227)[0x7fc3ebc87227]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x4ec4795)[0x7fc3ebc88795]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x4e84e03)[0x7fc3ebc48e03]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x4e8ced5)[0x7fc3ebc50ed5]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x4e8c688)[0x7fc3ebc50688]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x4e935b1)[0x7fc3ebc575b1]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x4ec32ba)[0x7fc3ebc872ba]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x4ec3227)[0x7fc3ebc87227]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x4ec4795)[0x7fc3ebc88795]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x4e89223)[0x7fc3ebc4d223]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x4e89145)[0x7fc3ebc4d145]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x4ec3f5e)[0x7fc3ebc87f5e]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x4ec39e0)[0x7fc3ebc879e0]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x4ecbfa6)[0x7fc3ebc8ffa6]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x4e9123f)[0x7fc3ebc5523f]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x4e908c1)[0x7fc3ebc548c1]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x4ec3436)[0x7fc3ebc87436]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x4ec3227)[0x7fc3ebc87227]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x4ec4795)[0x7fc3ebc88795]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x4e886b3)[0x7fc3ebc4c6b3]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x4e8854b)[0x7fc3ebc4c54b]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x4ec3d97)[0x7fc3ebc87d97]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x4ec39e0)[0x7fc3ebc879e0]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0xe208d8)[0x7fc3e7be48d8]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0xe204df)[0x7fc3e7be44df]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x229891c)[0x7fc3e905c91c]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x228a419)[0x7fc3e904e419]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x240a693)[0x7fc3e91ce693]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x2407d37)[0x7fc3e91cbd37]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x2408119)[0x7fc3e91cc119]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x1495e91)[0x7fc3e8259e91]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x1493f04)[0x7fc3e8257f04]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x1493e4d)[0x7fc3e8257e4d]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x1493e4d)[0x7fc3e8257e4d]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x1496280)[0x7fc3e825a280]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x1495214)[0x7fc3e8259214]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x24075dd)[0x7fc3e91cb5dd]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0xe043e5)[0x7fc3e7bc83e5]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0xdee7b6)[0x7fc3e7bb27b6]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0xe03de1)[0x7fc3e7bc7de1]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0xe05551)[0x7fc3e7bc9551]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0xfe0046)[0x7fc3e7da4046]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0xfdabbb)[0x7fc3e7d9ebbb]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0xfd86b8)[0x7fc3e7d9c6b8]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0xd78717)[0x7fc3e7b3c717]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0xef6be5)[0x7fc3e7cbabe5]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x13fb045)[0x7fc3e81bf045]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0x13fc08c)[0x7fc3e81c008c]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0xdb5e63)[0x7fc3e7b79e63]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0xdad177)[0x7fc3e7b71177]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0xdb06e3)[0x7fc3e7b746e3]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0xcfef46)[0x7fc3e7ac2f46]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0xce40af)[0x7fc3e7aa80af]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(+0xdb12f6)[0x7fc3e7b752f6]

/home/jocke/swift/swift-5.3.3-RELEASE-ubuntu20.04/usr/bin/../lib/liblldb.so.10git(_ZN4lldb10SBDebugger21RunCommandInterpreterEbb+0xe9)[0x7fc3e77f0869]

lldb[0x40ab04]

lldb[0x40c2d3]

/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x7fc3e52cb0b3]

lldb[0x4073ae]

********************

Crash reproducer for lldb version 10.0.0 (git@github.com:apple/llvm-project.git revision 3093af41dd65ad466dcd5603e9289244edfee4f5)

Swift version 5.3.3 (swift-5.3.3-RELEASE)

Reproducer written to '/tmp/reproducer-20f77f'

Before attaching the reproducer to a bug report:

 - Look at the directory to ensure you're willing to share its content.

 - Make sure the reproducer works by replaying the reproducer.

Replay the reproducer with the following command:

lldb -replay /tmp/reproducer-20f77f

********************

fish: Job 1, 'lldb .build/x86_64-unknown-linu?' terminated by signal SIGABRT (Abort)
hassila commented 3 years ago

Linked reproducer.

weissi commented 3 years ago

@swift-ci create

weissi commented 3 years ago

@swift-ci create

kastiglione commented 3 years ago

Thanks for the report. Do either of `p err` or `v err` work?

hassila commented 3 years ago

Good question, I unfortunately don't have the code in the exact state to trigger that specific bug anymore (I fixed the issue with gdb/swift demangle...) but will see if I can make it happen again. I basically run into tons of asserts currently (read: every single time I run lddb currently) with both 5.3.3 and 5.4 dev snapshot on Linux, I'd be happy to capture additional information (or providing you with source snapshot/branch that reproduces - I'm just working on SwiftNIO so it can be freely shared, but a few prerequisites on the runtime environment (Ubuntu 20.04, updated kernel to 5.11 and liburing installed) - let me know if that is something you want to pursue and I will simply branch/tag the WIP if you want a full reproducible environment.