Bug 266902 - WKWebView is crashing when loading in iOS 16.x
Summary: WKWebView is crashing when loading in iOS 16.x
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit API (show other bugs)
Version: Other
Hardware: iPhone / iPad iOS 16
: P5 Blocker
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-26 14:41 PST by Raiam Quesada
Modified: 2023-12-27 11:07 PST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Raiam Quesada 2023-12-26 14:41:32 PST
Hi guys, I have more than 2000 users that have their app blocked because we submitted an update some days ago and now the app is no longer opening for them!

It's kinda strange to test, we have the same devices and the error rate is less than 1% (we have around 5M users), but the errors seems when we try to load a new instance of WKWebView, and getting some data from crashlytics this is the error:

com.apple.main-thread
0  libsystem_kernel.dylib         0x16cc stat + 8
1  libsystem_kernel.dylib         0x16cc stat64 + 8
2  Foundation                     0x2908c -[NSFileManager fileExistsAtPath:isDirectory:] + 92
3  Foundation                     0x27f38 -[NSURL(NSURL) initFileURLWithPath:] + 156
4  Foundation                     0x27e90 +[NSURL(NSURL) fileURLWithPath:] + 28
5  CoreUI                         0x5b6d0 +[CUIDesignLibraryCatalog catalogForDesignSystem:colorScheme:contrast:styling:error:] + 264
6  CoreUI                         0x5bfa4 +[CUIDesignLibraryCompositeCatalog _catalogsForDesignSystem:colorScheme:contrast:styling:error:] + 100
7  CoreUI                         0x5c214 +[CUIDesignLibraryCompositeCatalog compositeCatalogForDesignSystem:colorScheme:contrast:styling:error:] + 168
8  CoreUI                         0x3b008 +[CUIDesignLibrary colorWithName:designSystem:palette:colorScheme:contrast:styling:displayGamut:error:] + 108
9  CoreUI                         0x3af90 +[CUIDesignLibrary colorWithTraits:error:] + 44
10 UIKitCore                      0x95812c -[UIDynamicCatalogSystemColor _resolvedColorWithTraitCollection:] + 296
11 UIKitCore                      0x63ec8 -[UIDynamicColor CGColor] + 56
12 WebCore                        0xd82368 <redacted> + 68
13 WebCore                        0xd7a610 WebCore::RenderThemeIOS::cssValueToSystemColorMap() + 336
14 WebKit                         0x3dc7a4 <redacted> + 1280
15 WebKit                         0x55ff00 <redacted> + 1912
16 WebKit                         0x560868 <redacted> + 292
17 WebKit                         0x562238 <redacted> + 848
18 WebKit                         0x562484 <redacted> + 296
19 WebKit                         0x5e84 <redacted> + 64
20 WebKit                         0x5e18 <redacted> + 160
21 WebKit                         0x42ec <redacted> + 972
22 WebKit                         0x3f0c <redacted> + 68
23 PROJECT                        0xbac4 ViewController.initializeWebView() + 308 (ViewController.swift:308)
24 PROJECT                        0xaaec ViewController.mountWebView() + 210 (ViewController.swift:210)
25 PROJECT                        0xa19c ViewController.viewWillAppear(_:) + 157 (ViewController.swift:157)
26 PROJECT                        0xa1dc @objc ViewController.viewWillAppear(_:) + 40 (<compiler-generated>:40)
27 UIKitCore                      0xc880 -[UIViewController _setViewAppearState:isAnimating:] + 612
28 UIKitCore                      0xa66a8 -[UIViewController __viewWillAppear:] + 100
29 UIKitCore                      0x1914cc -[UINavigationController _startTransition:fromViewController:toViewController:] + 588
30 UIKitCore                      0x1907ec -[UINavigationController _startDeferredTransitionIfNeeded:] + 604
31 UIKitCore                      0x18fe78 -[UINavigationController __viewWillLayoutSubviews] + 92
32 UIKitCore                      0x18fde0 -[UILayoutContainerView layoutSubviews] + 168
33 UIKitCore                      0x47a8 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1932
34 QuartzCore                     0x960c CA::Layer::layout_if_needed(CA::Transaction*) + 496
35 QuartzCore                     0x1bf2c CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 144
36 QuartzCore                     0x2c9f0 CA::Context::commit_transaction(CA::Transaction*, double, double*) + 456
37 QuartzCore                     0x59dc0 CA::Transaction::commit() + 644
38 QuartzCore                     0x44dbc CA::Transaction::flush_as_runloop_observer(bool) + 84
39 CoreFoundation                 0x898e8 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
40 CoreFoundation                 0x1951c __CFRunLoopDoObservers + 552
41 CoreFoundation                 0x75214 __CFRunLoopRun + 1004
42 CoreFoundation                 0x79d20 CFRunLoopRunSpecific + 584
43 GraphicsServices               0x1998 GSEventRunModal + 160
44 UIKitCore                      0x37180c -[UIApplication _run] + 868
45 UIKitCore                      0x371484 UIApplicationMain + 312
46 PROJECT                        0x3bba8 main + 21 (AppDelegate.swift:21)
47 ???                            0x1f123c344 (Missing)


