Skip to content

App crashes on iOS: SIGABRT _status < MTLCommandBufferStatusCommitted > -[IOGPUMetalCommandBuffer setCurrentCommandEncoder:] #76068

@danielSafeNow

Description

@danielSafeNow

Hello everyone!

We experience some very concerning crashes in the last months on iOS apps deployed to TestFlight only so far.
The closest issue we found when searching for solutions is #69102 and since this was closed some days ago with @pedromassangocode mentioning to please file a new issue if someone has the same issue.

While I can't really provide minimal code to recreate the issue at this moment I might be able to deliver some insights:

  • For us the crash appears almost exclusively while the app is in the background
  • The app uses flutter_background_geolocation to track locations in the background (which allows the app to be activated from the background)
  • The app is furthermore displaying a map through flutter_map, using raster tiles from Mapbox
  • The influence of the map itself we could already verify to be rather minimal as we removed these in a test version and still had the crashes appear.
  • We also see the problems described in #64558
  • A pretty easy way to reproduce it for our code was to have the app running in the background while driving by car

The app crashed on different devices (iPhon 6s, iPhone 8, iPhone X, iPhone 11, iPhone 12 mini) with OS versions ranging from 14.2 - 14.4

crash log 1
Thread 4 name:
Thread 4 Crashed:
0   libsystem_kernel.dylib        	0x00000001c8ac084c __pthread_kill + 8
1   libsystem_pthread.dylib       	0x00000001e53069e8 pthread_kill + 212 (pthread.c:1388)
2   libsystem_c.dylib             	0x00000001a594f8f4 abort + 100 (abort.c:110)
3   Metal                         	0x00000001b26c5b84 MTLReleaseAssertionFailure + 216 (MTLDebug.mm:57)
4   IOGPU                         	0x00000001d76aed6c -[IOGPUMetalCommandBuffer setCurrentCommandEncoder:] + 240 (IOGPUMetalCommandBuffer.m:300)
5   Metal                         	0x00000001b26b64dc -[_MTLCommandEncoder initWithCommandBuffer:] + 880 (MTLCommandEncoder.m:91)
6   IOGPU                         	0x00000001d76b08a4 -[IOGPUMetalCommandEncoder initWithCommandBuffer:] + 52 (IOGPUMetalCommandEncoder.mm:17)
7   AGXMetalA11                   	0x00000001e63827bc -[AGXA11FamilyBlitContext initWithCommandBuffer:descriptor:] + 56 (agxa_blit_objc.mm:34)
8   AGXMetalA11                   	0x00000001e639cf7c -[AGXA11FamilyCommandBuffer blitCommandEncoder] + 84 (agxa_command_buffer_objc.mm:251)
9   Flutter                       	0x00000001007af114 GrMtlCommandBuffer::getBlitCommandEncoder() (in Flutter) (GrMtlCommandBuffer.mm:45)
10  Flutter                       	0x00000001007b21c4 GrMtlGpu::onWritePixels(GrSurface*, int, int, int, int, GrColorType, GrColorType, GrMipLevel const*, int, bool) (in Flutter) (GrMtlGpu.mm:1205)
11  Flutter                       	0x00000001006c3e64 GrGpu::writePixels(GrSurface*, int, int, int, int, GrColorType, GrColorType, GrMipLevel const*, int, bool) (in Flutter) (GrGpu.cpp:465)
12  Flutter                       	0x00000001006c3ac4 GrGpu::createTexture(SkISize, GrBackendFormat const&, GrRenderable, int, SkBudgeted, GrProtected, GrColorType, GrColorType, GrMipLevel const*, int) (in Flutter) (GrGpu.cpp:205)
13  Flutter                       	0x00000001006e1a44 GrResourceProvider::createTexture(SkISize, GrBackendFormat const&, GrColorType, GrRenderable, int, SkBudgeted, GrProtected, GrMipLevel const*, int) (in Flutter) (GrResourceProvider.cpp:89)
14  Flutter                       	0x00000001006cf6d4 std::__1::__function::__func<GrProxyProvider::createMippedProxyFromBitmap(SkBitmap const&, SkBudgeted)::$_1, std::__1::allocator<GrProxyProvider::createMippedProxyFromBitmap(SkBitmap const&, SkBudgeted)::$_1>, GrSurfaceProxy::LazyCallbackResult (GrResourceProvider*, GrSurfaceProxy::LazySurfaceDesc const&)>::operator()(GrResourceProvider*&&, GrSurfaceProxy::LazySurfaceDesc const&) (in Flutter) (functional:1651)
15  Flutter                       	0x00000001006ed0b4 GrSurfaceProxyPriv::doLazyInstantiation(GrResourceProvider*) (in Flutter) (GrSurfaceProxy.cpp:376)
16  Flutter                       	0x00000001006cf2b0 GrProxyProvider::createProxyFromBitmap(SkBitmap const&, GrMipmapped, SkBackingFit, SkBudgeted) (in Flutter) (GrProxyProvider.cpp:305)
17  Flutter                       	0x00000001006ac4b4 GrBitmapTextureMaker::refOriginalTextureProxyView(GrMipmapped) (in Flutter) (GrBitmapTextureMaker.cpp:90)
18  Flutter                       	0x0000000100764aa4 SkImage::MakeCrossContextFromPixmap(GrDirectContext*, SkPixmap const&, bool, bool) (in Flutter) (SkImage_Gpu.cpp:638)
19  Flutter                       	0x00000001008ab660 std::__1::__function::__func<flutter::UploadRasterImage(sk_sp<SkImage>, fml::WeakPtr<flutter::IOManager>, fml::tracing::TraceFlow const&)::$_3, std::__1::allocator<flutter::UploadRasterImage(sk_sp<SkImage>, fml::WeakPtr<flutter::IOManager>, fml::tracing::TraceFlow const&)::$_3>, void ()>::operator()() (in Flutter) (functional:1651)
20  Flutter                       	0x0000000100544748 fml::SyncSwitch::Execute(fml::SyncSwitch::Handlers const&) (in Flutter) (sync_switch.cc:32)
21  Flutter                       	0x00000001008aaf40 std::__1::__function::__func<fml::internal::CopyableLambda<flutter::ImageDecoder::Decode(fml::RefPtr<flutter::ImageDescriptor>, unsigned int, unsigned int, std::__1::function<void (flutter::SkiaGPUObject<SkImage>)> const&)::$_1::operator()()::'lambda'()>, std::__1::allocator<fml::internal::CopyableLambda<flutter::ImageDecoder::Decode(fml::RefPtr<flutter::ImageDescriptor>, unsigned int, unsigned int, std::__1::function<void (flutter::SkiaGPUObject<SkImage>)> const&)::$_1::operator()()::'lambda'()> >, void ()>::operator()() (in Flutter) (functional:1651)
22  Flutter                       	0x000000010054342c fml::MessageLoopImpl::FlushTasks(fml::FlushType) (in Flutter) (message_loop_impl.cc:132)
23  Flutter                       	0x00000001005453a0 fml::MessageLoopDarwin::OnTimerFire(__CFRunLoopTimer*, fml::MessageLoopDarwin*) (in Flutter) (message_loop_darwin.mm:76)
24  CoreFoundation                	0x000000019cbe23e0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 28 (CFRunLoop.c:1807)
25  CoreFoundation                	0x000000019cbe1fe4 __CFRunLoopDoTimer + 1004 (CFRunLoop.c:2415)
26  CoreFoundation                	0x000000019cbe14c4 __CFRunLoopDoTimers + 324 (CFRunLoop.c:2575)
27  CoreFoundation                	0x000000019cbdb850 __CFRunLoopRun + 1912 (CFRunLoop.c:3090)
28  CoreFoundation                	0x000000019cbdaba0 CFRunLoopRunSpecific + 572 (CFRunLoop.c:3242)
29  Flutter                       	0x000000010054527c 0x100508000 + 250492
30  Flutter                       	0x0000000100544c04 0x100508000 + 248836
31  libsystem_pthread.dylib       	0x00000001e5305b3c _pthread_start + 288 (pthread.c:881)
32  libsystem_pthread.dylib       	0x00000001e530a880 thread_start + 8
crash log 2
Thread 4 name:
Thread 4 Crashed:
0   libsystem_kernel.dylib        	0x00000001c8ac084c __pthread_kill + 8
1   libsystem_pthread.dylib       	0x00000001e53069e8 pthread_kill + 212 (pthread.c:1388)
2   libsystem_c.dylib             	0x00000001a594f8f4 abort + 100 (abort.c:110)
3   Metal                         	0x00000001b26c5b84 MTLReleaseAssertionFailure + 216 (MTLDebug.mm:57)
4   IOGPU                         	0x00000001d76aed6c -[IOGPUMetalCommandBuffer setCurrentCommandEncoder:] + 240 (IOGPUMetalCommandBuffer.m:300)
5   Metal                         	0x00000001b26b64dc -[_MTLCommandEncoder initWithCommandBuffer:] + 880 (MTLCommandEncoder.m:91)
6   IOGPU                         	0x00000001d76b08a4 -[IOGPUMetalCommandEncoder initWithCommandBuffer:] + 52 (IOGPUMetalCommandEncoder.mm:17)
7   AGXMetalA11                   	0x00000001e63827bc -[AGXA11FamilyBlitContext initWithCommandBuffer:descriptor:] + 56 (agxa_blit_objc.mm:34)
8   AGXMetalA11                   	0x00000001e639cf7c -[AGXA11FamilyCommandBuffer blitCommandEncoder] + 84 (agxa_command_buffer_objc.mm:251)
9   Flutter                       	0x000000010324b114 GrMtlCommandBuffer::getBlitCommandEncoder() (in Flutter) (GrMtlCommandBuffer.mm:45)
10  Flutter                       	0x000000010324e1c4 GrMtlGpu::onWritePixels(GrSurface*, int, int, int, int, GrColorType, GrColorType, GrMipLevel const*, int, bool) (in Flutter) (GrMtlGpu.mm:1205)
11  Flutter                       	0x000000010315fe64 GrGpu::writePixels(GrSurface*, int, int, int, int, GrColorType, GrColorType, GrMipLevel const*, int, bool) (in Flutter) (GrGpu.cpp:465)
12  Flutter                       	0x000000010315fac4 GrGpu::createTexture(SkISize, GrBackendFormat const&, GrRenderable, int, SkBudgeted, GrProtected, GrColorType, GrColorType, GrMipLevel const*, int) (in Flutter) (GrGpu.cpp:205)
13  Flutter                       	0x000000010317da44 GrResourceProvider::createTexture(SkISize, GrBackendFormat const&, GrColorType, GrRenderable, int, SkBudgeted, GrProtected, GrMipLevel const*, int) (in Flutter) (GrResourceProvider.cpp:89)
14  Flutter                       	0x000000010316b6d4 std::__1::__function::__func<GrProxyProvider::createMippedProxyFromBitmap(SkBitmap const&, SkBudgeted)::$_1, std::__1::allocator<GrProxyProvider::createMippedProxyFromBitmap(SkBitmap const&, SkBudgeted)::$_1>, GrSurfaceProxy::LazyCallbackResult (GrResourceProvider*, GrSurfaceProxy::LazySurfaceDesc const&)>::operator()(GrResourceProvider*&&, GrSurfaceProxy::LazySurfaceDesc const&) (in Flutter) (functional:1651)
15  Flutter                       	0x00000001031890b4 GrSurfaceProxyPriv::doLazyInstantiation(GrResourceProvider*) (in Flutter) (GrSurfaceProxy.cpp:376)
16  Flutter                       	0x000000010316b2b0 GrProxyProvider::createProxyFromBitmap(SkBitmap const&, GrMipmapped, SkBackingFit, SkBudgeted) (in Flutter) (GrProxyProvider.cpp:305)
17  Flutter                       	0x00000001031484b4 GrBitmapTextureMaker::refOriginalTextureProxyView(GrMipmapped) (in Flutter) (GrBitmapTextureMaker.cpp:90)
18  Flutter                       	0x0000000103200aa4 SkImage::MakeCrossContextFromPixmap(GrDirectContext*, SkPixmap const&, bool, bool) (in Flutter) (SkImage_Gpu.cpp:638)
19  Flutter                       	0x0000000103347660 std::__1::__function::__func<flutter::UploadRasterImage(sk_sp<SkImage>, fml::WeakPtr<flutter::IOManager>, fml::tracing::TraceFlow const&)::$_3, std::__1::allocator<flutter::UploadRasterImage(sk_sp<SkImage>, fml::WeakPtr<flutter::IOManager>, fml::tracing::TraceFlow const&)::$_3>, void ()>::operator()() (in Flutter) (functional:1651)
20  Flutter                       	0x0000000102fe0748 fml::SyncSwitch::Execute(fml::SyncSwitch::Handlers const&) (in Flutter) (sync_switch.cc:32)
21  Flutter                       	0x0000000103346f40 std::__1::__function::__func<fml::internal::CopyableLambda<flutter::ImageDecoder::Decode(fml::RefPtr<flutter::ImageDescriptor>, unsigned int, unsigned int, std::__1::function<void (flutter::SkiaGPUObject<SkImage>)> const&)::$_1::operator()()::'lambda'()>, std::__1::allocator<fml::internal::CopyableLambda<flutter::ImageDecoder::Decode(fml::RefPtr<flutter::ImageDescriptor>, unsigned int, unsigned int, std::__1::function<void (flutter::SkiaGPUObject<SkImage>)> const&)::$_1::operator()()::'lambda'()> >, void ()>::operator()() (in Flutter) (functional:1651)
22  Flutter                       	0x0000000102fdf42c fml::MessageLoopImpl::FlushTasks(fml::FlushType) (in Flutter) (message_loop_impl.cc:132)
23  Flutter                       	0x0000000102fe13a0 fml::MessageLoopDarwin::OnTimerFire(__CFRunLoopTimer*, fml::MessageLoopDarwin*) (in Flutter) (message_loop_darwin.mm:76)
24  CoreFoundation                	0x000000019cbe23e0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 28 (CFRunLoop.c:1807)
25  CoreFoundation                	0x000000019cbe1fe4 __CFRunLoopDoTimer + 1004 (CFRunLoop.c:2415)
26  CoreFoundation                	0x000000019cbe14c4 __CFRunLoopDoTimers + 324 (CFRunLoop.c:2575)
27  CoreFoundation                	0x000000019cbdb850 __CFRunLoopRun + 1912 (CFRunLoop.c:3090)
28  CoreFoundation                	0x000000019cbdaba0 CFRunLoopRunSpecific + 572 (CFRunLoop.c:3242)
29  Flutter                       	0x0000000102fe127c 0x102fa4000 + 250492
30  Flutter                       	0x0000000102fe0c04 0x102fa4000 + 248836
31  libsystem_pthread.dylib       	0x00000001e5305b3c _pthread_start + 288 (pthread.c:881)
32  libsystem_pthread.dylib       	0x00000001e530a880 thread_start + 8
crash log 3
Thread 4 name:
Thread 4 Crashed:
0   libsystem_kernel.dylib        	0x00000001c8ac084c __pthread_kill + 8
1   libsystem_pthread.dylib       	0x00000001e53069e8 pthread_kill + 212 (pthread.c:1388)
2   libsystem_c.dylib             	0x00000001a594f8f4 abort + 100 (abort.c:110)
3   Metal                         	0x00000001b26c5b84 MTLReleaseAssertionFailure + 216 (MTLDebug.mm:57)
4   IOGPU                         	0x00000001d76aed6c -[IOGPUMetalCommandBuffer setCurrentCommandEncoder:] + 240 (IOGPUMetalCommandBuffer.m:300)
5   Metal                         	0x00000001b26b64dc -[_MTLCommandEncoder initWithCommandBuffer:] + 880 (MTLCommandEncoder.m:91)
6   IOGPU                         	0x00000001d76b08a4 -[IOGPUMetalCommandEncoder initWithCommandBuffer:] + 52 (IOGPUMetalCommandEncoder.mm:17)
7   AGXMetalA11                   	0x00000001e63827bc -[AGXA11FamilyBlitContext initWithCommandBuffer:descriptor:] + 56 (agxa_blit_objc.mm:34)
8   AGXMetalA11                   	0x00000001e639cf7c -[AGXA11FamilyCommandBuffer blitCommandEncoder] + 84 (agxa_command_buffer_objc.mm:251)
9   Flutter                       	0x000000010324b114 GrMtlCommandBuffer::getBlitCommandEncoder() (in Flutter) (GrMtlCommandBuffer.mm:45)
10  Flutter                       	0x000000010324e1c4 GrMtlGpu::onWritePixels(GrSurface*, int, int, int, int, GrColorType, GrColorType, GrMipLevel const*, int, bool) (in Flutter) (GrMtlGpu.mm:1205)
11  Flutter                       	0x000000010315fe64 GrGpu::writePixels(GrSurface*, int, int, int, int, GrColorType, GrColorType, GrMipLevel const*, int, bool) (in Flutter) (GrGpu.cpp:465)
12  Flutter                       	0x000000010315fac4 GrGpu::createTexture(SkISize, GrBackendFormat const&, GrRenderable, int, SkBudgeted, GrProtected, GrColorType, GrColorType, GrMipLevel const*, int) (in Flutter) (GrGpu.cpp:205)
13  Flutter                       	0x000000010317da44 GrResourceProvider::createTexture(SkISize, GrBackendFormat const&, GrColorType, GrRenderable, int, SkBudgeted, GrProtected, GrMipLevel const*, int) (in Flutter) (GrResourceProvider.cpp:89)
14  Flutter                       	0x000000010316b6d4 std::__1::__function::__func<GrProxyProvider::createMippedProxyFromBitmap(SkBitmap const&, SkBudgeted)::$_1, std::__1::allocator<GrProxyProvider::createMippedProxyFromBitmap(SkBitmap const&, SkBudgeted)::$_1>, GrSurfaceProxy::LazyCallbackResult (GrResourceProvider*, GrSurfaceProxy::LazySurfaceDesc const&)>::operator()(GrResourceProvider*&&, GrSurfaceProxy::LazySurfaceDesc const&) (in Flutter) (functional:1651)
15  Flutter                       	0x00000001031890b4 GrSurfaceProxyPriv::doLazyInstantiation(GrResourceProvider*) (in Flutter) (GrSurfaceProxy.cpp:376)
16  Flutter                       	0x000000010316b2b0 GrProxyProvider::createProxyFromBitmap(SkBitmap const&, GrMipmapped, SkBackingFit, SkBudgeted) (in Flutter) (GrProxyProvider.cpp:305)
17  Flutter                       	0x00000001031484b4 GrBitmapTextureMaker::refOriginalTextureProxyView(GrMipmapped) (in Flutter) (GrBitmapTextureMaker.cpp:90)
18  Flutter                       	0x0000000103200aa4 SkImage::MakeCrossContextFromPixmap(GrDirectContext*, SkPixmap const&, bool, bool) (in Flutter) (SkImage_Gpu.cpp:638)
19  Flutter                       	0x0000000103347660 std::__1::__function::__func<flutter::UploadRasterImage(sk_sp<SkImage>, fml::WeakPtr<flutter::IOManager>, fml::tracing::TraceFlow const&)::$_3, std::__1::allocator<flutter::UploadRasterImage(sk_sp<SkImage>, fml::WeakPtr<flutter::IOManager>, fml::tracing::TraceFlow const&)::$_3>, void ()>::operator()() (in Flutter) (functional:1651)
20  Flutter                       	0x0000000102fe0748 fml::SyncSwitch::Execute(fml::SyncSwitch::Handlers const&) (in Flutter) (sync_switch.cc:32)
21  Flutter                       	0x0000000103346f40 std::__1::__function::__func<fml::internal::CopyableLambda<flutter::ImageDecoder::Decode(fml::RefPtr<flutter::ImageDescriptor>, unsigned int, unsigned int, std::__1::function<void (flutter::SkiaGPUObject<SkImage>)> const&)::$_1::operator()()::'lambda'()>, std::__1::allocator<fml::internal::CopyableLambda<flutter::ImageDecoder::Decode(fml::RefPtr<flutter::ImageDescriptor>, unsigned int, unsigned int, std::__1::function<void (flutter::SkiaGPUObject<SkImage>)> const&)::$_1::operator()()::'lambda'()> >, void ()>::operator()() (in Flutter) (functional:1651)
22  Flutter                       	0x0000000102fdf42c fml::MessageLoopImpl::FlushTasks(fml::FlushType) (in Flutter) (message_loop_impl.cc:132)
23  Flutter                       	0x0000000102fe13a0 fml::MessageLoopDarwin::OnTimerFire(__CFRunLoopTimer*, fml::MessageLoopDarwin*) (in Flutter) (message_loop_darwin.mm:76)
24  CoreFoundation                	0x000000019cbe23e0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 28 (CFRunLoop.c:1807)
25  CoreFoundation                	0x000000019cbe1fe4 __CFRunLoopDoTimer + 1004 (CFRunLoop.c:2415)
26  CoreFoundation                	0x000000019cbe14c4 __CFRunLoopDoTimers + 324 (CFRunLoop.c:2575)
27  CoreFoundation                	0x000000019cbdb850 __CFRunLoopRun + 1912 (CFRunLoop.c:3090)
28  CoreFoundation                	0x000000019cbdaba0 CFRunLoopRunSpecific + 572 (CFRunLoop.c:3242)
29  Flutter                       	0x0000000102fe127c 0x102fa4000 + 250492
30  Flutter                       	0x0000000102fe0c04 0x102fa4000 + 248836
31  libsystem_pthread.dylib       	0x00000001e5305b3c _pthread_start + 288 (pthread.c:881)
32  libsystem_pthread.dylib       	0x00000001e530a880 thread_start + 8
flutter doctor
[✓] Flutter (Channel stable, 1.22.6, on macOS 11.1 20C69 darwin-x64, locale de-DE)
    • Flutter version 1.22.6 at /Users/danielulbrich/.asdf/installs/flutter/1.22.6-stable
    • Framework revision 9b2d32b605 (3 weeks ago), 2021-01-22 14:36:39 -0800
    • Engine revision 2f0af37152
    • Dart version 2.10.5


[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/danielulbrich/Library/Android/sdk
    • Platform android-30, build-tools 30.0.2
    • ANDROID_HOME = /Users/danielulbrich/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.1

[✓] Android Studio (version 3.6)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 44.0.2
    • Dart plugin version 192.7761
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[✓] IntelliJ IDEA Community Edition (version 2020.2.4)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin installed
    • Dart plugin version 202.8346

[✓] VS Code (version 1.53.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.19.0

[!] Connected device
    ! No devices available

! Doctor found issues in 1 category.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority issues at the top of the work lista: productionIssues experienced in live production appsc: crashStack traces logged to the consolec: fatal crashCrashes that terminate the processengineflutter/engine related. See also e: labels.platform-iosiOS applications specificallyr: fixedIssue is closed as already fixed in a newer version

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions