Runtime shader compiler crash & compiler connection failed error

Does anyone know the possible causes of a "Compiler connection failed" error during shader compilation?


No other feedback is provided by the shader compiler, but we did notice in the device log that the MTLCompilerService XPC process seems to be crashing. Device log is pasted below.


It's appearing when trying to dynamically compile a Metal shader at runtime. The shader compiles without error when compiled using Xcode at build time.


We require dynamic shaders in our app, so please refrain from answers that require us to pre-compile our shaders at build time. The first choice is to understand how to fix dynamic compilation.


...Bill


----------------------------------------------------------------------------

Incident Identifier: 569C25BB-5586-4A13-A191-1DA5654F4419

CrashReporter Key: 55470ef8e3ff35d9a51350a540fc37c7802067f4

Hardware Model: iPad4,4

Process: MTLCompilerService [861]

Path: /System/Library/Frameworks/Metal.framework/XPCServices/MTLCompilerService.xpc/MTLCompilerService

Identifier: com.apple.MTLCompilerService

Version: 17.7 (17.7)

Code Type: ARM-64 (Native)

Parent Process: launchd [1]



Date/Time: 2015-07-06 13:41:20.541 -0400

Launch Time: 2015-07-06 13:41:20.519 -0400

OS Version: iOS 8.4 (12H143)

Report Version: 105



Exception Type: EXC_BAD_ACCESS (SIGSEGV)

Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000018

Triggered by Thread: 4



Thread 0:

0 libsystem_kernel.dylib 0x000000019509f594 __semwait_signal_nocancel + 8

1 libsystem_c.dylib 0x0000000194fcf1a0 nanosleep$NOCANCEL + 200

2 libsystem_c.dylib 0x0000000194ff2da8 sleep$NOCANCEL + 44

3 libdispatch.dylib 0x0000000194f65194 _dispatch_queue_cleanup2 + 140

4 libsystem_pthread.dylib 0x000000019513a324 _pthread_tsd_cleanup + 196

5 libsystem_pthread.dylib 0x0000000195139ff0 _pthread_exit + 136

6 libsystem_pthread.dylib 0x000000019513b274 pthread_exit + 40

7 libdispatch.dylib 0x0000000194f65104 dispatch_main + 40

8 libxpc.dylib 0x000000019516c20c _xpc_objc_main + 756

9 libxpc.dylib 0x000000019516df1c xpc_main + 196

10 MTLCompilerService 0x000000010006f498 0x10006c000 + 13464

11 libdyld.dylib 0x0000000194f86a04 start + 0



Thread 1 name: Dispatch queue: com.apple.root.default-qos.overcommit

Thread 1:

0 libsystem_kernel.dylib 0x000000019509f984 __sigsuspend_nocancel + 8

1 libdispatch.dylib 0x0000000194f6521c _dispatch_sigsuspend + 24

2 libdispatch.dylib 0x0000000194f65200 _dispatch_sig_thread + 44



Thread 2:

0 libsystem_kernel.dylib 0x000000019509fc78 __workq_kernreturn + 8

1 libsystem_pthread.dylib 0x00000001951392d8 _pthread_wqthread + 988

2 libsystem_pthread.dylib 0x0000000195138eec start_wqthread + 0



Thread 3 name: Dispatch queue: com.apple.libdispatch-manager

Thread 3:

0 libsystem_kernel.dylib 0x0000000195084c24 kevent64 + 8

1 libdispatch.dylib 0x0000000194f69e6c _dispatch_mgr_invoke + 272

2 libdispatch.dylib 0x0000000194f5b998 _dispatch_mgr_thread + 48



Thread 4 Crashed:

0 libLLVMContainer.dylib 0x000000018668a8ac llvm::Value::getName() const + 0

1 AGXCompilerCore 0x0000000188a5f3c8 AGCLLVMUserFragmentShader::initCompile() + 196

2 AGXCompilerCore 0x0000000188a4dd74 AGCLLVMUserObject::compile() + 328

3 AGXCompilerCore 0x0000000188a2d7e4 0x188a18000 + 88036

4 AGXCompilerCore 0x0000000188a2d134 MTLCompilerBuildRequest + 72

5 MTLCompiler 0x000000018d09ec04 MTLCompilerService::buildRequest(unsigned int, void const*, unsigned long, void (unsigned int, void const*, unsigned long, char const*) block_pointer) + 7844

6 MTLCompiler 0x000000018d09a8a0 MTLCodeGenServiceBuildRequest + 72

7 MTLCompilerService 0x000000010006f7a8 0x10006c000 + 14248

8 libxpc.dylib 0x0000000195160cc8 _xpc_connection_call_event_handler + 64

