App Hanging with CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION

Hi, One of our users is having an issue with our iOS App hanging consistently. The trace produced is not always the same but some parts are consistent between hangs. We have not been able to reproduce on our end. One sample stack trace from user is:


CrashReporter Key:  bf76ea06932831ef2338cbe2b08c552b6140ef83
Hardware Model:     iPhone12,3
Version:            100.0.0
Role:               Foreground
OS Version:         iOS 14.6


App Hang: The app was terminated while unresponsive

0  libsystem_kernel.dylib  ___psynch_cvwait
1  libsystem_pthread.dylib __pthread_cond_wait
2  Metal                   -[_MTLCommandBuffer waitUntilCompleted]
3  CoreImage               CI::MetalContext::readback_bitmap(CI::Bitmap*, CI::swizzle_info)
4  CoreImage               ____ZN2CI16image_get_bitmapEPNS_7ContextEPNS_5ImageE6CGRectP12CGColorSpacePNS_6BitmapEPKNS_17RenderDestinationE_block_invoke
5  CoreImage               CI::recursive_tile(CI::RenderTask*, CI::Context*, CI::RenderDestination const*, char const*, CI::Node*, CGRect const&, CI::PixelFormat, CI::swizzle_info const&, CI::TileTask* ( block_pointer)(CI::ProgramNode*, CGRect))
6  CoreImage               CI::tile_node_graph(CI::Context*, CI::RenderDestination const*, char const*, CI::Node*, CGRect const&, CI::PixelFormat, CI::swizzle_info const&, CI::TileTask* ( block_pointer)(CI::ProgramNode*, CGRect))
7  CoreImage               CI::image_get_bitmap(CI::Context*, CI::Image*, CGRect, CGColorSpace*, CI::Bitmap*, CI::RenderDestination const*)
8  CoreImage               -[CIContext render:toBitmap:rowBytes:bounds:format:colorSpace:]
9  CoreUI                  -[CUIShapeEffectStack _newFlattenedImageFromShapeCGImage:withScale:ciContext:blendOverImage:]
10 CoreUI                  -[CUICatalog imageByStylingImage:stylePresetName:styleConfiguration:foregroundColor:scale:]
11 UIKitCore               -[UIImage _imageWithStylePresets:tintColor:traitCollection:]
12 UIKitCore               -[UIImageView _renditionForSource:size:withCGImageProvider:lazy:]
13 UIKitCore               -[_UIImageContentContextualEffect _renditionWithCGImageProvider:size:lazy:]
14 UIKitCore               -[_UIImageContent renditionWithSize:scale:applyingEffect:]
15 UIKitCore               -[_UIImageContent renditionApplyingEffect:]
16 UIKitCore               -[_UIImageCGImageContent renditionApplyingEffect:]
17 UIKitCore               -[_UIImageContentLayout _materializeContentsIfNeeded]
18 UIKitCore               -[_UIImageContentLayout contentsMultiplyColor]
19 UIKitCore               -[UIImageView _updateContentsMultiplyColorAndSwizzleFromLayout:]
20 UIKitCore               -[UIImageView _setImageViewContents:]
21 UIKitCore               -[UIImageView _updateState]
22 UIKitCore               +[UIView(Animation) performWithoutAnimation:]
23 UIKitCore               -[UIImageView _updateImageViewForOldImage:newImage:]
24 UIKitCore               -[UIImageView setImage:]
25 UIKitCore               -[UIButton _updateImageView]
26 UIKitCore               -[UIButton layoutSubviews]
27 UIKitCore               -[UIView(CALayerDelegate) layoutSublayersOfLayer:]
28 QuartzCore              -[CALayer layoutSublayers]
29 QuartzCore              CA::Layer::layout_if_needed(CA::Transaction*)
30 QuartzCore              CA::Layer::layout_and_display_if_needed(CA::Transaction*)
31 QuartzCore              CA::Context::commit_transaction(CA::Transaction*, double, double*)
32 QuartzCore              CA::Transaction::commit()
33 QuartzCore              CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*)
34 CoreFoundation          ___CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
35 CoreFoundation          ___CFRunLoopDoObservers
36 CoreFoundation          ___CFRunLoopRun
37 CoreFoundation          _CFRunLoopRunSpecific
38 GraphicsServices        _GSEventRunModal
39 UIKitCore               -[UIApplication _run]
40 UIKitCore               _UIApplicationMain
42 libdyld.dylib           _start

What could be causing the above? Thanks in advance for your help.

Replies

It looks like the thread in the stack trace you posted is waiting on a condition from a background thread. To debug this, check what's going on in the other threads and make sure you are not calling UIKit functions from a background thread.

  • Thank you for your suggestion. I'll make sure to check all threads. Thanks!

Add a Comment

Faced same issue. Looking for some solutions. I reported on stack overflow https://stackoverflow.com/questions/76667934/app-hang-the-app-was-terminated-while-unresponsive