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

Swift 5.10 crashing when -cross-module-optimization is enabled #73487

Open
mman opened this issue May 7, 2024 · 0 comments
Open

Swift 5.10 crashing when -cross-module-optimization is enabled #73487

mman opened this issue May 7, 2024 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software triage needed This issue needs more specific labels

Comments

@mman
Copy link

mman commented May 7, 2024

Description

I have a fairly minimal package with couple dependencies including NIO and SwiftPrometheus. Compiling via official Docker image against swift 5.9 worked nicely, crashes with 5.10 when -cross-module-optimization is enabled.

Reproduction

Stack dump

...
#27 202.7 [990/993] Compiling NIOHPACK DynamicHeaderTable.swift
#27 202.8 [991/993] Compiling NIOExtras DebugInboundEventsHandler.swift
#27 204.1 error: compile command failed due to signal 4 (use -v to see invocation)
#27 204.1 Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
#27 204.1 Stack dump:
#27 204.1 0.	Program arguments: /usr/bin/swift-frontend -frontend -c /root/relay-swift/.build/checkouts/websocket-kit/Sources/WebSocketKit/Concurrency/WebSocket+Concurrency.swift /root/relay-swift/.build/checkouts/websocket-kit/Sources/WebSocketKit/Exports.swift /root/relay-swift/.build/checkouts/websocket-kit/Sources/WebSocketKit/HTTPUpgradeRequestHandler.swift /root/relay-swift/.build/checkouts/websocket-kit/Sources/WebSocketKit/WebSocket+Connect.swift /root/relay-swift/.build/checkouts/websocket-kit/Sources/WebSocketKit/WebSocket.swift /root/relay-swift/.build/checkouts/websocket-kit/Sources/WebSocketKit/WebSocketClient.swift /root/relay-swift/.build/checkouts/websocket-kit/Sources/WebSocketKit/WebSocketHandler.swift -supplementary-output-file-map /tmp/TemporaryDirectory.qEEO0r/supplementaryOutputs-1 -target x86_64-unknown-linux-gnu -disable-objc-interop -I /root/relay-swift/.build/x86_64-unknown-linux-gnu/release -g -module-cache-path /root/relay-swift/.build/x86_64-unknown-linux-gnu/release/ModuleCache -suppress-warnings -swift-version 5 -O -D SWIFT_PACKAGE -new-driver-path /usr/bin/swift-driver -empty-abi-descriptor -resource-dir /usr/lib/swift -Xcc -fmodule-map-file=/root/relay-swift/.build/x86_64-unknown-linux-gnu/release/CNIOSHA1.build/module.modulemap -Xcc -I -Xcc /root/relay-swift/.build/checkouts/swift-nio/Sources/CNIOSHA1/include -Xcc -fmodule-map-file=/root/relay-swift/.build/x86_64-unknown-linux-gnu/release/CNIOBoringSSLShims.build/module.modulemap -Xcc -I -Xcc /root/relay-swift/.build/checkouts/swift-nio-ssl/Sources/CNIOBoringSSLShims/include -Xcc -fmodule-map-file=/root/relay-swift/.build/x86_64-unknown-linux-gnu/release/CNIOBoringSSL.build/module.modulemap -Xcc -I -Xcc /root/relay-swift/.build/checkouts/swift-nio-ssl/Sources/CNIOBoringSSL/include -Xcc -fmodule-map-file=/root/relay-swift/.build/x86_64-unknown-linux-gnu/release/CNIOLLHTTP.build/module.modulemap -Xcc -I -Xcc /root/relay-swift/.build/checkouts/swift-nio/Sources/CNIOLLHTTP/include -Xcc -fmodule-map-file=/root/relay-swift/.build/checkouts/swift-atomics/Sources/_AtomicsShims/include/module.modulemap -Xcc -I -Xcc /root/relay-swift/.build/checkouts/swift-atomics/Sources/_AtomicsShims/include -Xcc -fmodule-map-file=/root/relay-swift/.build/checkouts/swift-nio/Sources/CNIOWindows/include/module.modulemap -Xcc -I -Xcc /root/relay-swift/.build/checkouts/swift-nio/Sources/CNIOWindows/include -Xcc -fmodule-map-file=/root/relay-swift/.build/x86_64-unknown-linux-gnu/release/CNIOLinux.build/module.modulemap -Xcc -I -Xcc /root/relay-swift/.build/checkouts/swift-nio/Sources/CNIOLinux/include -Xcc -fmodule-map-file=/root/relay-swift/.build/x86_64-unknown-linux-gnu/release/CNIODarwin.build/module.modulemap -Xcc -I -Xcc /root/relay-swift/.build/checkouts/swift-nio/Sources/CNIODarwin/include -Xcc -fmodule-map-file=/root/relay-swift/.build/x86_64-unknown-linux-gnu/release/CNIOAtomics.build/module.modulemap -Xcc -I -Xcc /root/relay-swift/.build/checkouts/swift-nio/Sources/CNIOAtomics/include -Xcc -fPIC -Xcc -g -Xcc -fno-omit-frame-pointer -module-name WebSocketKit -plugin-path /usr/lib/swift/host/plugins -plugin-path /usr/local/lib/swift/host/plugins -parse-as-library -num-threads 8 -o /root/relay-swift/.build/x86_64-unknown-linux-gnu/release/WebSocketKit.build/WebSocket+Concurrency.swift.o -o /root/relay-swift/.build/x86_64-unknown-linux-gnu/release/WebSocketKit.build/Exports.swift.o -o /root/relay-swift/.build/x86_64-unknown-linux-gnu/release/WebSocketKit.build/HTTPUpgradeRequestHandler.swift.o -o /root/relay-swift/.build/x86_64-unknown-linux-gnu/release/WebSocketKit.build/WebSocket+Connect.swift.o -o /root/relay-swift/.build/x86_64-unknown-linux-gnu/release/WebSocketKit.build/WebSocket.swift.o -o /root/relay-swift/.build/x86_64-unknown-linux-gnu/release/WebSocketKit.build/WebSocketClient.swift.o -o /root/relay-swift/.build/x86_64-unknown-linux-gnu/release/WebSocketKit.build/WebSocketHandler.swift.o -cross-module-optimization
#27 204.1 1.	Swift version 5.10 (swift-5.10-RELEASE)
#27 204.1 2.	Compiling with the current language version
#27 204.1 3.	While evaluating request ExecuteSILPipelineRequest(Run pipelines { Mandatory Diagnostic Passes + Enabling Optimization Passes } on SIL for WebSocketKit)
#27 204.1 4.	While running pass #9568 SILModuleTransform "MandatoryPerformanceOptimizations".
#27 204.1 Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
#27 204.1 /usr/bin/swift-frontend(+0x61b7623)[0x55555b70b623]
#27 204.1 /usr/bin/swift-frontend(+0x61b55de)[0x55555b7095de]
#27 204.1 /usr/bin/swift-frontend(+0x61b799a)[0x55555b70b99a]
#27 204.1 /lib/x86_64-linux-gnu/libc.so.6(+0x42520)[0x7ffffdce0520]
#27 204.1 /usr/bin/swift-frontend(+0xb6c91c)[0x5555560c091c]
#27 204.1 /usr/bin/swift-frontend(+0x1394496)[0x5555568e8496]
#27 204.1 /usr/bin/swift-frontend(+0x139580a)[0x5555568e980a]
#27 204.1 /usr/bin/swift-frontend(+0x1391628)[0x5555568e5628]
#27 204.1 /usr/bin/swift-frontend(+0x13915db)[0x5555568e55db]
#27 204.1 /usr/bin/swift-frontend(+0x13c856a)[0x55555691c56a]
#27 204.1 /usr/bin/swift-frontend(+0x13a8170)[0x5555568fc170]
#27 204.1 /usr/bin/swift-frontend(+0x1391742)[0x5555568e5742]
#27 204.1 /usr/bin/swift-frontend(+0x13a8fd1)[0x5555568fcfd1]
#27 204.1 /usr/bin/swift-frontend(+0xe89ed7)[0x5555563dded7]
#27 204.1 /usr/bin/swift-frontend(+0xc5ef11)[0x5555561b2f11]
#27 204.1 /usr/bin/swift-frontend(+0xc5e18b)[0x5555561b218b]
#27 204.1 /usr/bin/swift-frontend(+0xc614b9)[0x5555561b54b9]
#27 204.1 /usr/bin/swift-frontend(+0xc5ff7d)[0x5555561b3f7d]
#27 204.1 /usr/bin/swift-frontend(+0xaf92c0)[0x55555604d2c0]
#27 204.1 /lib/x86_64-linux-gnu/libc.so.6(+0x29d90)[0x7ffffdcc7d90]
#27 204.1 /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80)[0x7ffffdcc7e40]
#27 204.1 /usr/bin/swift-frontend(+0xaf83f5)[0x55555604c3f5]
#27 204.1 
#27 204.1 *** Signal 4: Backtracing from 0x5555560c091c... done ***
#27 204.1 
#27 204.1 *** Program crashed: Illegal instruction at 0x00005555560c091c ***
#27 204.1 
#27 204.1 Thread 0 "swift-frontend" crashed:
#27 204.1 
#27 204.1 0  0x00005555560c091c closure #1 in variable initialization expression of mandatoryPerformanceOptimizations + 3164 in swift-frontend
#27 204.1 
#27 204.1 
#27 204.1 Registers:
#27 204.1 
#27 204.1 rax 0x0000000000000000  0
#27 204.1 rdx 0x000055555e3a1e70  70 b4 1c 5f 55 55 00 00 88 53 b2 5f 55 55 00 00  p´·_UU···S²_UU··
#27 204.1 rcx 0x0000555560241af8  f8 1a 24 60 55 55 00 00 f8 1a 24 60 55 55 00 00  ø·$`UU··ø·$`UU··
#27 204.1 rbx 0x00000003ffffffff  17179869183
#27 204.1 rsi 0x0000555560241a80  ff ff ff ff 03 00 00 00 f0 92 ac 5f 55 55 00 00  ÿÿÿÿ····ð·¬_UU··
#27 204.1 rdi 0x00000003ffffffff  17179869183
#27 204.1 rbp 0x0000555560241e80  b0 54 18 5e 55 55 00 00 ff ff ff ff 03 00 00 00  °T·^UU··ÿÿÿÿ····
#27 204.1 rsp 0x00007ffffffbd680  ed 3a 99 5c 55 55 00 00 57 2d 80 68 66 4d cd 17  í:·\UU··W-·hfMÍ·
#27 204.1  r8 0x000000000000000f  15
#27 204.1  r9 0x165667b19e3779f9  1609587929392839161
#27 204.1 r10 0x000055555c993b10  00 50 65 72 66 6f 72 6d 73 20 6f 70 74 69 6d 69  ·Performs optimi
#27 204.1 r11 0xc2b2ae3d27d4eb4f  14029467366897019727
#27 204.1 r12 0x0000555560241a78  b0 54 18 5e 55 55 00 00 ff ff ff ff 03 00 00 00  °T·^UU··ÿÿÿÿ····
#27 204.1 r13 0x0000555560241a78  b0 54 18 5e 55 55 00 00 ff ff ff ff 03 00 00 00  °T·^UU··ÿÿÿÿ····
#27 204.1 r14 0x00007ffffffbd688  57 2d 80 68 66 4d cd 17 d8 d1 1e 5e 55 55 00 00  W-·hfMÍ·ØÑ·^UU··
#27 204.1 r15 0x0000555560241e80  b0 54 18 5e 55 55 00 00 ff ff ff ff 03 00 00 00  °T·^UU··ÿÿÿÿ····
#27 204.1 rip 0x00005555560c091c  0f 0b 48 8d 3d d3 61 8d 06 4c 8d 0d c4 87 ca 06  ··H·=Óa··L··Ä·Ê·
#27 204.1 
#27 204.1 rflags 0x0000000000000246  ZF PF
#27 204.1 
#27 204.1 cs 0x0033  fs 0x0000  gs 0x0000
#27 204.1 
#27 204.1 
#27 204.1 Images (35 omitted):
#27 204.1 
#27 204.1 0x0000555555554000–0x000055555c2cde58 <no build ID> swift-frontend /usr/bin/swift-frontend
#27 204.1 
#27 204.1 Backtrace took 0.14s
#27 204.1 
#27 ERROR: process "/bin/sh -c swift build --configuration release -Xswiftc -g -Xswiftc -cross-module-optimization" did not complete successfully: exit code: 1
------
 > [builder 15/15] RUN --mount=type=ssh swift build --configuration release -Xswiftc -g -Xswiftc -cross-module-optimization:
204.1 
204.1 cs 0x0033  fs 0x0000  gs 0x0000
204.1 
204.1 
204.1 Images (35 omitted):
204.1 
204.1 0x0000555555554000–0x000055555c2cde58 <no build ID> swift-frontend /usr/bin/swift-frontend
204.1 
204.1 Backtrace took 0.14s
204.1 
------
ERROR: failed to solve: process "/bin/sh -c swift build --configuration release -Xswiftc -g -Xswiftc -cross-module-optimization" did not complete successfully: exit code: 1

Expected behavior

Compiling and working nicely under 5.9, should continue working on 5.10

Environment

Swift version 5.10 (swift-5.10-RELEASE)
Target: aarch64-unknown-linux-gnu

Additional information

Feel free to ask for more details if the stack does not include what is needed...

@mman mman added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software triage needed This issue needs more specific labels labels May 7, 2024
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. crash Bug: A crash, i.e., an abnormal termination of software triage needed This issue needs more specific labels
Projects
None yet
Development

No branches or pull requests

1 participant