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-14451] CircularBuffer on top of Collections.Deque crashes all Swift compilers from 5.1 to main (on Linux) #56807

Closed
weissi opened this issue Apr 6, 2021 · 5 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software

Comments

@weissi
Copy link
Member

weissi commented Apr 6, 2021

Previous ID SR-14451
Radar rdar://problem/76268366
Original Reporter @weissi
Type Bug
Status Resolved
Resolution Duplicate
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, Crash
Assignee None
Priority Medium

md5: fd40604fc2d643eba689925e3be8d0ea

blocks:

  • SR-14448 swift-collections compilation failure

Issue Description:

16:20:24 [106/150] Compiling NIO ByteBuffer-int.swift
16:20:24 <unknown>:0: error: fatal error encountered while reading from module 'NIO'; please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project
16:20:24 <unknown>:0: note: module 'NIO' full misc version is '5.4(5.4)/Swift version 5.4-dev (LLVM 7a20f40c45aca5d, Swift 031b848b7092c06)'
16:20:24 
16:20:24 *** DESERIALIZATION FAILURE (please include this section in any bug report) ***
16:20:24 result not found
16:20:24 Cross-reference to module 'NIO'
16:20:24 ... NIODeque
16:20:24 ... in an extension in module 'NIO'
16:20:24 ... Element
16:20:24 
16:20:24 Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project and the crash backtrace.
16:20:24 Stack dump:
16:20:24 0. Program arguments: /usr/bin/swift-frontend -frontend -merge-modules -emit-module /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/AddressedEnvelope~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/BSDSocketAPI~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/BSDSocketAPIPosix~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/BSDSocketAPIWindows~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/BaseSocket~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/BaseSocketChannel~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/BaseStreamSocketChannel~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/Bootstrap~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/ByteBuffer-aux~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/ByteBuffer-conversions~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/ByteBuffer-core~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/ByteBuffer-int~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/ByteBuffer-views~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/Channel~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/ChannelHandler~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/ChannelHandlers~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/ChannelInvoker~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/ChannelOption~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/ChannelPipeline~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/CircularBuffer~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/Codec~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/ControlMessage~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/ConvenienceOptionSupport~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/DatagramVectorReadManager~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/DeadChannel~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/DispatchQueue+WithFuture~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/Embedded~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/EventLoop~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/EventLoopFuture~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/FileDescriptor~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/FileHandle~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/FileRegion~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/GetaddrinfoResolver~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/HappyEyeballs~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/Heap~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/IO~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/IOData~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/IntegerTypes~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/Interfaces~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/Linux~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/LinuxCPUSet~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/MarkedCircularBuffer~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/MulticastChannel~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/NIOAny~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/NIOCloseOnErrorHandler~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/NIOThreadPool~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/NonBlockingFileIO~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/PendingDatagramWritesManager~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/PendingWritesManager~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/PipeChannel~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/PipePair~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/PointerHelpers~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/PriorityQueue~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/RecvByteBufferAllocator~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/Resolver~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/Selectable~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/SelectableEventLoop~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/Selector~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/ServerSocket~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/SingleStepByteToMessageDecoder~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/Socket~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/SocketAddresses~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/SocketChannel~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/SocketOptionProvider~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/SocketProtocols~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/System~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/Thread~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/ThreadPosix~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/ThreadWindows~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/TypeAssistedChannelHandler~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/UniversalBootstrapSupport~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/Utilities~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/VendoredDeque/Deque+Codable~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/VendoredDeque/Deque+CustomDebugStringConvertible~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/VendoredDeque/Deque+CustomReflectable~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/VendoredDeque/Deque+CustomStringConvertible~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/VendoredDeque/Deque+Equatable~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/VendoredDeque/Deque+ExpressibleByArrayLiteral~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/VendoredDeque/Deque+Extras~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/VendoredDeque/Deque+Hashable~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/VendoredDeque/Deque+MutableCollection~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/VendoredDeque/Deque+RandomAccessCollection~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/VendoredDeque/Deque+RangeReplaceableCollection~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/VendoredDeque/Deque+Sequence~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/VendoredDeque/Deque+Testing~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/VendoredDeque/Deque._Storage~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/VendoredDeque/Deque._UnsafeHandle~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/VendoredDeque/Deque~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/VendoredDeque/UnsafeMutableBufferPointer+Utilities~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/VendoredDeque/_DequeBuffer~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/VendoredDeque/_DequeBufferHeader~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/VendoredDeque/_DequeSlot~partial.swiftmodule /code/.build/x86_64-unknown-linux-gnu/debug/NIO.build/VendoredDeque/_UnsafeWrappedBuffer~partial.swiftmodule -parse-as-library -disable-diagnostic-passes -disable-sil-perf-optzns -target x86_64-unknown-linux-gnu -disable-objc-interop -I /code/.build/x86_64-unknown-linux-gnu/debug -enable-testing -g -module-cache-path /code/.build/x86_64-unknown-linux-gnu/debug/ModuleCache -warnings-as-errors -swift-version 5 -Onone -D SWIFT_PACKAGE -D DEBUG -enable-anonymous-context-mangled-names -Xcc -fmodule-map-file=/code/.build/x86_64-unknown-linux-gnu/debug/CNIOAtomics.build/module.modulemap -Xcc -I -Xcc /code/Sources/CNIOAtomics/include -Xcc -fmodule-map-file=/code/Sources/CNIOWindows/include/module.modulemap -Xcc -I -Xcc /code/Sources/CNIOWindows/include -Xcc -fmodule-map-file=/code/.build/x86_64-unknown-linux-gnu/debug/CNIODarwin.build/module.modulemap -Xcc -I -Xcc /code/Sources/CNIODarwin/include -Xcc -fmodule-map-file=/code/.build/x86_64-unknown-linux-gnu/debug/CNIOLinux.build/module.modulemap -Xcc -I -Xcc /code/Sources/CNIOLinux/include -emit-module-doc-path /code/.build/x86_64-unknown-linux-gnu/debug/NIO.swiftdoc -emit-module-source-info-path /code/.build/x86_64-unknown-linux-gnu/debug/NIO.swiftsourceinfo -module-name NIO -o /code/.build/x86_64-unknown-linux-gnu/debug/NIO.swiftmodule 
16:20:24 1. Swift version 5.4-dev (LLVM 7a20f40c45aca5d, Swift 031b848b7092c06)
16:20:24 2. While evaluating request ASTLoweringRequest(Lowering AST to SIL for module NIO)
16:20:24 3. While deserializing SIL function "$s3NIO14CircularBufferVyACyxGSnyAC5IndexVyx_GGcig"
16:20:24 4. While reading from 'NIO'
16:20:24 5. While finishing conformance for protocol conformance to 'Collection' (in module 'Swift') for type 'NIODeque<Element>'
16:20:24 /usr/bin/swift-frontend[0x55f5094]
16:20:24 /usr/bin/swift-frontend[0x55f2c8e]
16:20:24 /usr/bin/swift-frontend[0x55f5275]
16:20:24 /lib/x86_64-linux-gnu/libpthread.so.0(+0x153c0)[0x7fd990c153c0]
16:20:24 /lib/x86_64-linux-gnu/libc.so.6(gsignal+0xcb)[0x7fd9906bd18b]
16:20:24 /lib/x86_64-linux-gnu/libc.so.6(abort+0x12b)[0x7fd99069c859]
16:20:24 /usr/bin/swift-frontend[0x105c359]
16:20:24 /usr/bin/swift-frontend[0x113ad77]
16:20:24 /usr/bin/swift-frontend[0x1158c4c]
16:20:24 /usr/bin/swift-frontend[0x1b69be9]
16:20:24 /usr/bin/swift-frontend[0x1b699d4]
16:20:24 /usr/bin/swift-frontend[0x1b69f63]
16:20:24 /usr/bin/swift-frontend[0x1b69a35]
16:20:24 /usr/bin/swift-frontend[0x1b8dc4f]
16:20:24 /usr/bin/swift-frontend[0x1b99249]
16:20:24 /usr/bin/swift-frontend[0x1b900a0]
16:20:24 /usr/bin/swift-frontend[0x1b8e0a5]
16:20:24 /usr/bin/swift-frontend[0x1b86e5a]
16:20:24 /usr/bin/swift-frontend[0x1224535]
16:20:24 /usr/bin/swift-frontend[0x1217eaa]
16:20:24 /usr/bin/swift-frontend[0x12179e4]
16:20:24 /usr/bin/swift-frontend[0x11af8ca]
16:20:24 /usr/bin/swift-frontend[0x11a6ec0]
16:20:24 /usr/bin/swift-frontend[0x11a6a8d]
16:20:24 /usr/bin/swift-frontend[0x11a68fb]
16:20:24 /usr/bin/swift-frontend[0x1210f23]
16:20:24 /usr/bin/swift-frontend[0x11c93c9]
16:20:24 /usr/bin/swift-frontend[0x1121c88]
16:20:24 /usr/bin/swift-frontend[0x110f9f2]
16:20:24 /usr/bin/swift-frontend[0x1126034]
16:20:24 /usr/bin/swift-frontend[0x10e0d8f]
16:20:24 /usr/bin/swift-frontend[0x10e0d06]
16:20:24 /usr/bin/swift-frontend[0x9b7f9d]
16:20:24 /usr/bin/swift-frontend[0xa7a963]
16:20:24 /usr/bin/swift-frontend[0x9bc35a]
16:20:24 /usr/bin/swift-frontend[0x9b8524]
16:20:24 /usr/bin/swift-frontend[0x51b632]
16:20:24 /usr/bin/swift-frontend[0x50fe6e]
16:20:24 /usr/bin/swift-frontend[0x49cb51]
16:20:24 /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x7fd99069e0b3]
16:20:24 /usr/bin/swift-frontend[0x49c66e]
16:20:24 error: fatalError
16:20:25 Build step 'Execute shell' marked build as failure
16:20:25 $ ssh-agent -k

one line repro from a Mac (using docker)

cd /tmp && rm -rf swift-nio && git clone https://github.com/weissi/swift-nio.git && cd swift-nio && git checkout SR-14451 && docker run -it --rm -v "$PWD:$PWD" -w "$PWD" swift:5.3 swift build
@weissi
Copy link
Member Author

weissi commented Apr 6, 2021

@swift-ci create

@weissi
Copy link
Member Author

weissi commented Apr 6, 2021

CC @lorentey

@typesanitizer
Copy link

@lorentey
Copy link
Member

It looks very similar. Like the Collections case, it seems to be only reproducible on certain machines. (Johannes's repro incantation works just fine on my iMac.)

@lorentey
Copy link
Member

Ah, it's the exact same issue – the SR-14451 branch includes a vendored copy of the original Deque code, so it is subject to the same problem.

@weissi Updating the files to the Deque implementation in the 0.0.2 release will take care of this particular bug instance. (The key change was merging the Sequence implementation into the same file that implements RandomAccessCollection.)

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
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. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software
Projects
None yet
Development

No branches or pull requests

4 participants