Webkit encountered an internal error

Safari cannot open the page due to the error 'WebKit encountered an internal error.' We are using https://github.com/stleamist/BetterSafariView.git, and it was working fine before we updated to Xcode 16.

Here are the error details, this could be a bug within WebKit.

Process:             com.apple.WebKit.Networking [78419]
Path:               
/Volumes/VOLUME/*/com.apple.WebKit.Networking 
Identifier:          com.apple.WebKit.Networking
Version:             8619.1.26.30.5

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000beaddcbd3810
0   libobjc.A.dylib                0x18008df74 objc_autoreleaseReturnValue + 88
1   Network                        0x1883e3bc0 -[NWURLErrorUserInfoDictionary objectForKey:] + 112
2   CoreFoundation                 0x1804b2fc8 -[NSDictionary getObjects:andKeys:count:] + 208
3   CoreFoundation                 0x1804b4ea0 -[NSDictionary initWithDictionary:copyItems:] + 272
4   CoreFoundation                 0x180526d7c -[__NSPlaceholderDictionary initWithDictionary:copyItems:] + 172
5   CoreFoundation                 0x1804b6198 +[NSDictionary dictionaryWithDictionary:] + 32
6   WebKit                         0x18c0c992c -[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:] + 92
7   Network                        0x1883f7a8c __65-[NWURLSessionDelegateWrapper task:didCompleteWithError:metrics:]_block_invoke + 44
8   libdispatch.dylib              0x1801774ec _dispatch_call_block_and_release + 24

Thanks for reporting the issue. Do you have a sample project reproducing this issue? Is this only crashing on simulators?

Sorry about that. It looks like the issue was on our end, but it's working fine now.

Everything seems to be working fine, except for accessing an HTTPS domain with a self-signed certificate or URL that has an expired SSL certificate. It only crashes on the emulator.

Are you able to reproduce this with https://badssl.com in simulator Safari?

Seeing this one too, opening https://self-signed.badssl.com in Safari in iOS 18.0 simulator crashes WebKit.

-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Incident Identifier: E979D228-A26C-42B1-AB90-476CC91AA1DC
CrashReporter Key:   E747D7FB-6FA2-711E-28A3-9106EC7F7DE6
Hardware Model:      Mac13,1
Process:             com.apple.WebKit.Networking [35446]
Path:                /Volumes/VOLUME/*/com.apple.WebKit.Networking
Identifier:          com.apple.WebKit.Networking
Version:             8619.1.26.30.5
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd_sim [34443]
Coalition:           com.apple.CoreSimulator.SimDevice.4309B73A-E477-4E76-B39B-25B41C68CC12 [6635]
Responsible Process: SimulatorTrampoline [880]

Date/Time:           2024-09-27 12:13:02.3607 +0200
Launch Time:         2024-09-27 12:11:04.4115 +0200
OS Version:          macOS 14.6.1 (23G93)
Release Type:        User
Report Version:      104

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000beaddcbdc610 -> 0x00003eaddcbdc610 (possible pointer authentication failure)
Exception Codes: 0x0000000000000001, 0x0000beaddcbdc610
VM Region Info: 0x3eaddcbdc610 is not in any region.  Bytes after previous region: 68435417351697  Bytes before following region: 36636662577648
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      commpage (reserved)        1000000000-7000000000   [384.0G] ---/--- SM=NUL  reserved VM address space (unallocated)
--->  GAP OF 0x5f9000000000 BYTES
      MALLOC_NANO              600000000000-600020000000 [512.0M] rw-/rwx SM=PRV  
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [35446]

