Skip to content

Crashing using offscreen rendering with Xcode16.3+ with Main Thread Checker or Thread Performance Checker #1722

@shogo4405

Description

@shogo4405

Observed behavior

The iOS sample app crashes within about 1 to 2 minutes after launch.

Expected behavior

To continue camera capture without crashing.

To Reproduce

Xcode 16.4 and the following conditions:

  • Image
  1. Build the iOS version of the Example app in Xcode and run it in debug mode.
  2. Leave it running for about 1 or 2 minutes.
  3. A crash occurs.

Version

  • Xcode16.4

Smartphone info.

  • iPhone 16 Pro max + iOS18.4

Additional context

Xcode16.4

  • Main Thread Checker -> ON
  • Thread Performace Cheker -> ON

Screenshots

Image

Relevant log output

#0	0x00000001046cf284 in std::__1::__hash_table<std::__1::__hash_value_type<long, qos_info_t>, std::__1::__unordered_map_hasher<long, std::__1::__hash_value_type<long, qos_info_t>, std::__1::hash<long>, std::__1::equal_to<long>, true>, std::__1::__unordered_map_equal<long, std::__1::__hash_value_type<long, qos_info_t>, std::__1::equal_to<long>, std::__1::hash<long>, true>, std::__1::allocator<std::__1::__hash_value_type<long, qos_info_t>>>::__emplace_unique_key_args<long, std::__1::piecewise_construct_t const&, std::__1::tuple<long const&>, std::__1::tuple<>> ()
#1	0x00000001046ceda8 in qosWaiterSignallerInvariantCheck ()
#2	0x00000001046c9614 in interposed_dispatch_group_wait ()
#3	0x00000001a18c7ef0 in invocation function for block in CI::Context::recursive_render(CI::TileTask*, CI::roiKey const&, CI::Node*, bool) ()
#4	0x0000000104da8584 in _dispatch_call_block_and_release ()
#5	0x0000000104dc2064 in _dispatch_client_callout ()
#6	0x0000000104db091c in _dispatch_lane_serial_drain ()
#7	0x0000000104db15d8 in _dispatch_lane_invoke ()
#8	0x0000000104dbd894 in _dispatch_root_queue_drain_deferred_wlh ()
#9	0x0000000104dbceb0 in _dispatch_workloop_worker_thread ()
#10	0x000000021b0ed660 in _pthread_wqthread ()
Enqueued from com.apple.root.user-initiated-qos.cooperative (Thread 15) Queue : com.apple.root.user-initiated-qos.cooperative (serial)
#0	0x0000000104dada3c in dispatch_async ()
#1	0x00000001a18c0828 in CI::Context::recursive_render ()
#2	0x00000001a18d20e4 in CI::Context::render ()
#3	0x00000001a18d1d2c in invocation function for block in CI::image_render_to_bitmap(CI::Context*, CI::Image*, CGRect, CGColorSpace*, CI::Bitmap*, CI::RenderDestination const*) ()
#4	0x00000001a18a22cc in CI::recursive_tile ()
#5	0x00000001a1891e24 in CI::tile_node_graph ()
#6	0x00000001a18b3968 in CI::image_render_to_bitmap ()
#7	0x00000001a18ca8ac in CI::RenderToBitmap::render ()
#8	0x00000001a1895b10 in -[CIContext(CIRenderDestination) _startTaskToRender:toDestination:forPrepareRender:forClear:error:] ()
#9	0x00000001a18b31d0 in -[CIContext(CIRenderDestination) startTaskToRender:fromRect:toDestination:atPoint:error:] ()
#10	0x00000001a18c8f08 in -[CIContext(_createCGImageInternal) _createCGImage:fromRect:format:premultiplied:colorSpace:deferred:renderCallback:] ()
#11	0x00000001a18c82d0 in -[CIContext(createCGImage) createCGImage:fromRect:] ()
#12	0x0000000105ebd1f0 in VideoTrackScreenObject.makeImage<τ_0_0>(_:) at /Users//Documents/GitHub/HaishinKit.swift/HaishinKit/Sources/Screen/ScreenObject.swift:293
#13	0x0000000105eca2dc in closure #1 in ScreenRendererByCPU.layout(_:) at /Users//Documents/GitHub/HaishinKit.swift/HaishinKit/Sources/Screen/ScreenRenderer.swift:134
#14	0x0000000105ecbbe4 in partial apply for closure #1 in ScreenRendererByCPU.layout(_:) ()
#15	0x0000000105ecac2c in autoreleasepool<τ_0_0, τ_0_1>(invoking:) ()
#16	0x0000000105eca13c in ScreenRendererByCPU.layout(_:) at /Users//Documents/GitHub/HaishinKit.swift/HaishinKit/Sources/Screen/ScreenRenderer.swift:133
#17	0x0000000105ecb688 in protocol witness for ScreenRenderer.layout(_:) in conformance ScreenRendererByCPU ()
#18	0x0000000105eba604 in ScreenObject.layout<τ_0_0>(_:) at /Users//Documents/GitHub/HaishinKit.swift/HaishinKit/Sources/Screen/ScreenObject.swift:138
#19	0x0000000105ec6688 in closure #1 in ScreenObjectContainer.layout<τ_0_0>(_:) at /Users//Documents/GitHub/HaishinKit.swift/HaishinKit/Sources/Screen/ScreenObjectContainer.swift:55
#20	0x0000000105ec66d8 in partial apply for closure #1 in ScreenObjectContainer.layout<A>(_:) ()
#21	0x000000018f2e6098 in Swift.Sequence.forEach((τ_0_0.Element) throws -> ()) throws -> () ()
#22	0x0000000105ec64d4 in ScreenObjectContainer.layout<τ_0_0>(_:) at /Users//Documents/GitHub/HaishinKit.swift/HaishinKit/Sources/Screen/ScreenObjectContainer.swift:53
#23	0x0000000105eb7fc0 in Screen.render(_:) at /Users//Documents/GitHub/HaishinKit.swift/HaishinKit/Sources/Screen/Screen.swift:181
#24	0x0000000105eb78e0 in Screen.makeSampleBuffer(_:) at /Users//Documents/GitHub/HaishinKit.swift/HaishinKit/Sources/Screen/Screen.swift:164
#25	0x0000000105e11328 in closure #2 in MediaMixer.setVideoRenderingMode(_:) at /Users//Documents/GitHub/HaishinKit.swift/HaishinKit/Sources/Mixer/MediaMixer.swift:368
#26	0x000000019c715134 in swift::runJobInEstablishedExecutorContext ()
#27	0x000000019c7165c8 in swift_job_runImpl ()
#28	0x0000000104dbbf30 in _dispatch_root_queue_drain ()
#29	0x0000000104dbc8c8 in _dispatch_worker_thread2 ()
#30	0x000000021b0ed624 in _pthread_wqthread ()
#31	0x000000021b0ea9f8 in start_wqthread ()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions