Application freezes on glTexImage2D

My application freezes on a call to glTexImage2D, this is the stack trace I get from the lldb:

thread #3
    frame #0: 0x00000001bb04d9b4 libsystem_kernel.dylib`mach_msg_trap + 8
    frame #1: 0x00000001bb04dd60 libsystem_kernel.dylib`mach_msg + 76
    frame #2: 0x00000001bdb28dd0 IOKit`io_connect_method + 440
    frame #3: 0x00000001bdb28bec IOKit`IOConnectCallMethod + 236
    frame #4: 0x00000001d5b1b970 IOGPU`IOGPUResourceCreate + 224
    frame #5: 0x00000001d5b159f8 IOGPU`-[IOGPUMetalResource initWithDevice:remoteStorageResource:options:args:argsSize:] + 476
    frame #6: 0x00000001d5b18ab8 IOGPU`-[IOGPUMetalTexture initWithBuffer:descriptor:sysMemOffset:sysMemRowBytes:vidMemSize:vidMemRowBytes:args:argsSize:isStrideTexture:] + 616
    frame #7: 0x00000001d5b1925c IOGPU`-[IOGPUMetalTexture initWithPrimaryBuffer:heapIndex:bufferIndex:bufferOffset:length:descriptor:sysMemRowBytes:vidMemSize:vidMemRowBytes:args:argsSize:] + 96
    frame #8: 0x000000021c45bc10 AGXMetal13_3`___lldb_unnamed_symbol4663$$AGXMetal13_3 + 468
    frame #9: 0x0000000133953aa8 AppleMetalOpenGLRenderer`GLDTextureRec::loadObj() + 3156
    frame #10: 0x000000013398a960 AppleMetalOpenGLRenderer`gldModifyTexSubImage + 160
    frame #11: 0x000000021bd9a7e8 GLEngine`glTexImage2D_Exec + 1944
    frame #12: 0x000000021bd7b8d0 libGL.dylib`glTexImage2D + 80

My questions are: how could a call to glTexImage2D freezes and cause the thread stuck forever? Why and how to solve it?

Thank you in advance, and looking forward to any suggestions

For this, please open an issue with Feedback Assistant and attach a sysdiagnose of the app in the hung state.

However, please note OpenGL was deprecated in macOS 10.14. To create high-performance code on GPUs, use the Metal framework instead.

I'm having the same issue, any updates?

I don't see any updates on the bug report that was filed. Do you know the approximate size of your texture? Is there any way you could make it larger? I saw an internal discussion that small texture allocation takes a different code path from large ones, so see if changing the texture size does anything. But since OpenGL is deprecated, I don't know how likely it is that this will be fixed.

It would be highly appreciated if this can be fixed. We discovered the issue in https://github.com/golang/go/issues/48434. Migrating to Metal would require reworking the entire ecosystem which won't be possible at the moment.

Since this issue is blocking the entire refresh mechanism, the application is not usable at all, which prevents us to grow our usage on Mac and iOS devices.

Thoughts?

Application freezes on glTexImage2D
 
 
Q