Triggered by Thread:  0

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libobjc.A.dylib               	       0x18008df74 objc_autoreleaseReturnValue + 88
1   Network                       	       0x1883e3bc0 -[NWURLErrorUserInfoDictionary objectForKey:] + 112
2   CoreFoundation                	       0x1804b2fc8 -[NSDictionary getObjects:andKeys:count:] + 208
3   CoreFoundation                	       0x1804b4ea0 -[NSDictionary initWithDictionary:copyItems:] + 272
4   CoreFoundation                	       0x180526d7c -[__NSPlaceholderDictionary initWithDictionary:copyItems:] + 172
5   CoreFoundation                	       0x1804b6198 +[NSDictionary dictionaryWithDictionary:] + 32
6   WebKit                        	       0x18c0c992c -[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:] + 92
7   Network                       	       0x1883f7a8c __65-[NWURLSessionDelegateWrapper task:didCompleteWithError:metrics:]_block_invoke + 44
8   libdispatch.dylib             	       0x1801774ec _dispatch_call_block_and_release + 24
9   libdispatch.dylib             	       0x180178de0 _dispatch_client_callout + 16
10  libdispatch.dylib             	       0x180187c60 _dispatch_main_queue_drain + 1272
11  libdispatch.dylib             	       0x180187758 _dispatch_main_queue_callback_4CF + 40
12  CoreFoundation                	       0x18041ae3c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
13  CoreFoundation                	       0x180415534 __CFRunLoopRun + 1944
14  CoreFoundation                	       0x180414960 CFRunLoopRunSpecific + 536
15  Foundation                    	       0x180f2af24 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 208
16  Foundation                    	       0x180f2b0f4 -[NSRunLoop(NSRunLoop) run] + 60
17  libxpc.dylib                  	       0x1800d2aa0 _xpc_objc_main + 332
18  libxpc.dylib                  	       0x1800d4e98 _xpc_main + 60
19  libxpc.dylib                  	       0x1800d504c xpc_main + 60
20  ExtensionFoundation           	       0x1ccf57fa8 0x1cceeb000 + 446376
21  ExtensionFoundation           	       0x1ccf58050 0x1cceeb000 + 446544
22  ExtensionFoundation           	       0x1cceedc18 -[_EXRunningExtension startWithArguments:count:] + 392
23  ExtensionFoundation           	       0x1ccf00154 EXExtensionMain + 216
24  Foundation                    	       0x180f6d0c4 NSExtensionMain + 176
25  dyld_sim                      	       0x1028c9410 start_sim + 20
26  dyld                          	       0x102242154 start + 2476

Yep, can confirm. The crash also happens with https://self-signed.badssl.com and Safari in iOS 18 Simulator as well.

