EXC_BAD_ACCESS in [MTLDebugTexture removeUsedRenderTarget:slices:]

Fresh, clean build from Xcode12 Beta 5 and Beta 6 produce this crash repeatedly when returning from the background. So far only tested on simulator.

I've googled around but see no mention of this class anywhere. This wasn't happening in Xcode11.

Anyone have any thoughts?
Sorry I don't have an answer, but a related crash started for me in Beta 5 and remains a problem in Beta 6. I have a UIViewRepresentable in a slide-over view I'm bringing up from the bottom. It works on some views but crashes consistently on another

libc++abi.dylib: terminating with uncaught exception of type NSException
  • ** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MTLDebugRenderPipelineState removeUsedRenderTarget:slices:]: unrecognized selector sent to instance 0x7ff22b510800'

Hey Jon thanks for the input. Unfortunately I haven’t looked into this anymore, except that I can confirm it only happens on the simulator.

I loaded iOS 14 onto a test device and it has not crashed at all, but especially not with this strange reason.

hope yours isn’t affecting the real runtime too!
I have the same issue in macOS. while resizing the window with mapview, it crashes showing thread EXC_BAD_INSTRUCTION (CODE=EXC_I386_INVOP,subcode=0x0).

my app has crashed and has been rejected during review. so I'm thinking of disabling the resize option
I have also tried with just the storyboard and auto layout without connecting it to code. still crashes
The MTLDebug classes should only be called when Metal Validation is enabled (in Xcode or with the MTLDEBUGLAYER env var set). It would be atypical for an app to have this enabled when a user runs an app. That said, this crash is probably a bug somewhere in the Metal framework's validation layer so please create a request via Feedback Assistant (If you repost the FB number here we may be able to diagnose this more quickly).

I'm wondering if you're seeing issue when the validation layer is disabled?


Also arnoldrebello, it's not clear to me that you're seeing the same problem as the original poster since you're getting a different error code. Is the crashing stack also in a MTLDebug method?
I have the same issue. I got the following message: [MTLDebugTexture removeUsedRenderTarget:slices:]: message sent to deallocated instance 0x13179f4c0. Metal API validation was enabled. I disabled it and did some testing and was not able to reproduce the bug. After turning on Metal API validation again, the bug was there again after a couple of tests.

Edit: It started when I starting using NavigationView in my app (I was managing navigation without it before). I am wondering if it has to do with that.

Ana0209,

It makes sense that this would only occur when validation is enabled since the MTLDebugTexture class only gets instantiated when enabled. I don't think running into this bug will have consequences for your users, since they won't run with this validation layer enabled.

This does sound like a bug in that layer though. I think that a texture that your app not longer references directly, but is used in a command buffer is getting free'd after that command buffer completes and there is some validation code executed which assumes the texture is still alive. As a workaround you can keep your textures alive (refcount >= 1 in MMR or hold a strong reference to a texture until any command buffers using this texture have all completed execution. This could be a annoying workaround to implement just to keep the validation layer happy.

If you create a request via Feedback Assistant with a reproducer we could look at it.



EXC_BAD_ACCESS in [MTLDebugTexture removeUsedRenderTarget:slices:]
 
 
Q