Crash iOS 17.1.2: SIGSEGV _swift_release_dealloc (libswiftCore.dylib)

Hello! I'm developing a SDK and a customer is experiencing a very rare crash (happening for < 10 users) for which there are no clear repro steps.

In the attached backtrace of the crash, there are two threads #13 and #17 which seem to be accessing the same part of the code (named MyMethod2 in the file). Thread #17 is the one crashing during deallocation of some protobuf objects.

We designed MyMethod2 to be called by at most one thread at any point in time by using a serial DispatchQueue.

My question is: can we tell for sure that the threads #13 and #17 shown in the file were executing that shared code simultaneously just by looking at the trace? If so, there'd be a concurrency bug in my code that I need to fix, but I haven't found anything suspicious. If on the other hand, these two threads were both used by the serial queue but at different times, then the problem is elsewhere.

Thank you for your help!

The two threads:

Thread 13 name:
Thread 13:
0   libsystem_kernel.dylib         	 0x00000001f61a0cb0 write (libsystem_kernel.dylib)
1   CoreFoundation                 	 0x00000001aed14f68 fileWrite (CoreFoundation)
2   CoreFoundation                 	 0x00000001aed14c40 CFWriteStreamWrite (CoreFoundation)
3   [MyHiddenAppName]            	 0x0000000107b81f8c NSOutputStream.write(_:)
4   [MyHiddenAppName]            	 0x0000000107ab6640 specialized MyMethod2
5   [MyHiddenAppName]            	 0x0000000107ab6cf0 partial apply for closure #1 in MyMethod1
6   [MyHiddenAppName]            	 0x0000000102ba0538 thunk for @escaping @callee_guaranteed () -> () (<compiler-generated>:0)
7   libdispatch.dylib              	 0x00000001b6c4f6a8 _dispatch_call_block_and_release (libdispatch.dylib)
[...]
Thread 17 name:
Thread 17 Crashed:
0   libswiftCore.dylib             	 0x00000001a8467d70 _swift_release_dealloc (libswiftCore.dylib)
1   libswiftCore.dylib             	 0x00000001a8469424 bool swift::RefCounts<swift::RefCountBitsT<(swift::RefCountInlinedness)1>>::doDecrementSlow<(swift::PerformDeinit)1>(swift::RefCountBitsT<(swift::RefCountInlinedness)1>, unsigned int) (libswiftCore.dylib)
2   [MyHiddenAppName]            	 0x0000000107a45b54 destroy for MyProtoStruct4
3   [MyHiddenAppName]            	 0x0000000107a55c64 outlined destroy of (MyProtoStruct2.OneOfEnum, MyProtoStruct2.OneOfEnum)
4   [MyHiddenAppName]            	 0x0000000107a4503c MyProtoStruct4._StorageClass.__deallocating_deinit
5   libswiftCore.dylib             	 0x00000001a8467d88 _swift_release_dealloc (libswiftCore.dylib)
6   libswiftCore.dylib             	 0x00000001a8469424 bool swift::RefCounts<swift::RefCountBitsT<(swift::RefCountInlinedness)1>>::doDecrementSlow<(swift::PerformDeinit)1>(swift::RefCountBitsT<(swift::RefCountInlinedness)1>, unsigned int) (libswiftCore.dylib)
7   [MyHiddenAppName]            	 0x0000000107a6a91c destroy for MyProtoStruct3
[...]
80  [MyHiddenAppName]            	 0x0000000107ab6108 specialized MyMethod2
81  [MyHiddenAppName]            	 0x0000000107ab6cf0 partial apply for closure #1 in MyMethod1
82  [MyHiddenAppName]            	 0x0000000102ba0538 thunk for @escaping @callee_guaranteed () -> () (<compiler-generated>:0)
83  libdispatch.dylib              	 0x00000001b6c4f6a8 _dispatch_call_block_and_release (libdispatch.dylib)
[...]

Answered by ChristianBC in 776817022

Sadly this is all I have for now. I'm curious, what makes you think this is a report from a third-party crash reporter rather than an Apple one? Thanks!

Do you have an Apple crash report for this crash? The crash report you posted looks like it came from a third-party crash reporter, and I don’t trust those when it comes to investigating gnarly problems like this [1].

See Posting a Crash Report for advice on how to post your crash report.

Share and Enjoy

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

[1] For the reasons I outline in Implementing Your Own Crash Reporter.

Accepted Answer

Sadly this is all I have for now. I'm curious, what makes you think this is a report from a third-party crash reporter rather than an Apple one? Thanks!

Mistakenly marked my own reply as "accepted", sorry. I will see if I can get an actual Apple crash report.

Crash iOS 17.1.2: SIGSEGV _swift_release_dealloc (libswiftCore.dylib)
 
 
Q