App crash when archive by Xcode 14.3.1, but Xcode 14.2 not

I attached the crash log below. Does anyone have any ideas? Cheers.

Thread 23 shows a third-party crash reporter in play. If you remove that, do you still see the crash?

ps I think you will, but I want to be sure because this crash is otherwise hard to explain.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Thank you for your reply

I still see the same crash when removed kscrash lib

In class 'QJNBasicCollectionCellData', property 'cellModel' declare below

@OpenCombine.Published open var cellModel: T

I use third-part lib 'OpenCombine', I'm not sure if this is related.

I use third-part lib 'OpenCombine', I'm not sure if this is related.

It’s hard to say, but I’m not against all third-party libraries, just those that mess with the crash reporter (-:

I still see the same crash when removed kscrash lib

Not a surprise. Please post a fresh crash report.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

An error occured while uploading Crash log. I send it to your email

I try to replace '@OpenCombine.Published' with 'Combine.Published', Crash not happen

The crash report you sent me has a similar crashing thread backtrace:

Thread 6 name:
Thread 6 Crashed:
0  libswiftCore.dylib         … swift::TargetMetadata<swift::InProcess>::isCanonicalStaticallySpecializedGeneri…
1  libswiftCore.dylib         … swift_checkMetadataState + 44 (Metadata.cpp:5459)
2  libswiftCore.dylib         … swift_getTypeByMangledNodeImpl(swift::MetadataRequest, swift::Demangle::__runti…
3  libswiftCore.dylib         … swift::swift_getTypeByMangledNode(swift::MetadataRequest, swift::Demangle::__ru…
4  libswiftCore.dylib         … swift_getTypeByMangledNameImpl(swift::MetadataRequest, __swift::__runtime::llvm…
5  libswiftCore.dylib         … swift::swift_getTypeByMangledName(swift::MetadataRequest, __swift::__runtime::l…
6  libswiftCore.dylib         … swift::_checkGenericRequirements(__swift::__runtime::llvm::ArrayRef<swift::Targ…
7  libswiftCore.dylib         … _gatherGenericParameters(swift::TargetContextDescriptor<swift::InProcess> const…
8  libswiftCore.dylib         … (anonymous namespace)::DecodedMetadataBuilder::createBoundGenericType(swift::Ta…
9  libswiftCore.dylib         … swift::Demangle::__runtime::TypeDecoder<(anonymous namespace)::DecodedMetadataB…
10 libswiftCore.dylib         … swift_getTypeByMangledNodeImpl(swift::MetadataRequest, swift::Demangle::__runti…
11 libswiftCore.dylib         … swift::swift_getTypeByMangledNode(swift::MetadataRequest, swift::Demangle::__ru…
12 libswiftCore.dylib         … swift_getTypeByMangledNameImpl(swift::MetadataRequest, __swift::__runtime::llvm…
13 libswiftCore.dylib         … swift::swift_getTypeByMangledName(swift::MetadataRequest, __swift::__runtime::l…
14 libswiftCore.dylib         … swift_getTypeByMangledNameInEnvironment + 164 (MetadataLookup.cpp:1785)
15 libswiftCore.dylib         … _resolveKeyPathGenericArgReference(_:genericEnvironment:arguments:) + 224 (KeyP…
16 libswiftCore.dylib         … specialized _walkKeyPathPattern<A>(_:walker:) + 156 (KeyPath.swift:2654)
17 libswiftCore.dylib         … _getKeyPathClassAndInstanceSizeFromPattern(_:_:) + 52 (KeyPath.swift:3189)
18 libswiftCore.dylib         … _swift_getKeyPath(pattern:arguments:) + 136 (KeyPath.swift:2489)
19 XYMainApp                  … QJNBasicCellData.cellModel.modify + 136 (<compiler-generated>:0)
20 XYMainApp                  … JobIntentionEditViewModel.handleIntentionData(_:) + 108 (JobIntentionEditViewMo…
21 XYMainApp                  … closure #1 in JobIntentionEditViewModel.requestData() + 472 (JobIntentionEditVi…
22 XYMainApp                  … partial apply for closure #1 in JobIntentionEditViewModel.requestData() + 1 (<c…
23 XYMainApp                  … specialized thunk for @escaping @callee_guaranteed @Sendable @async () -> (@out…
24 XYMainApp                  … partial apply for specialized thunk for @escaping @callee_guaranteed @Sendable …
25 libswift_Concurrency.dylib … completeTaskWithClosure(swift::AsyncContext*, swift::SwiftError*) + 1 (Task.cpp…

However, there’s one key different, the thread number. This is thread 6, that is, not the main thread. Which brings me to the question as to what’s going on in frames 20 through 18. You seem to be modifying your view model from a secondary thread. Are you sure that’s safe?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Thanks for Your reply

I'm sure it safe

It also crashed on main thread

Thread 0 name:
Thread 0 Crashed:
0   libswiftCore.dylib            	0x00000001e5c7b24c swift::TargetMetadata<swift::InProcess>::isCanonicalStaticallySpecializedGenericMetadata() const + 228 (Metadata.h:1450)
1   libswiftCore.dylib            	0x00000001e5c867b8 swift::MetadataResponse performOnMetadataCache<swift::MetadataResponse, swift_checkMetadataState::CheckStateCallbacks>(swift::TargetMetadata<swift::InProcess> const*, swift_checkMetadataState::Chec... + 36 (Metadata.cpp:5493)
2   libswiftCore.dylib            	0x00000001e5c86788 swift_checkMetadataState + 36 (Metadata.cpp:5578)
3   libswiftCore.dylib            	0x00000001e5c9ba20 swift_getTypeByMangledNodeImpl(swift::MetadataRequest, swift::Demangle::__runtime::Demangler&, swift::Demangle::__runtime::Node*, void const* const*, std::__1::function<swift::TargetMetadata<swift:... + 920 (MetadataLookup.cpp:1745)
4   libswiftCore.dylib            	0x00000001e5c9b5dc swift_getTypeByMangledNode + 832 (CompatibilityOverrideRuntime.def:149)
5   libswiftCore.dylib            	0x00000001e5c9bff8 swift_getTypeByMangledNameImpl(swift::MetadataRequest, __swift::__runtime::llvm::StringRef, void const* const*, std::__1::function<swift::TargetMetadata<swift::InProcess> const* (unsigned int, unsi... + 1156 (MetadataLookup.cpp:1801)
6   libswiftCore.dylib            	0x00000001e5c989a8 swift_getTypeByMangledName + 832 (CompatibilityOverrideRuntime.def:157)
7   libswiftCore.dylib            	0x00000001e5ca7f70 swift::_checkGenericRequirements(__swift::__runtime::llvm::ArrayRef<swift::TargetGenericRequirementDescriptor<swift::InProcess> >, __swift::__runtime::llvm::SmallVectorImpl<void const*>&, std::__1:... + 404 (ProtocolConformance.cpp:1158)
8   libswiftCore.dylib            	0x00000001e5ca3d44 _gatherGenericParameters(swift::TargetContextDescriptor<swift::InProcess> const*, __swift::__runtime::llvm::ArrayRef<swift::TargetMetadata<swift::InProcess> const*>, swift::TargetMetadata<swift::In... + 920 (MetadataLookup.cpp:1160)
9   libswiftCore.dylib            	0x00000001e5ca2bc4 (anonymous namespace)::DecodedMetadataBuilder::createBoundGenericType(swift::TargetContextDescriptor<swift::InProcess> const*, __swift::__runtime::llvm::ArrayRef<swift::TargetMetadata<swift::InProc... + 124 (MetadataLookup.cpp:1442)
10  libswiftCore.dylib            	0x00000001e5ca1454 swift::Demangle::__runtime::TypeDecoder<(anonymous namespace)::DecodedMetadataBuilder>::decodeMangledType(swift::Demangle::__runtime::Node*, unsigned int, bool) + 19432 (TypeDecoder.h:578)
11  libswiftCore.dylib            	0x00000001e5c9b9e0 swift_getTypeByMangledNodeImpl(swift::MetadataRequest, swift::Demangle::__runtime::Demangler&, swift::Demangle::__runtime::Node*, void const* const*, std::__1::function<swift::TargetMetadata<swift:... + 856 (TypeDecoder.h:477)
12  libswiftCore.dylib            	0x00000001e5c9b5dc swift_getTypeByMangledNode + 832 (CompatibilityOverrideRuntime.def:149)
13  libswiftCore.dylib            	0x00000001e5c9bff8 swift_getTypeByMangledNameImpl(swift::MetadataRequest, __swift::__runtime::llvm::StringRef, void const* const*, std::__1::function<swift::TargetMetadata<swift::InProcess> const* (unsigned int, unsi... + 1156 (MetadataLookup.cpp:1801)
14  libswiftCore.dylib            	0x00000001e5c989a8 swift_getTypeByMangledName + 832 (CompatibilityOverrideRuntime.def:157)
15  libswiftCore.dylib            	0x00000001e5c98548 swift_getTypeByMangledNameInEnvironment + 164 (MetadataLookup.cpp:1815)
16  libswiftCore.dylib            	0x00000001e5a400dc _resolveKeyPathGenericArgReference(_:genericEnvironment:arguments:) + 248 (KeyPath.swift:2583)
17  libswiftCore.dylib            	0x00000001e5a405d0 specialized _walkKeyPathPattern<A>(_:walker:) + 156 (KeyPath.swift:2654)
18  libswiftCore.dylib            	0x00000001e5a3fc28 _getKeyPathClassAndInstanceSizeFromPattern(_:_:) + 52 (KeyPath.swift:3189)
19  libswiftCore.dylib            	0x00000001e5a3f9e4 _swift_getKeyPath(pattern:arguments:) + 140 (KeyPath.swift:2489)
20  XYMainApp                     	0x0000000100c6b230 QJNBasicCellData.cellModel.modify + 136 (<compiler-generated>:0)
21  XYMainApp                     	0x0000000100e3a71c EditInformationViewModel.updateAvtar(with:) + 8 (EditInformationViewModel.swift:119)
22  XYMainApp                     	0x0000000100e3a71c closure #1 in EditInformationViewController.imagePickerPhotos(_:sourceAssets:) + 204 (EditInformationViewController.swift:164)
23  XYMainApp                     	0x0000000100e3c210 closure #1 in static EditInformationViewModel.uploadAvtar(_:completion:) + 792 (EditInformationViewModel.swift:0)
24  XYMainApp                     	0x0000000100e3cfb8 specialized closure #1 in static BBSApi.upload_avatar<A>(image:completionHandler:) + 24 (BBSApi+User.swift:146)
25  XYMainApp                     	0x0000000100e3cfb8 partial apply for specialized closure #1 in static BBSApi.upload_avatar<A>(image:completionHandler:) + 48 (<compiler-generated>:0)
26  XYMainApp                     	0x00000001005bca08 partial apply for closure #2 in closure #2 in closure #3 in closure #1 in DownloadRequest._response<A>(queue:responseSerializer:completionHandler:) + 136
27  XYMainApp                     	0x00000001004f8d68 thunk for @escaping @callee_guaranteed () -> () + 28 (<compiler-generated>:0)
28  libdispatch.dylib             	0x00000001e0b02e6c _dispatch_call_block_and_release + 32 (init.c:1517)
29  libdispatch.dylib             	0x00000001e0b04a30 _dispatch_client_callout + 20 (object.m:560)
30  libdispatch.dylib             	0x00000001e0b12f48 _dispatch_main_queue_drain + 928 (inline_internal.h:2622)
31  libdispatch.dylib             	0x00000001e0b12b98 _dispatch_main_queue_callback_4CF + 44 (queue.c:7770)
32  CoreFoundation                	0x00000001e0e55760 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16 (CFRunLoop.c:1795)
33  CoreFoundation                	0x00000001e0e0f644 __CFRunLoopRun + 2532 (CFRunLoop.c:3144)
34  CoreFoundation                	0x00000001e0e22b0c CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268)
35  GraphicsServices              	0x00000001fcf93374 GSEventRunModal + 164 (GSEvent.c:2200)
36  UIKitCore                     	0x00000001e3799b58 -[UIApplication _run] + 1100 (UIApplication.m:3511)
37  UIKitCore                     	0x00000001e351b098 UIApplicationMain + 364 (UIApplication.m:5064)
38  XYMainApp                     	0x00000001004f8e78 main + 64 (XYAppDelegate.swift:17)
39  dyld                          	0x0000000103485da4 start + 520 (dyldMain.cpp:879)

I'm sure it safe

Why?

Have you tried running your app with TSan enabled? See Diagnosing memory, thread, and crash issues early.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

cellModel in example is a struct and handle change on main thread

cellData.$cellModel
            .receive(on: DispatchQueue.main.ocombine)
            .sink { [weak self] value in
                
            }
            .store(in: &cancellable)

should I update it on main thread?

when I replaced

@OpenCombine.Published 

with

@Combine.Published

crash not happen!

Did you try TSan?

cellModel in example is a struct and handle change on main thread

So how do you explain thread 6?

when I replaced @OpenCombine.Published with @Combine.Published crash not happen!

Sure, but that doesn’t tell us much. OpenCombine is a complete reimplementation of Combine, so it’ll behave differently on many different axes.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

App crash when archive by Xcode 14.3.1, but Xcode 14.2 not
 
 
Q