9 libxpc.dylib 0x000000019515ebcc _xpc_connection_mach_event + 2156

10 libdispatch.dylib 0x0000000194f59a24 _dispatch_client_callout4 + 12

11 libdispatch.dylib 0x0000000194f5d13c _dispatch_mach_msg_invoke + 488

12 libdispatch.dylib 0x0000000194f642d0 _dispatch_queue_drain + 2004

13 libdispatch.dylib 0x0000000194f5c664 _dispatch_mach_invoke + 132

14 libdispatch.dylib 0x0000000194f642d0 _dispatch_queue_drain + 2004

15 libdispatch.dylib 0x0000000194f5ca58 _dispatch_queue_invoke + 128

16 libdispatch.dylib 0x0000000194f66314 _dispatch_root_queue_drain + 716

17 libdispatch.dylib 0x0000000194f67c48 _dispatch_worker_thread3 + 104

18 libsystem_pthread.dylib 0x0000000195139228 _pthread_wqthread + 812

19 libsystem_pthread.dylib 0x0000000195138eec start_wqthread + 0



Thread 5:

0 libsystem_kernel.dylib 0x000000019509fc78 __workq_kernreturn + 8

1 libsystem_pthread.dylib 0x00000001951392d8 _pthread_wqthread + 988

2 libsystem_pthread.dylib 0x0000000195138eec start_wqthread + 0



Thread 6:

0 libsystem_kernel.dylib 0x000000019509fc78 __workq_kernreturn + 8

1 libsystem_pthread.dylib 0x00000001951392d8 _pthread_wqthread + 988

2 libsystem_pthread.dylib 0x0000000195138eec start_wqthread + 0



Thread 4 crashed with ARM Thread State (64-bit):

x0: 0x0000000000000000 x1: 0x0000000000000000 x2: 0x0000000000000000 x3: 0x000000017006bda3

x4: 0x0000000000000001 x5: 0x0000000000000073 x6: 0x0000000000000073 x7: 0x0000000137826200

x8: 0x0000000000000000 x9: 0x0000000000000d50 x10: 0x000000013700dac8 x11: 0x0000000174071e00

x12: 0x0000000000000080 x13: 0x0000000137018800 x14: 0x0000000137800000 x15: 0x0000000000000000

x16: 0x000000018668a8ac x17: 0x000000013700dc00 x18: 0x0000000000000000 x19: 0x0000000137823000

x20: 0x000000013700e800 x21: 0x0000000000000001 x22: 0x0000000000000000 x23: 0x0000000188a7ebce

x24: 0x000000013700dbd0 x25: 0x0000000136d04bd8 x26: 0x0000000000000001 x27: 0x0000000000000011

x28: 0x0000000000000004 fp: 0x00000001002930d0 lr: 0x0000000188a5f3cc

sp: 0x0000000100293070 pc: 0x000000018668a8ac cpsr: 0x40000000



Binary Images:

0x10006c000 - 0x10006ffff MTLCompilerService arm64 <4a749877bd093a8da0b336d99b6de5a1> /System/Library/Frameworks/Metal.framework/XPCServices/MTLCompilerService.xpc/MTLCompilerService

0x1200a4000 - 0x1200cbfff dyld arm64 <de589e6153453237a6cf724cb236d83c> /usr/lib/dyld

0x1828a0000 - 0x182ab6fff CFNetwork arm64 <7bbb801481353aafaa7c6afccc74df63> /System/Library/Frameworks/CFNetwork.framework/CFNetwork

0x182e58000 - 0x1831b6fff CoreFoundation arm64 <72f7e261b2ec35e39e44417e4d77a241> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation

0x183d8c000 - 0x183fe4fff Foundation arm64 <2a3175fa0a68365185275bdb7cbfa05e> /System/Library/Frameworks/Foundation.framework/Foundation

0x18412c000 - 0x184197fff IOKit arm64 <93f08e651bc8323b961363e1f750679a> /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit

0x185bfc000 - 0x186c15fff libLLVMContainer.dylib arm64 <0fd2cf30cded381db2299f35d443db7f> /System/Library/Frameworks/OpenGLES.framework/libLLVMContainer.dylib

0x18773c000 - 0x18779cfff Security arm64 <a163bf89604b3c9fa3faacaf6705da01> /System/Library/Frameworks/Security.framework/Security

0x187970000 - 0x1879e3fff SystemConfiguration arm64 <04aaeaf32285398ba5a7e201c59ae353> /System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration

0x188a18000 - 0x188a7efff AGXCompilerCore arm64 <6a98abe7945933edb840567199e44527> /System/Library/PrivateFrameworks/AGXCompilerCore.framework/AGXCompilerCore

