[GLKView display] method crashes at [GLKView _createFramebuffer]

Number:rdar://37956262 Date Originated:
Status:Open Resolved:
Product:iOS SDK Product Version:11.2.1
Classification:Bug Reproducible:Sometimes
Starting iOS 11, we started to notice crashes while calling draw method on the GLKView. We've made sure to create GLKView instance, and EAGLContext properly and make sure the same thread is used for drawing. Going through the crash logs, it seems this crash is happening during the setup phase. Specifically, this crash is happening during the call to [GLKView _createFramebuffer] method. The reason for the crash seems to be related to an assertion failure( MTLReleaseAssertionFailure) inside the method GLDTextureRec::allocMetalTexture(). Below is the stack trace from the crash log.

Incident Identifier: B65D4E07-0CB4-4EBA-BA2C-345C30A01F59
CrashReporter Key:   B5867591-89C7-4695-A066-580FAD9792C2
Hardware Model:      iPhone10,6
Process:         * [233]
Path:            /var/containers/Bundle/Application/*/*.app/*
Identifier:      com.***
Version:         4.2.1 (4200)
Code Type:       ARM-64
Parent Process:  ??? [1]

Date/Time:       2018-02-27T20:25:23Z
Launch Time:     2018-02-27T18:34:14Z
OS Version:      iPhone OS 11.2.1 (15C153)
Report Version:  104

Exception Type:  SIGABRT
Exception Codes: #0 at 0x182c042e8
Crashed Thread:  0

Thread 0 Crashed:
0   libsystem_kernel.dylib               0x0000000182c042e8 __pthread_kill + 8
1   libsystem_pthread.dylib              0x0000000182d1d748 pthread_kill$VARIANT$armv81 + 356
2   libsystem_c.dylib                    0x0000000182b72fbc abort + 136
3   Metal                                0x0000000184e15a9c MTLReleaseAssertionFailure + 268
4   AppleMetalGLRenderer                 0x00000001a269af18 GLDTextureRec::allocMetalTexture() + 724
5   AppleMetalGLRenderer                 0x00000001a269b010 GLDTextureRec::loadPrivateTexture(unsigned int, unsigned short*) + 52
6   AppleMetalGLRenderer                 0x00000001a269917c GLDTextureRec::update(unsigned int, unsigned short*) + 164
7   AppleMetalGLRenderer                 0x00000001a2695e98 GLDFramebufferRec::load() + 124
8   AppleMetalGLRenderer                 0x00000001a2696224 gldLoadFramebuffer + 12
9   GLEngine                             0x00000001a345e84c gleCheckFramebufferStatus + 112
10  GLEngine                             0x00000001a340bb44 glCheckFramebufferStatusEXT_Exec + 120
11  GLKit                                0x000000018feef330 -[GLKView _createFramebuffer] + 1144
12  GLKit                                0x000000018feef660 -[GLKView _setFramebuffer:] + 128
13  GLKit                                0x000000018feef8ac -[GLKView _display:] + 84
14  *****                     0x0000000102200270 -[***** drawShapes:] (****:361)


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!