Instabug/Instabug-iOS

App freezes instead of crashing when Kotlin Multiplatform is present

Opened this issue · 3 comments

Steps to Reproduce the Problem

Execute the sample app and wait for 2 seconds for it to freeze instead of crashing.

Expected Behavior

App crashes.

Actual Behavior

App freezes and is unresponsive to taps.

Instabug integration code

Instabug.start(withToken: "whatever", invocationEvents: .shake)

SDK Version

12.4.0

iOS Version

17.0.1, but happens on all versions from 16.* and up

Device Model

iPhone 15 Pro, but happens on all devices we tested

[Optional] Project That Reproduces the Issue

https://github.com/leandrofavarin/Instabug-iOS-hang-demo

--

What's more interesting is that if I pass an empty token, then the app crashes as expected. Any other value (including a valid token) makes the app freeze permanently.

@leandrofavarin Thank you for reaching out. We're looking into it now and we'll get back to you once we have any updates.

This issue has been automatically marked as stale due to inactivity. It will be closed if no further activity occurs. Thank you for your contributions.

I think we might be hitting this same issue. On app launch in some cases (every other launch for some devs), we are hitting endless hanging. Disabling Instabug resolves the hang.

I was able to get the following stack trace during the hang:

* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x0000000113c4a69c Instabug`plcrash::IBG::async::dwarf_cfa_state<unsigned long long, long long>::remove_register(unsigned int) + 164
    frame #1: 0x0000000113c47f08 Instabug`plcrash::IBG::async::dwarf_cfa_state<unsigned long long, long long>::eval_program(plcrash_async_mobject*, unsigned long long, unsigned long long, plcrash::IBG::async::plcrash_async_dwarf_cie_info*, plcrash::IBG::async::gnu_ehptr_reader<unsigned long long>*, IBGplcrash_async_byteorder const*, unsigned long, long, unsigned long) + 2844
    frame #2: 0x0000000113c4ab9c Instabug`IBGplframe_cursor_read_dwarf_unwind + 788
    frame #3: 0x0000000113c2df8c Instabug`IBGplframe_cursor_next_with_readers + 324
    frame #4: 0x0000000113c2dff0 Instabug`IBGplframe_cursor_next + 64
    frame #5: 0x0000000113c2f880 Instabug`plcrash_writer_write_thread + 564
    frame #6: 0x0000000113c2f078 Instabug`IBGplcrash_log_writer_write + 1084
    frame #7: 0x0000000113c3e820 Instabug`IBGplcrash_async_thread_state_current_stub + 88
    frame #8: 0x0000000113c3e7bc Instabug`IBGplcrash_async_thread_state_current + 132
    frame #9: 0x0000000113c326c8 Instabug`-[IBGPLCrashReporter generateLiveReportWithThread:fileDescriptor:exception:error:] + 392
    frame #10: 0x0000000113c32378 Instabug`-[IBGPLCrashReporter generateLiveReportWithThread:exception:error:] + 180
    frame #11: 0x0000000113c21624 Instabug`function signature specialization <Arg[0] = Dead> of InstabugCrashReporting.IBGAppTerminationCreator.getCrashData() -> (Swift.Optional<Foundation.Data>, Swift.Optional<Swift.Error>) + 344
    frame #12: 0x0000000113c216f0 Instabug`function signature specialization <Arg[0] = Dead> of InstabugCrashReporting.IBGAppTerminationCreator.getCrashReport() -> Swift.Optional<__C.IBGCrashReport> + 24
    frame #13: 0x0000000113c21e04 Instabug`function signature specialization <Arg[4] = Dead> of InstabugCrashReporting.IBGAppTerminationCreator.buildAppTermination(terminationDate: Foundation.Date, with: Swift.Optional<__C.IBGPreSendingSnapshot>, lastSessionID: Swift.String, attachments: Swift.Array<Swift.Optional<__C.IBGFileLocalAttachment>>) -> Swift.Optional<__C.IBGAppTermination> + 720
    frame #14: 0x0000000113c21104 Instabug`partial apply forwarder for closure #1 (Swift.Optional<Swift.AnyObject>) -> Swift.Optional<Any> in closure #1 (Swift.Optional<__C.IBGPreSavedPreSendingSnapshot>) -> () in InstabugCrashReporting.IBGAppTerminationCreator.createAppTermination(terminationDate: Foundation.Date, completionHandler: (Swift.Optional<__C.IBGAppTermination>) -> ()) -> () + 128
    frame #15: 0x0000000113c23884 Instabug`reabstraction thunk helper from @escaping @callee_guaranteed (@guaranteed Swift.Optional<Swift.AnyObject>) -> (@out Swift.Optional<Any>) to @escaping @callee_unowned @convention(block) (@unowned Swift.Optional<Swift.AnyObject>) -> (@autoreleased Swift.Optional<Swift.AnyObject>) + 60
    frame #16: 0x0000000113a6f63c Instabug`__56-[IBGPromise chainOnQueue:chainedFulfill:chainedReject:]_block_invoke.18 + 52
    frame #17: 0x000000019192a320 libdispatch.dylib`_dispatch_call_block_and_release + 32
    frame #18: 0x000000019192beac libdispatch.dylib`_dispatch_client_callout + 20
    frame #19: 0x000000019193a700 libdispatch.dylib`_dispatch_main_queue_drain + 1020
    frame #20: 0x000000019193a2f4 libdispatch.dylib`_dispatch_main_queue_callback_4CF + 44
    frame #21: 0x000000018a4f3c28 CoreFoundation`__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
    frame #22: 0x000000018a4d5560 CoreFoundation`__CFRunLoopRun + 1992
    frame #23: 0x000000018a4da3ec CoreFoundation`CFRunLoopRunSpecific + 612
    frame #24: 0x00000001c59f035c GraphicsServices`GSEventRunModal + 164
    frame #25: 0x000000018c866f58 UIKitCore`-[UIApplication _run] + 888
    frame #26: 0x000000018c866bbc UIKitCore`UIApplicationMain + 340
    frame #27: 0x0000000100b78f14 {APPNAME}`main at main.swift:10:1
    frame #28: 0x00000001a9a0cdec dyld`start + 2220

I also saw the same stack trace stuck at 100% CPU usage when replicating with Instruments.