0x18d094000 - 0x18d0acfff MTLCompiler arm64 <06f1f0af4d1638a68dee3470b6f73e3f> /System/Library/PrivateFrameworks/MTLCompiler.framework/MTLCompiler

0x193bcc000 - 0x193be7fff libCRFSuite.dylib arm64 <5f450ea89bdc3d1eb2000a5671b0b5b9> /usr/lib/libCRFSuite.dylib

0x193d88000 - 0x193da2fff libMobileGestalt.dylib arm64 <95aecd87670331078a0a0c4df241af01> /usr/lib/libMobileGestalt.dylib

0x193dd4000 - 0x193dd5fff libSystem.B.dylib arm64 <c8f384fcfb6030eab8a9801af2699c9a> /usr/lib/libSystem.B.dylib

0x193fd0000 - 0x193ffafff libarchive.2.dylib arm64 <4f80675864fc33049be3044502d3cd96> /usr/lib/libarchive.2.dylib

0x19403c000 - 0x19404cfff libbsm.0.dylib arm64 <7a4012e91967351ea55f4cb6fad6a2e9> /usr/lib/libbsm.0.dylib

0x194050000 - 0x194060fff libbz2.1.0.dylib arm64 <3efd86b180f7329e8ea1e515fadb35c8> /usr/lib/libbz2.1.0.dylib

0x194064000 - 0x1940bafff libc++.1.dylib arm64 <69e62bc31eba32e591fa49ae45064642> /usr/lib/libc++.1.dylib

0x1940bc000 - 0x1940defff libc++abi.dylib arm64 <37e33decd1ee3219bc23680232b92729> /usr/lib/libc++abi.dylib

0x19413c000 - 0x194159fff libextension.dylib arm64 <d9c9d65b303f37e6a2bd3992c215f5f4> /usr/lib/libextension.dylib

0x194284000 - 0x19446bfff libicucore.A.dylib arm64 <0865e2749f213f1ca36e9d2645f8b29a> /usr/lib/libicucore.A.dylib

0x194480000 - 0x194481fff liblangid.dylib arm64 <beb1b98c290835998ee303e5f51e1647> /usr/lib/liblangid.dylib

0x194494000 - 0x1944adfff liblzma.5.dylib arm64 <b8e2d8c335b73e9b929efb2dbf9e3fa8> /usr/lib/liblzma.5.dylib

0x1948d4000 - 0x194ad0fff libobjc.A.dylib arm64 <7ffbdd0399053da98cabd7c7737a12bf> /usr/lib/libobjc.A.dylib

0x194c30000 - 0x194d0efff libsqlite3.dylib arm64 <f396c1e038653515ac519fd5f06cced2> /usr/lib/libsqlite3.dylib

0x194da8000 - 0x194e96fff libxml2.2.dylib arm64 <df52bf63916d3eacba12226725afa860> /usr/lib/libxml2.2.dylib

0x194ec4000 - 0x194ed5fff libz.1.dylib arm64 <fe4d22c005983c9182d08fbdd35da43b> /usr/lib/libz.1.dylib

0x194ed8000 - 0x194edcfff libcache.dylib arm64 <99b0e521cc4b39aa846c3a364d3ef53b> /usr/lib/system/libcache.dylib

0x194ee0000 - 0x194eecfff libcommonCrypto.dylib arm64 <9115f30c02b73d67b8b7606b3461a51e> /usr/lib/system/libcommonCrypto.dylib

0x194ef0000 - 0x194ef3fff libcompiler_rt.dylib arm64 <18cf33250509384591474406ab5775e2> /usr/lib/system/libcompiler_rt.dylib

0x194ef4000 - 0x194efbfff libcopyfile.dylib arm64 <f906ee12512230f49ff254f8bc2ac6e8> /usr/lib/system/libcopyfile.dylib

0x194efc000 - 0x194f56fff libcorecrypto.dylib arm64 <6ad40e2907ad3485abdf0cd7e256fb2d> /usr/lib/system/libcorecrypto.dylib

0x194f58000 - 0x194f80fff libdispatch.dylib arm64 <d71cea387505363e97275b4106c771a6> /usr/lib/system/libdispatch.dylib

0x194f84000 - 0x194f86fff libdyld.dylib arm64 <8a1a5fbff16b35998764bbcc85da4300> /usr/lib/system/libdyld.dylib

0x194f88000 - 0x194f88fff liblaunch.dylib arm64 <3e2f385d96603a07a072d2a36c8d13aa> /usr/lib/system/liblaunch.dylib

