iOS 15.4 crashes on older devices

With the release of iOS 15.4, we've noticed crashes starting to appear for older iPhones (iPhone X being the newest one). Firebase Crashlytics mentions: "lazy protocol witness table accessor for type * and conformance *" for the crashed thread. This happens on several occasions with different classes...

The stack trace (redacted) looks like follows:

0   libsystem_kernel.dylib        	       0x1bb5febbc __pthread_kill + 8
1   libsystem_pthread.dylib       	       0x1dbfb3854 pthread_kill + 208
2   libsystem_c.dylib             	       0x18b5c80b0 __abort + 124
3   libsystem_c.dylib             	       0x18b5736b0 abort + 136
4   libswiftCore.dylib            	       0x1858bb01c swift::fatalError(unsigned int, char const*, ...) + 140
5   libswiftCore.dylib            	       0x1858c4698 swift::MetadataAllocator::Allocate(unsigned long, unsigned long) + 516
6   libswiftCore.dylib            	       0x1858c51f4 _swift_getGenericMetadata(swift::MetadataRequest, void const* const*, swift::TargetTypeContextDescriptor<swift::InProcess> const*) + 1004
7   libswiftCore.dylib            	       0x1858a8d68 __swift_instantiateCanonicalPrespecializedGenericMetadata + 32
8   Application                    	       0x103388304 
9   Application                    	       0x10338811c 
10  Application                    	       0x102cee9b4 
11  Application                    	       0x102ceea08 
12  Application                    	       0x102cfab28 
13  Application                    	       0x10ad195d0 
14  Application                    	       0x10ad18ed8 
15  Application                    	       0x10ad19d9c 
16  Application                    	       0x10ad151f8 
17  Application                    	       0x10ad16090 
18  libdispatch.dylib             	       0x180b6f094 _dispatch_call_block_and_release + 24
19  libdispatch.dylib             	       0x180b70094 _dispatch_client_callout + 16
20  libdispatch.dylib             	       0x180b5474c _dispatch_root_queue_drain + 612
21  libdispatch.dylib             	       0x180b54dec _dispatch_worker_thread2 + 160
22  libsystem_pthread.dylib       	       0x1dbfa7dd4 _pthread_wqthread + 224
23  libsystem_pthread.dylib       	       0x1dbfa793c start_wqthread + 8

I hope someone can provide some insights to fix this.

Please post the entire Apple crash log for further help debugging this. For more information on adding the Apple crash log to your post, see Quinn's Posting a Crash Report.

Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com

I have an iPhone X and it keeps freezing and restarting every 5 minutes.

Hi Matt,

Hereby the full crash report, please let me know if this is enough to help you forward in the investigation.

Regard, Wesley

Thank you for providing the crash report. There is the obvious crasher that you are pointing out here on thread 45 where abort is being called. However, you will want to take a look at what is happening on frame 6 as it looks like this is your code on this frame interacting with user subscription data.

Thread 45 name:   Dispatch queue: com.apple.NSURLSession-delegate
Thread 45 Crashed:
0   libsystem_kernel.dylib        	       0x1bb5febbc __pthread_kill + 8
1   libsystem_pthread.dylib       	       0x1dbfb3854 pthread_kill + 208
2   libsystem_c.dylib             	       0x18b5736a4 abort + 124
3   libswiftCore.dylib            	       0x1858bb01c swift::fatalError(unsigned int, char const*, ...) + 140
4   libswiftCore.dylib            	       0x1858c4698 swift::MetadataAllocator::Allocate(unsigned long, unsigned long) + 516
5   libswiftCore.dylib            	       0x1858cd674 swift::_getWitnessTable(swift::TargetProtocolConformanceDescriptor<swift::InProcess> const*, swift::TargetMetadata<swift::InProcess> const*, void const* const*) + 2272
6   bbbbbbb                       	       0x104a1ae14 lazy protocol witness table accessor for type UserSubscriptionsModel and conformance UserSubscriptionsModel + 56
7   Packages                      	       0x10a4fd7d4 closure #1 in ApiClient3.dataTask(request:success:failure:eTagAction:) + 1752
8   Packages                      	       0x10a4fefd4 partial apply for closure #1 in ApiClient3.dataTask(request:success:failure:eTagAction:) + 172
9   Packages                      	       0x10a4ff0ec thunk for @escaping @callee_guaranteed (@guaranteed Data?, @guaranteed NSURLResponse?, @guaranteed Error?) -> () + 268
10  FirebasePerformance           	       0x108b5aa78 __InstrumentDataTaskWithRequestCompletionHandler_block_invoke_2 + 236
11  FirebasePerformance           	       0x108b5aa78 __InstrumentDataTaskWithRequestCompletionHandler_block_invoke_2 + 236
12  CFNetwork                     	       0x181617e64 0x1815f8000 + 130660
13  CFNetwork                     	       0x18162843c 0x1815f8000 + 197692 

Now, there are also other oddities that I see that you will absolutely want to address. For example, see threads 38, 34, and 11 as they all make reference to using the HomeViewController3 on a background thread. Make sure you are not updating UI or interacting with UI on these threads as this will certainly cause issues.

Next, take a look at thread 9. Thread 9 is also calling abort with the last call to your project code looking like this:

11  bbbbbbb                       	       0x104c38458 static HomeCarouselMapper.mapListOfProductModels(_:) + 376
12  bbbbbbb                       	       0x104c38270 static HomeCarouselMapper.mapToHomeCarouselViewModel(_:) + 52

Lastly, your project has only been running for a little over a second and has 40+ threads spun up already. I would start by stripping down these extra threads into a minimal test app until you can reproduce this in a focused sample and debug further from that context.

Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com

It would also be helpful to know if this crash reproduces on a device running iOS 15.4.1? It has come to my attention that there may have been some issues with swift::MetadataAllocator::Allocate and if you are still experiencing these issues after updating to iOS 15.4.1 then please open a bug report.

Having said that, I would still advise you to take a look at what is happening on your background threads to make sure they are not interacting with a ViewController while running in the background.

Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com

are there some action to avoid this crash?I can‘t suggest user to update system when meet this crash in iOS 15.4,and threre are a lot of iOS15.4 users

iOS 15.4 crashes on older devices
 
 
Q