Our eng team has tried like 2 weeks to identify the root cause, but we can only say the only thing that changed, was the user of webkit in a newer version! We are able to see data with ios 16.x.x and some minor with ios 15.x.x, and iphone X, 6s, 7, 8, 11, 13, 13 Pro Max

any help would be needed!
Comment 1 Ahmad Saleem 2023-12-26 15:43:27 PST
Hi Raiam, thanks for posting. Can you also share whether you have seen similar crashes with iOS 17.

Additionally, do you have these with latest iOS 16.7.4 version as well?

Only WebKit component is following:

13 WebCore                        0xd7a610 WebCore::RenderThemeIOS::cssValueToSystemColorMap() + 336

https://searchfox.org/wubkat/rev/2cb2f84b68df8a519e252d535de43e7d19567883/Source/WebCore/rendering/RenderThemeIOS.h#52

But nothing much.

@ap - should this be also raised in parallel to 'Apple Feedback' app?
Comment 2 Raiam Quesada 2023-12-26 16:07:30 PST
Hi Saleem

not a single crash in ios 17, only in 16.x, and indeed, the crash stack trace was from 16.7.4
Comment 3 Ahmad Saleem 2023-12-26 16:08:06 PST
(In reply to Raiam Quesada from comment #2)
> Hi Saleem
> 
> not a single crash in ios 17, only in 16.x, and indeed, the crash stack
> trace was from 16.7.4

Thanks a lot for sharing the information. Appreciate it.
Comment 4 Ahmad Saleem 2023-12-26 16:10:46 PST
Can you share link to your app and also version (where these crashes are reproducible)?

Last Good Version - x
First Bad Version - where these crashes are happening

Also any change logs from your app between x and y version to give any potential hint?
Comment 5 Raiam Quesada 2023-12-26 17:21:32 PST
sure, our app is https://apps.apple.com/cr/app/cardiogram-heart-rate-monitor/id1000017994

we started facing this issue 2 version behind, where we did a rebranding and had to compile/generate a new build with latest xcode, had to update libraries and so on! before this, everything was working normally on every iOS! 3.7.21 was the latest working perfectly

crashes started 3.7.23! and again, the issues are more than 2k, but it's not really common to reproduce, my team and QA team has tried to reproduce it but no luck, but we have many users complaining about it, and analytics shows the errors indeed happening! 

this is another variant of the "same issue", and I say same issue because its happening in the very same line of our code, the stack trace is the one a bit different


com.apple.main-thread
0  ???                            0x1b658d50c (Missing)
1  ???                            0x1b658d4f8 (Missing)
2  ???                            0x1b653f6a0 (Missing)
3  ???                            0x1b653eaac (Missing)
4  WebKit                         0x1c488c invocation function for block in WebKit::get_TCC_kTCCServiceMicrophone() + 28
5  libdispatch.dylib              0x3fdc _dispatch_client_callout + 20
6  libdispatch.dylib              0x5828 _dispatch_once_callout + 32
7  WebKit                         0x1c486c WebKit::get_TCC_kTCCServiceMicrophone() + 64
8  WebKit                         0x3d6df8 WebKit::checkUsageDescriptionStringForType(WebKit::MediaPermissionType) + 272
9  WebKit                         0x4111a0 WebKit::WebPreferences::platformInitializeStore() + 72
10 WebKit                         0x60d2a8 WebKit::WebPreferences::WebPreferences(WTF::String const&, WTF::String const&, WTF::String const&) + 204
11 WebKit                         0x60d04c WebKit::WebPreferences::createWithLegacyDefaults(WTF::String const&, WTF::String const&, WTF::String const&) + 72
12 WebKit                         0x5d1c24 WebKit::WebPageGroup::WebPageGroup(WTF::String const&) + 276
13 WebKit                         0x60f188 WebKit::WebProcessPool::WebProcessPool(API::ProcessPoolConfiguration&) + 204
14 WebKit                         0x2dec -[WKProcessPool _initWithConfiguration:] + 80
15 WebKit                         0xb48c -[WKProcessPool init] + 48
16 WebKit                         0x4d04 -[WKWebViewConfiguration processPool] + 56
17 WebKit                         0x49f8 -[WKWebViewConfiguration copyWithZone:] + 112
18 WebKit                         0x3f40 -[WKWebView _initializeWithConfiguration:] + 140
19 WebKit                         0x3ea0 -[WKWebView initWithFrame:configuration:] + 72
20 PROJECT-11                     0xbac4 ViewController.initializeWebView() + 308 (ViewController.swift:308)
21 PROJECT-11                     0xaaec ViewController.mountWebView() + 210 (ViewController.swift:210)
22 PROJECT-11                     0xa19c ViewController.viewWillAppear(_:) + 157 (ViewController.swift:157)
23 PROJECT-11                     0xa1dc @objc ViewController.viewWillAppear(_:) + 40 (<compiler-generated>:40)
24 UIKitCore                      0xd500 -[UIViewController _setViewAppearState:isAnimating:] + 612
25 UIKitCore                      0xb1d94 -[UIViewController __viewWillAppear:] + 116
26 UIKitCore                      0x1a8778 -[UINavigationController _startTransition:fromViewController:toViewController:] + 592
27 UIKitCore                      0x1a7aa4 -[UINavigationController _startDeferredTransitionIfNeeded:] + 608
28 UIKitCore                      0x1a70f4 -[UINavigationController __viewWillLayoutSubviews] + 96
29 UIKitCore                      0x1a7058 -[UILayoutContainerView layoutSubviews] + 172
30 UIKitCore                      0x4cec -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1980
31 QuartzCore                     0xa4e8 CA::Layer::layout_if_needed(CA::Transaction*) + 500
32 QuartzCore                     0x1db9c CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 148
33 QuartzCore                     0x2f098 CA::Context::commit_transaction(CA::Transaction*, double, double*) + 456
34 QuartzCore                     0x663c4 CA::Transaction::commit() + 652
35 QuartzCore                     0x4d408 CA::Transaction::flush_as_runloop_observer(bool) + 88
36 UIKitCore                      0x504fb0 _UIApplicationFlushCATransaction + 52
37 UIKitCore                      0x651678 _UIUpdateSequenceRun + 84
38 UIKitCore                      0xc90904 schedulerStepScheduledMainSection + 172
39 UIKitCore                      0xc8fad0 runloopSourceCallback + 92
40 CoreFoundation                 0xd622c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
41 CoreFoundation                 0xe2614 __CFRunLoopDoSource0 + 176
42 CoreFoundation                 0x6657c __CFRunLoopDoSources0 + 340
43 CoreFoundation                 0x7beb8 __CFRunLoopRun + 836
44 CoreFoundation                 0x811e4 CFRunLoopRunSpecific + 612
45 GraphicsServices               0x1368 GSEventRunModal + 164
46 UIKitCore                      0x3a2d88 -[UIApplication _run] + 888
47 UIKitCore                      0x3a29ec UIApplicationMain + 340
48 PROJECT-11                     0x3bba8 main + 21 (AppDelegate.swift:21)
49 ???                            0x1b654d948 (Missing)
Comment 6 Raiam Quesada 2023-12-26 17:27:55 PST
Look this one:



com.apple.tcc.preflight.kTCCServiceMicrophone
0  libsystem_kernel.dylib         0xb48 mach_msg2_trap + 8
1  libsystem_kernel.dylib         0x13008 mach_msg2_internal + 80
2  libsystem_kernel.dylib         0x13248 mach_msg_overwrite + 388
3  libsystem_kernel.dylib         0x108c mach_msg + 24
4  libdispatch.dylib              0x1f364 _dispatch_mach_send_and_wait_for_reply + 540
5  libdispatch.dylib              0x1f6ec dispatch_mach_send_with_result_and_wait_for_reply + 60
6  libxpc.dylib                   0x102e4 xpc_connection_send_message_with_reply_sync + 240
7  TCC                            0x1c20 tccd_send_message + 940
8  TCC                            0x6db8 __TCCAccessRequest_block_invoke_3 + 868
9  libdispatch.dylib              0x3fdc _dispatch_client_callout + 20
10 libdispatch.dylib              0x13574 _dispatch_lane_barrier_sync_invoke_and_complete + 56
11 libsystem_trace.dylib          0x6d78 _os_activity_initiate_impl + 64
12 TCC                            0x2fac TCCAccessRequest + 476
13 TCC                            0x222c TCCAccessPreflight + 300
14 WebKit                         0x4218d4 WebKit::checkUsageDescriptionStringForType(WebKit::MediaPermissionType) + 288
15 WebKit                         0x45bfe8 WebKit::WebPreferences::platformInitializeStore() + 72
16 WebKit                         0x654814 WebKit::WebPreferences::WebPreferences(WTF::String const&, WTF::String const&, WTF::String const&) + 204
17 WebKit                         0x6545b8 WebKit::WebPreferences::createWithLegacyDefaults(WTF::String const&, WTF::String const&, WTF::String const&) + 72
18 WebKit                         0x619c98 WebKit::WebPageGroup::WebPageGroup(WTF::String const&) + 276
19 WebKit                         0x6568f4 WebKit::WebProcessPool::WebProcessPool(API::ProcessPoolConfiguration&) + 204
20 WebKit                         0x3610 -[WKProcessPool _initWithConfiguration:] + 80
21 WebKit                         0xbcf4 -[WKProcessPool init] + 48
22 WebKit                         0x5544 -[WKWebViewConfiguration processPool] + 56
23 WebKit                         0x5230 -[WKWebViewConfiguration copyWithZone:] + 112
24 WebKit                         0x4770 -[WKWebView _initializeWithConfiguration:] + 140
25 WebKit                         0x46d0 -[WKWebView initWithFrame:configuration:] + 72
26 Cardiogram                     0xbac4 ViewController.initializeWebView() + 308 (ViewController.swift:308)
27 Cardiogram                     0xaaec ViewController.mountWebView() + 210 (ViewController.swift:210)
28 Cardiogram                     0xa19c ViewController.viewWillAppear(_:) + 157 (ViewController.swift:157)
29 Cardiogram                     0xa1dc @objc ViewController.viewWillAppear(_:) + 40 (<compiler-generated>:40)
30 UIKitCore                      0xd838 -[UIViewController _setViewAppearState:isAnimating:] + 616
31 UIKitCore                      0xb14c0 -[UIViewController __viewWillAppear:] + 104
32 UIKitCore                      0x1a7c88 -[UINavigationController _startTransition:fromViewController:toViewController:] + 592
33 UIKitCore                      0x1a6fb4 -[UINavigationController _startDeferredTransitionIfNeeded:] + 608
34 UIKitCore                      0x1a6604 -[UINavigationController __viewWillLayoutSubviews] + 96
35 UIKitCore                      0x1a6568 -[UILayoutContainerView layoutSubviews] + 172
36 UIKitCore                      0x5020 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1980
37 QuartzCore                     0x99ec CA::Layer::layout_if_needed(CA::Transaction*) + 500
38 QuartzCore                     0x1d0a0 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 148
39 QuartzCore                     0x2e5b0 CA::Context::commit_transaction(CA::Transaction*, double, double*) + 456
40 QuartzCore                     0x635ec CA::Transaction::commit() + 652
41 QuartzCore                     0x4c8cc CA::Transaction::flush_as_runloop_observer(bool) + 88
42 UIKitCore                      0x504b44 _UIApplicationFlushCATransaction + 52
43 UIKitCore                      0x652740 _UIUpdateSequenceRun + 84
44 UIKitCore                      0xc99fd0 schedulerStepScheduledMainSection + 172
45 UIKitCore                      0xc9919c runloopSourceCallback + 92
46 CoreFoundation                 0xd5f54 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
47 CoreFoundation                 0xe232c __CFRunLoopDoSource0 + 176
48 CoreFoundation                 0x66210 __CFRunLoopDoSources0 + 244
49 CoreFoundation                 0x7bba8 __CFRunLoopRun + 836
50 CoreFoundation                 0x80ed4 CFRunLoopRunSpecific + 612
51 GraphicsServices               0x1368 GSEventRunModal + 164
52 UIKitCore                      0x3a23d0 -[UIApplication _run] + 888
53 UIKitCore                      0x3a2034 UIApplicationMain + 340
54 Cardiogram                     0x3bba8 main + 21 (AppDelegate.swift:21)
55 ???                            0x1a73ac960 (Missing)


it's showing the issue at our same line, but with different stack trace, that is why I have ended up with no clue on what can be happening with iOS 16 (certain devices)
Comment 7 Alexey Proskuryakov 2023-12-27 11:07:33 PST
While I understand that this is an emergency for your users, tracking this as a WebKit bug is not appropriate. First, this doesn't affect iOS 17, so even if this were a WebKit bug, this would mean that it's already fixed. Second, the fact that this appears to have started after changes to the app suggests an issue outside iOS.

Please see https://developer.apple.com/support/technical/ for how Apple provides general developer technical support.

I will also note that these excerpts from crash logs look potentially misleading. Are you sure that you are looking at the stack trace of the crashing thread? The complete crash log contains information about which thread crashed.