0x194f8c000 - 0x194f91fff libmacho.dylib arm64 <6dc400b009e834719534acddc6ea4e6f> /usr/lib/system/libmacho.dylib

0x194f94000 - 0x194f95fff libremovefile.dylib arm64 <97b4b3a0ceda34eba0381166e144d6b0> /usr/lib/system/libremovefile.dylib

0x194f98000 - 0x194fadfff libsystem_asl.dylib arm64 <0b8c9605e76330f8a09cb0c07a6f48a7> /usr/lib/system/libsystem_asl.dylib

0x194fb0000 - 0x194fb1fff libsystem_blocks.dylib arm64 <897a97cc50d33fb78932c91785615e6b> /usr/lib/system/libsystem_blocks.dylib

0x194fb4000 - 0x195034fff libsystem_c.dylib arm64 <f771fa3fb6c53d0b973d5f23d9f074f3> /usr/lib/system/libsystem_c.dylib

0x195038000 - 0x19503afff libsystem_configuration.dylib arm64 <ca93ae6f1d0a34aa90989c804813312f> /usr/lib/system/libsystem_configuration.dylib

0x19503c000 - 0x19503dfff libsystem_coreservices.dylib arm64 <cd7ac3a518883c388d6180aca4f00c1e> /usr/lib/system/libsystem_coreservices.dylib

0x195040000 - 0x195050fff libsystem_coretls.dylib arm64 <67cce27ba556375c9783f51dc9b72060> /usr/lib/system/libsystem_coretls.dylib

0x195054000 - 0x19505cfff libsystem_dnssd.dylib arm64 <9a4f31aff83a3047b6153730b5c9520c> /usr/lib/system/libsystem_dnssd.dylib

0x195060000 - 0x195081fff libsystem_info.dylib arm64 <4ea83ee1bbcc33768e97512e3e993902> /usr/lib/system/libsystem_info.dylib

0x195084000 - 0x1950a4fff libsystem_kernel.dylib arm64 <7cf1497db6fc3183a0a1727c91f6b2ed> /usr/lib/system/libsystem_kernel.dylib

0x1950a8000 - 0x1950c4fff libsystem_m.dylib arm64 <cf62c29de6f03c7da503cb29a773a91e> /usr/lib/system/libsystem_m.dylib

0x1950c8000 - 0x1950e1fff libsystem_malloc.dylib arm64 <17c1054b47713b468db7660b20a7e56d> /usr/lib/system/libsystem_malloc.dylib

0x1950e4000 - 0x19511bfff libsystem_network.dylib arm64 <c534ddf64b3d3c38ad39eb64bcfa2345> /usr/lib/system/libsystem_network.dylib

0x19511c000 - 0x195122fff libsystem_networkextension.dylib arm64 <c15cfb4c42f63f849d72a3bdaa6d9af5> /usr/lib/system/libsystem_networkextension.dylib

0x195124000 - 0x19512efff libsystem_notify.dylib arm64 <f0228fae1f2e3bfcaeaaaba371da25c7> /usr/lib/system/libsystem_notify.dylib

0x195130000 - 0x195134fff libsystem_platform.dylib arm64 <1a17d7e559c83b0a8059e81c2978eef2> /usr/lib/system/libsystem_platform.dylib

0x195138000 - 0x195140fff libsystem_pthread.dylib arm64 <763451c05a4c32399f3295b04ff2de35> /usr/lib/system/libsystem_pthread.dylib

0x195144000 - 0x195146fff libsystem_sandbox.dylib arm64 <ff3a96b469e23dc485e14bf4c35b61dc> /usr/lib/system/libsystem_sandbox.dylib

0x195148000 - 0x19514bfff libsystem_stats.dylib arm64 <fc1f75dbe19b32a682edd3d4ff71146b> /usr/lib/system/libsystem_stats.dylib

0x19514c000 - 0x195152fff libsystem_trace.dylib arm64 <9040ad96fea73033b74de4dbb4846020> /usr/lib/system/libsystem_trace.dylib

0x195154000 - 0x195159fff libunwind.dylib arm64 <8b87982b31ad3569a95e75457cadba3e> /usr/lib/system/libunwind.dylib

0x19515c000 - 0x19517ffff libxpc.dylib arm64 <c9f3c08a8a3b3849a905d24911240853> /usr/lib/system/libxpc.dylib

Sadly, that's looks like it's most likely caused by the Metal compiler crashing. Can you file a bug report (at bugreport.apple.com), and include the shader source (if you can), and any other relevant information?

Thanks for the response.


Filed as bug report #21798442.


...Bill

Runtime shader compiler crash & compiler connection failed error
 
 
Q