-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Incident Identifier: 36B8315F-3E60-42B7-916D-065F086EBD72
CrashReporter Key:   04C62978-9A1D-1A77-A4F6-DFF0BC1DED4F
Hardware Model:      MacBookPro18,1
Process:             com.apple.WebKit.Networking [94891]
Path:                /Volumes/VOLUME/*/com.apple.WebKit.Networking
Identifier:          com.apple.WebKit.Networking
Version:             8619.1.26.30.5
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd_sim [8677]
Coalition:           com.apple.CoreSimulator.SimDevice.C6C4E44A-C067-4EEB-8AC9-E005CAF2F64D [1737]
Responsible Process: SimulatorTrampoline [1296]

Date/Time:           2024-10-01 13:17:44.2053 +0200
Launch Time:         2024-10-01 13:16:04.7324 +0200
OS Version:          macOS 14.5 (23F79)
Release Type:        User
Report Version:      104

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000814185deda10 -> 0x0000014185deda10 (possible pointer authentication failure)
Exception Codes: 0x0000000000000001, 0x0000814185deda10
VM Region Info: 0x14185deda10 is not in any region.  Bytes after previous region: 899894139409  Bytes before following region: 104172185789936
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      commpage (reserved)        1000000000-7000000000   [384.0G] ---/--- SM=NUL  reserved VM address space (unallocated)
--->  GAP OF 0x5f9000000000 BYTES
      MALLOC_NANO              600000000000-600020000000 [512.0M] rw-/rwx SM=PRV  
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [94891]

Triggered by Thread:  4

Thread 0:
0   libsystem_pthread.dylib       	       0x10f41e5cc start_wqthread + 0

Thread 1:: com.apple.NSURLConnectionLoader
0   libsystem_kernel.dylib        	       0x10f2e1570 mach_msg2_trap + 8
1   libsystem_kernel.dylib        	       0x10f2f2b80 mach_msg2_internal + 76
2   libsystem_kernel.dylib        	       0x10f2e9798 mach_msg_overwrite + 532
3   libsystem_kernel.dylib        	       0x10f2e18e8 mach_msg + 20
4   CoreFoundation                	       0x1096e3b60 __CFRunLoopServiceMachPort + 156
5   CoreFoundation                	       0x1096de224 __CFRunLoopRun + 1160
6   CoreFoundation                	       0x1096dd960 CFRunLoopRunSpecific + 536
7   CFNetwork                     	       0x104d37510 +[__CFN_CoreSchedulingSetRunnable _run:] + 372
8   Foundation                    	       0x101be3d6c __NSThread__start__ + 720
9   libsystem_pthread.dylib       	       0x10f423414 _pthread_start + 104
10  libsystem_pthread.dylib       	       0x10f41e5e0 thread_start + 8

Thread 2:: JavaScriptCore libpas scavenger
0   libsystem_kernel.dylib        	       0x10f2e4a70 __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x10f4239cc _pthread_cond_wait + 1216
2   JavaScriptCore                	       0x118bbd1e0 scavenger_thread_main + 1148
3   libsystem_pthread.dylib       	       0x10f423414 _pthread_start + 104
4   libsystem_pthread.dylib       	       0x10f41e5e0 thread_start + 8

Thread 3:
0   libsystem_pthread.dylib       	       0x10f41e5cc start_wqthread + 0

Thread 4 Crashed::  Dispatch queue: com.apple.NWURLSession
0   libobjc.A.dylib               	       0x100895f74 objc_autoreleaseReturnValue + 88
1   Network                       	       0x1167f8bc0 -[NWURLErrorUserInfoDictionary objectForKey:] + 112
2   CoreFoundation                	       0x10977bfc8 -[NSDictionary getObjects:andKeys:count:] + 208
3   CoreFoundation                	       0x1096ccc8c __NSDictionaryEnumerate + 588
4   CoreFoundation                	       0x10977dbf8 -[NSDictionary __apply:context:] + 96
5   CoreFoundation                	       0x10969f95c _CFErrorFormatDebugDescriptionAux + 564
6   CoreFoundation                	       0x10969fae8 _CFErrorCreateRedactedDescription + 84
7   Foundation                    	       0x101b02638 -[NSError redactedDescription] + 12
8   Foundation                    	       0x101b94794 _NS_os_log_callback + 224
9   libsystem_trace.dylib         	       0x10f34e8c8 _os_log_fmt_flatten_NSCF + 60
10  libsystem_trace.dylib         	       0x10f34e154 _os_log_fmt_flatten_object_impl + 164
11  libsystem_trace.dylib         	       0x10f35d288 _os_log_impl_flatten_and_send + 1892
12  libsystem_trace.dylib         	       0x10f35cb0c _os_log + 164
13  libsystem_trace.dylib         	       0x10f35f6d8 _os_log_impl + 20
14  Network                       	       0x1165124d8 -[NWURLSessionTask complete] + 700
15  Network                       	       0x11650d900 -[NWURLSessionTask completeTaskWithError:] + 184
16  Network                       	       0x1165137d0 __32-[NWURLSessionTask readResponse]_block_invoke + 456
17  Network                       	       0x116781158 __31-[NWURLLoaderHTTP readResponse]_block_invoke + 3504
18  libdispatch.dylib             	       0x10e9cb594 _dispatch_block_async_invoke2 + 104
19  libdispatch.dylib             	       0x10e9bbde0 _dispatch_client_callout + 16
20  libdispatch.dylib             	       0x10e9c3f60 _dispatch_lane_serial_drain + 956
21  libdispatch.dylib             	       0x10e9c4a98 _dispatch_lane_invoke + 388
22  libdispatch.dylib             	       0x10e9c58e4 _dispatch_workloop_invoke + 776
23  libdispatch.dylib             	       0x10e9cff44 _dispatch_root_queue_drain_deferred_wlh + 276
24  libdispatch.dylib             	       0x10e9cf5a0 _dispatch_workloop_worker_thread + 440
25  libsystem_pthread.dylib       	       0x10f41f814 _pthread_wqthread + 284
26  libsystem_pthread.dylib       	       0x10f41e5d4 start_wqthread + 8

Thread 5:
0   libsystem_pthread.dylib       	       0x10f41e5cc start_wqthread + 0

Thread 6:
0   libsystem_pthread.dylib       	       0x10f41e5cc start_wqthread + 0

Thread 7:
0   libsystem_pthread.dylib       	       0x10f41e5cc start_wqthread + 0

Thread 8:
0   libsystem_pthread.dylib       	       0x10f41e5cc start_wqthread + 0

Also facing this issue on iOS 18 simulator

An radar has been filed for this issue: http://openradar.appspot.com/15344951

Encountering the same with iOS 18.0 sim and 18.1 sim

Webkit encountered an internal error
 
 
Q