-
Notifications
You must be signed in to change notification settings - Fork 202
Closed
Description
Creating instances of Calendar
concurrently on Linux (Static SDK) reliably results in a segmentation fault. It occurs in both debug and release configurations. The same code runs without issue on macOS.
Host: macOS 15.2 (24C101), Xcode 16.2 (16C5032a)
Swift: Apple Swift version 6.0.3 (swift-6.0.3-RELEASE), arm64-apple-macosx15.0
Static Linux SDK: swift-6.0.3-RELEASE_static-linux-0.0.1
Target: Alma Linux 8.10 (x86_64 Static SDK)
FoundationTest.swift
import Foundation
@main
struct App {
static func main() async throws {
await withTaskGroup(of: Void.self) { group in
for _ in 0...1_000_000 {
group.addTask {
_ = Calendar(identifier: .gregorian)
}
}
}
}
}
Package.swift
// swift-tools-version: 6.0
import PackageDescription
let package = Package(
name: "FoundationTest",
platforms: [
.macOS(.v12)
],
targets: [
.executableTarget(name: "FoundationTest")
]
)
Build for Linux
xcrun --toolchain swift swift build --swift-sdk x86_64-swift-linux-musl
Build for macOS
xcrun --toolchain swift swift build
Core Dump (Linux)
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00000000007df69a in swift_isUniquelyReferenced_nonNull_native ()
[Current thread is 1 (LWP 11637)]
(gdb) bt
#0 0x00000000007df69a in swift_isUniquelyReferenced_nonNull_native ()
#1 0x0000000000a6ae14 in $sSD8_VariantV8setValue_6forKeyyq_n_xtFSi_20FoundationEssentials17_TimeZoneProtocol_pTg5Tf4enn_n ()
#2 0x0000000000a66908 in $s20FoundationEssentials13TimeZoneCacheV5StateV011findCurrentcD0AA0cD0VyF ()
#3 0x0000000000a68ead in $s20FoundationEssentials13TimeZoneCacheV7defaultAA0cD0VvgAfC5StateVzYbXEfU_ ()
#4 0x000000000089d50f in $s20FoundationEssentials11LockedStateV8withLockyqd__qd__xzYbKXEKlF ()
#5 0x0000000000a68e79 in $s20FoundationEssentials13TimeZoneCacheV7currentAA0cD0VvgTm ()
#6 0x0000000000a6484d in $s20FoundationEssentials8TimeZoneV7defaultACSgvgZ ()
#7 0x00000000008bab78 in $s20FoundationEssentials18_CalendarGregorianC10identifier8timeZone6locale12firstWeekday22minimumDaysInFirstWeek18gregorianStartDateAcA0C0V10IdentifierO_AA04TimeG0VSgAA6LocaleVSgSiSgAtA0R0VSgtcfcTf4dnnnnnn_n ()
#8 0x00000000008b9b01 in $s20FoundationEssentials18_CalendarGregorianCAA01_C8ProtocolA2aDP10identifier8timeZone6locale12firstWeekday22minimumDaysInFirstWeek18gregorianStartDatexAA0C0V10IdentifierO_AA04TimeH0VSgAA6LocaleVSgSiSgAvA0S0VSgtcfCTW ()
#9 0x000000000089b388 in $s20FoundationEssentials13CalendarCacheV5fixedyAA01_C8Protocol_pAA0C0V10IdentifierOFAaE_pAC5StateVzYbXEfU_TA ()
#10 0x000000000089d50f in $s20FoundationEssentials11LockedStateV8withLockyqd__qd__xzYbKXEKlF ()
#11 0x000000000089a15f in $s20FoundationEssentials13CalendarCacheV5fixedyAA01_C8Protocol_pAA0C0V10IdentifierOF ()
#12 0x0000000000891311 in $s20FoundationEssentials8CalendarV10identifierA2C10IdentifierOh_tcfC ()
#13 0x00000000004103e3 in $s14FoundationTest3AppV4mainyyYaKFZyScGyytGzYaXEfU_yyYacfU_TY0_ ()
#14 0x00000000008612e3 in swift::runJobInEstablishedExecutorContext(swift::Job*) ()
#15 0x0000000000862085 in swift_job_run ()
#16 0x000000000087634c in _dispatch_continuation_pop ()
#17 0x00000000008761b9 in _dispatch_async_redirect_invoke ()
#18 0x000000000087f8c6 in _dispatch_worker_thread ()
#19 0x0000000000b7f0cb in start ()
#20 0x0000000000000000 in ?? ()
LLDB (Linux)
Run 1:
Process 11086 stopped
* thread #4, name = 'FoundationTest', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
frame #0: 0x00000000007df69a FoundationTest`swift_isUniquelyReferenced_nonNull_native [inlined] swift::RefCountBitsT<(swift::RefCountInlinedness)1> std::__1::__cxx_atomic_load[abi:hn170006]<swift::RefCountBitsT<(__a=0x8000000000000008, __order=memory_order_consume)1>>(std::__1::__cxx_atomic_base_impl<swift::RefCountBitsT<(swift::RefCountInlinedness)1>> const*, std::__1::memory_order) at cxx_atomic_impl.h:363:12
thread #7, name = 'FoundationTest', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
frame #0: 0x00000000004543f4 FoundationTest`$ss22__RawDictionaryStorageC4findys10_HashTableV6BucketV6bucket_Sb5foundtxSHRzlFSi_Tg5 at DictionaryStorage.swift:0
Note: this address is compiler-generated code in function $ss22__RawDictionaryStorageC4findys10_HashTableV6BucketV6bucket_Sb5foundtxSHRzlFSi_Tg5 that has no source code associated with it.
thread #10, name = 'FoundationTest', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
frame #0: 0x00000000007df69a FoundationTest`swift_isUniquelyReferenced_nonNull_native [inlined] swift::RefCountBitsT<(swift::RefCountInlinedness)1> std::__1::__cxx_atomic_load[abi:hn170006]<swift::RefCountBitsT<(__a=0x8000000000000008, __order=memory_order_consume)1>>(std::__1::__cxx_atomic_base_impl<swift::RefCountBitsT<(swift::RefCountInlinedness)1>> const*, std::__1::memory_order) at cxx_atomic_impl.h:363:12
Run 2:
Process 11128 stopped
* thread #2, name = 'FoundationTest', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
frame #0: 0x0000000000a669fe FoundationTest`$sSDyq_SgxcigSi_20FoundationEssentials17_TimeZoneProtocol_pTg5 at <compiler-generated>:0
Note: this address is compiler-generated code in function $sSDyq_SgxcigSi_20FoundationEssentials17_TimeZoneProtocol_pTg5 that has no source code associated with it.
thread #4, name = 'FoundationTest', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
frame #0: 0x0000000000a669fe FoundationTest`$sSDyq_SgxcigSi_20FoundationEssentials17_TimeZoneProtocol_pTg5 at <compiler-generated>:0
Note: this address is compiler-generated code in function $sSDyq_SgxcigSi_20FoundationEssentials17_TimeZoneProtocol_pTg5 that has no source code associated with it.
thread #5, name = 'FoundationTest', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
frame #0: 0x0000000000a669fe FoundationTest`$sSDyq_SgxcigSi_20FoundationEssentials17_TimeZoneProtocol_pTg5 at <compiler-generated>:0
Note: this address is compiler-generated code in function $sSDyq_SgxcigSi_20FoundationEssentials17_TimeZoneProtocol_pTg5 that has no source code associated with it.
thread #6, name = 'FoundationTest', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
frame #0: 0x00000000007df69a FoundationTest`swift_isUniquelyReferenced_nonNull_native [inlined] swift::RefCountBitsT<(swift::RefCountInlinedness)1> std::__1::__cxx_atomic_load[abi:hn170006]<swift::RefCountBitsT<(__a=0x8000000000000008, __order=memory_order_consume)1>>(std::__1::__cxx_atomic_base_impl<swift::RefCountBitsT<(swift::RefCountInlinedness)1>> const*, std::__1::memory_order) at cxx_atomic_impl.h:363:12
thread #7, name = 'FoundationTest', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
frame #0: 0x00000000007df69a FoundationTest`swift_isUniquelyReferenced_nonNull_native [inlined] swift::RefCountBitsT<(swift::RefCountInlinedness)1> std::__1::__cxx_atomic_load[abi:hn170006]<swift::RefCountBitsT<(__a=0x8000000000000008, __order=memory_order_consume)1>>(std::__1::__cxx_atomic_base_impl<swift::RefCountBitsT<(swift::RefCountInlinedness)1>> const*, std::__1::memory_order) at cxx_atomic_impl.h:363:12
thread #9, name = 'FoundationTest', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
frame #0: 0x00000000007df69a FoundationTest`swift_isUniquelyReferenced_nonNull_native [inlined] swift::RefCountBitsT<(swift::RefCountInlinedness)1> std::__1::__cxx_atomic_load[abi:hn170006]<swift::RefCountBitsT<(__a=0x8000000000000008, __order=memory_order_consume)1>>(std::__1::__cxx_atomic_base_impl<swift::RefCountBitsT<(swift::RefCountInlinedness)1>> const*, std::__1::memory_order) at cxx_atomic_impl.h:363:12
thread #10, name = 'FoundationTest', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
frame #0: 0x0000000000a669fe FoundationTest`$sSDyq_SgxcigSi_20FoundationEssentials17_TimeZoneProtocol_pTg5 at <compiler-generated>:0
Note: this address is compiler-generated code in function $sSDyq_SgxcigSi_20FoundationEssentials17_TimeZoneProtocol_pTg5 that has no source code associated with it.
Metadata
Metadata
Assignees
Labels
No labels