Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application crash sending text selector to RxTableViewDelegateProxy or RxCollectionViewDelegateProxy #2428

Closed
4 of 13 tasks
SlashDevSlashGnoll opened this issue Jun 14, 2022 · 41 comments

Comments

@SlashDevSlashGnoll
Copy link
Contributor

Short description of the issue:

We're seeing a crash among our userbase that is happening with alarming frequency however we have been unable to reproduce it or identify the root cause. A slack discussion was started here among 2 of us that are seeing this problem but we wanted to post here with the hopes that someone else may have an idea about something to look at.

This is the stack trace/crash:

-[RxCocoa.RxTableViewDelegateProxy text]: unrecognized selector sent to instance 0x28378a0d0

Fatal Exception: NSInvalidArgumentException
0  CoreFoundation                 0x99288 __exceptionPreprocess
1  libobjc.A.dylib                0x16744 objc_exception_throw
2  CoreFoundation                 0x176fc4 +[NSObject(NSObject) _copyDescription]
3  CoreFoundation                 0x2de98 ___forwarding___
4  CoreFoundation                 0x2cf70 _CF_forwarding_prep_0
5  ContextKitExtraction           0x59ec +[CKContextContentProviderUIScene _bestVisibleStringForView:usingExecutor:]
6  ContextKitExtraction           0x4d7c +[CKContextContentProviderUIScene _donateContentsOfWindow:usingExecutor:withOptions:]
7  ContextKitExtraction           0x48fc __78+[CKContextContentProviderUIScene extractFromScene:usingExecutor:withOptions:]_block_invoke
8  ContextKitExtraction           0x54ac __64-[CKContextExecutor addWorkItemToQueue:withWorkItem:andContext:]_block_invoke
9  libdispatch.dylib              0x1e6c _dispatch_call_block_and_release
10 libdispatch.dylib              0x3a30 _dispatch_client_callout
11 libdispatch.dylib              0x11fa4 _dispatch_main_queue_drain
12 libdispatch.dylib              0x11b98 _dispatch_main_queue_callback_4CF
13 CoreFoundation                 0x51800 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
14 CoreFoundation                 0xb704 __CFRunLoopRun
15 CoreFoundation                 0x1ebc8 CFRunLoopRunSpecific
16 GraphicsServices               0x1374 GSEventRunModal
17 UIKitCore                      0x514648 -[UIApplication _run]
18 UIKitCore                      0x295d90 UIApplicationMain
19 <OurAppName>                   0x2b144c main + 20 (main.swift:20)
20 ???                            0x106badce4 (Missing)

I have scoured our code to see if we were somehow sending a text selector to anything in a weird way, this is not the case. Our app is large and uses tables in many screens but I haven't found any misuse of rx.tems.

Here are the pertinent facts I've been able to collect about the problem:

  1. iOS 15.x.x only. We have users going back all the way to iOS 10.0 and no one experiences the crash other than iOS 15 users. We have a large user base so this shows up enough for us to have a large sample (thousands of crash events)
  2. SDK doesn't matter. I have viewed crashes going back to before we upgraded to Xcode 13 (using Xcode 12). These users had the crash as well (running on iOS 15).
  3. The only API change of note in tables/collection views in iOS15 is the automatic prefetching which doesn't involve code changes necessarily or invoke a text selector anywhere.
  4. The stack makes it clear that whatever the source is, it's going through dynamic dispatch / objc_msgSend and being marshaled to the ui thread or called from the ui thread using dispatch.async as it unwinds the stack out to the runloop to invoke this invalid selector on the proxy.

This crash is alarming because it seems to only occur on iOS15. Users from previous versions of iOS do not exhibit this problem. We haven't been able to determine if this is a bug in iOS, a bug in RxSwift or a bug in our usage of it. The os-specific nature of it makes me wonder if there's an iOS bug or a bug in the RxSwift framework that just hasn't come to light yet.

Any insights would be greatly appreciated.

Expected outcome:

No crashes

What actually happens:

Crash

Self contained code example that reproduces the issue:

I wish I had one or I'd be able to identify the problem :(

RxSwift/RxCocoa/RxBlocking/RxTest version/commit

RxSwift 6.2.0 - 7c17a6c

Platform/Environment

  • iOS
  • macOS
  • tvOS
  • watchOS
  • playgrounds

How easy is to reproduce? (chances of successful reproduce after running the self contained code)

About 3% of our userbase is experiencing this. This includes users of other versions of iOS however that do not experience the issue at all.

Xcode version:

Xcode 13.2.1(13C100) although as stated it seems Xcode 12.4 was used at the time this first started showing up but before we noticed it.

Installation method:

  • CocoaPods
  • Carthage
  • Git submodules

I have multiple versions of Xcode installed:
(so we can know if this is a potential cause of your issue)

  • yes (which ones)
  • no

Level of RxSwift knowledge:
(this is so we can understand your level of knowledge
and formulate the response in an appropriate manner)

  • just starting
  • I have a small code base
  • I have a significant code base
@mwilson-within
Copy link

We are seeing a similar issue NSInvalidArgumentException: -[RxCocoa.RxCollectionViewDelegateProxy text]: unrecognized selector sent to instance 0x...

Cannot reproduce but can confirm it is limited to iOS 15.4+ even though we support iOS 13+. Our Xcode Crash Reports highlight the line +[CKContextContentProviderUIScene _bestVisibleStringForView:usingExecutor:] + 1312 (CKContextContentProviderUIScene.m:570) in bold so it makes me think it is something internal.

We tried upgrading from 6.2.0 to 6.5.0 but it did not help.

@danielt1263
Copy link
Collaborator

If your crash report system allows it... it might help if you can figure out the type of the instance that is receiving the message. To do it, you would have to output several object's memory locations and compare to the one highlighted in the bug.

@SlashDevSlashGnoll
Copy link
Contributor Author

I think the crash says what it is. The text selector is being invoked on RxCollectionViewDelegateProxy or RxTableViewDelegateProxy in my case. The mystery is what's trying to invoke this selector.

@AramJulhakyan
Copy link

We have the exact same issue. And we have been unable to reproduce the issue. Upgrading RxSwift and RxCocoa won't help.

@freak4pc
Copy link
Member

Can you share the entire crash log?

@mkj-is
Copy link
Contributor

mkj-is commented Jun 17, 2022

It's happening to us and it's currently the most significant crash in our app. Can confirm everything what was outlined here (iOS 15+, both RxSwift 6.2 and 6.5).

@SlashDevSlashGnoll
Copy link
Contributor Author

It's from Crashlytics there doesn't seem to be a DL button so here's a cleaned up copy/paste of the entire trace:

47.0 (936)
iOS 15.4.1
iPhone 13 Pro
May 31, 2022, 7:56:32 PM
Stack trace
Keys
Logs
Data


Fatal Exception: NSInvalidArgumentException
-[RxCocoa.RxTableViewDelegateProxy text]: unrecognized selector sent to instance 0x2835133a0
Fatal Exception: NSInvalidArgumentException
0  CoreFoundation                 0x99d78 __exceptionPreprocess
1  libobjc.A.dylib                0x16734 objc_exception_throw
2  CoreFoundation                 0x177b88 +[NSObject(NSObject) _copyDescription]
3  CoreFoundation                 0x2e988 ___forwarding___
4  CoreFoundation                 0x2da60 _CF_forwarding_prep_0
5  ContextKitExtraction           0x59ec +[CKContextContentProviderUIScene _bestVisibleStringForView:usingExecutor:]
6  ContextKitExtraction           0x4d7c +[CKContextContentProviderUIScene _donateContentsOfWindow:usingExecutor:withOptions:]
7  ContextKitExtraction           0x48fc __78+[CKContextContentProviderUIScene extractFromScene:usingExecutor:withOptions:]_block_invoke
8  ContextKitExtraction           0x54ac __64-[CKContextExecutor addWorkItemToQueue:withWorkItem:andContext:]_block_invoke
9  libdispatch.dylib              0x1e68 _dispatch_call_block_and_release
10 libdispatch.dylib              0x3a2c _dispatch_client_callout
11 libdispatch.dylib              0x11fa4 _dispatch_main_queue_drain
12 libdispatch.dylib              0x11b98 _dispatch_main_queue_callback_4CF
13 CoreFoundation                 0x522f0 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
14 CoreFoundation                 0xc1f4 __CFRunLoopRun
15 CoreFoundation                 0x1f6b8 CFRunLoopRunSpecific
16 GraphicsServices               0x1374 GSEventRunModal
17 UIKitCore                      0x513e88 -[UIApplication _run]
18 UIKitCore                      0x2955ec UIApplicationMain
19 <MyAppName>                    0x2b144c main + 20 (main.swift:20)
20 ???                            0x101f1dce4 (Missing)

Crashed: com.google.firebase.crashlytics.ios.exception
SIGABRT ABORT 0x00000001c7e0db78
Crashed: com.google.firebase.crashlytics.ios.exception
0  <MyAppName>                    0x90d8b0 FIRCLSProcessRecordAllThreads + 393 (FIRCLSProcess.c:393)
1  <MyAppName>                    0x90dc90 FIRCLSProcessRecordAllThreads + 424 (FIRCLSProcess.c:424)
2  <MyAppName>                    0x904fd4 FIRCLSHandler + 34 (FIRCLSHandler.m:34)
3  <MyAppName>                    0x8ff740 __FIRCLSExceptionRecord_block_invoke + 215 (FIRCLSException.mm:215)
4  libdispatch.dylib              0x3a2c _dispatch_client_callout + 20
5  libdispatch.dylib              0x12c90 _dispatch_lane_barrier_sync_invoke_and_complete + 56
6  <MyAppName>                    0x8feee0 FIRCLSExceptionRecord + 219 (FIRCLSException.mm:219)
7  <MyAppName>                    0x8ff1e8 FIRCLSExceptionRecordNSException + 109 (FIRCLSException.mm:109)
8  <MyAppName>                    0x8feae0 FIRCLSTerminateHandler() + 273 (FIRCLSException.mm:273)
9  libc++abi.dylib                0x10f18 std::__terminate(void (*)()) + 20
10 libc++abi.dylib                0x10eb4 std::terminate() + 64
11 libobjc.A.dylib                0x2d268 objc::DenseMapBase<objc::DenseMap<objc_class*, PendingInitialize*, objc::DenseMapValueInfo<PendingInitialize*>, objc::DenseMapInfo<objc_class*>, objc::detail::DenseMapPair<objc_class*, PendingInitialize*> >, objc_class*, PendingInitialize*, objc::DenseMapValueInfo<PendingInitialize*>, objc::DenseMapInfo<objc_class*>, objc::detail::DenseMapPair<objc_class*, PendingInitialize*> >::FatalCorruptHashTables(objc::detail::DenseMapPair<objc_class*, PendingInitialize*> const*, unsigned int) const + 14
12 libdispatch.dylib              0x3a40 _dispatch_client_callout + 40
13 libdispatch.dylib              0x11fa4 _dispatch_main_queue_drain + 1020
14 libdispatch.dylib              0x11b98 _dispatch_main_queue_callback_4CF + 44
15 CoreFoundation                 0x522f0 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
16 CoreFoundation                 0xc1f4 __CFRunLoopRun + 2532
17 CoreFoundation                 0x1f6b8 CFRunLoopRunSpecific + 600
18 GraphicsServices               0x1374 GSEventRunModal + 164
19 UIKitCore                      0x513e88 -[UIApplication _run] + 1100
20 UIKitCore                      0x2955ec UIApplicationMain + 364
21 <MyAppName>                    0x2b144c main + 20 (main.swift:20)
22 ???                            0x101f1dce4 (Missing)

com.apple.uikit.eventfetch-thread
com.apple.uikit.eventfetch-thread
0  libsystem_kernel.dylib         0x14e0 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x1b24 mach_msg + 76
2  CoreFoundation                 0x7820 __CFRunLoopServiceMachPort + 372
3  CoreFoundation                 0xbcac __CFRunLoopRun + 1180
4  CoreFoundation                 0x1f6b8 CFRunLoopRunSpecific + 600
5  Foundation                     0x18414 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 236
6  Foundation                     0x59cac -[NSRunLoop(NSRunLoop) runUntilDate:] + 92
7  UIKitCore                      0x48dfb0 -[UIEventFetcher threadMain] + 524
8  Foundation                     0x6855c __NSThread__start__ + 808
9  libsystem_pthread.dylib        0x19ac _pthread_start + 148
10 libsystem_pthread.dylib        0xe68 thread_start + 8

com.google.firebase.crashlytics.MachExceptionServer
com.google.firebase.crashlytics.MachExceptionServer
0  libsystem_kernel.dylib         0x14e0 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x1b24 mach_msg + 76
2  <MyAppName>                    0x90782c FIRCLSMachExceptionServer + 192 (FIRCLSMachException.c:192)
3  libsystem_pthread.dylib        0x19ac _pthread_start + 148
4  libsystem_pthread.dylib        0xe68 thread_start + 8

Realm notification listener
Realm notification listener
0  libsystem_kernel.dylib         0x2e58 kevent + 8
1  <MyAppName>                    0xe75f30 realm::_impl::ExternalCommitHelper::listen() + 829816
2  <MyAppName>                    0xe76080 void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, realm::_impl::ExternalCommitHelper::ExternalCommitHelper(realm::_impl::RealmCoordinator&)::$_0> >(void*) + 830152
3  libsystem_pthread.dylib        0x19ac _pthread_start + 148
4  libsystem_pthread.dylib        0xe68 thread_start + 8

com.sendbird.SocketRocket.NetworkThread
com.sendbird.SocketRocket.NetworkThread
0  libsystem_kernel.dylib         0x14e0 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x1b24 mach_msg + 76
2  CoreFoundation                 0x7820 __CFRunLoopServiceMachPort + 372
3  CoreFoundation                 0xbcac __CFRunLoopRun + 1180
4  CoreFoundation                 0x1f6b8 CFRunLoopRunSpecific + 600
5  Foundation                     0x18414 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 236
6  SendBirdSDK                    0x668c4 -[SendBird_SRRunLoopThread main] + 70 (SendBird_SRRunLoopThread.m:70)
7  Foundation                     0x6855c __NSThread__start__ + 808
8  libsystem_pthread.dylib        0x19ac _pthread_start + 148
9  libsystem_pthread.dylib        0xe68 thread_start + 8

com.apple.NSURLConnectionLoader
com.apple.NSURLConnectionLoader
0  libsystem_kernel.dylib         0x14e0 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x1b24 mach_msg + 76
2  CoreFoundation                 0x7820 __CFRunLoopServiceMachPort + 372
3  CoreFoundation                 0xbcac __CFRunLoopRun + 1180
4  CoreFoundation                 0x1f6b8 CFRunLoopRunSpecific + 600
5  CFNetwork                      0x2774d8 _CFURLStorageSessionDisableCache + 59988
6  Foundation                     0x6855c __NSThread__start__ + 808
7  libsystem_pthread.dylib        0x19ac _pthread_start + 148
8  libsystem_pthread.dylib        0xe68 thread_start + 8

com.apple.CFSocket.private
com.apple.CFSocket.private
0  libsystem_kernel.dylib         0x21a4 __select + 8
1  libsystem_kernel.dylib         0x21a4 select$DARWIN_EXTSN + 8
2  CoreFoundation                 0xab658 __CFSocketManager + 644
3  libsystem_pthread.dylib        0x19ac _pthread_start + 148
4  libsystem_pthread.dylib        0xe68 thread_start + 8

com.apple.root.utility-qos
com.apple.root.utility-qos
0  libsystem_kernel.dylib         0x2178 __ulock_wait + 8
1  libdispatch.dylib              0x441c _dlock_wait + 56
2  libdispatch.dylib              0x4118 _dispatch_wait_on_address + 140
3  libdispatch.dylib              0x47c0 _dispatch_group_wait_slow + 56
4  ContextKitExtraction           0x3f2c -[CKContextExecutor _awaitCompletion] + 52
5  libdispatch.dylib              0x1e68 _dispatch_call_block_and_release + 32
6  libdispatch.dylib              0x3a2c _dispatch_client_callout + 20
7  libdispatch.dylib              0x15280 _dispatch_root_queue_drain + 680
8  libdispatch.dylib              0x1596c _dispatch_worker_thread2 + 164
9  libsystem_pthread.dylib        0x1080 _pthread_wqthread + 228
10 libsystem_pthread.dylib        0xe5c start_wqthread + 8

com.apple.root.user-initiated-qos
com.apple.root.user-initiated-qos
0  libsystem_kernel.dylib         0x14e0 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x1b24 mach_msg + 76
2  CoreFoundation                 0x7820 __CFRunLoopServiceMachPort + 372
3  CoreFoundation                 0xbcac __CFRunLoopRun + 1180
4  CoreFoundation                 0x1f6b8 CFRunLoopRunSpecific + 600
5  Foundation                     0x18414 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 236
6  Foundation                     0x18bd0 -[NSRunLoop(NSRunLoop) run] + 92
7  <MyAppName>                    0xf02e4 __35-[XYZEventManager initializeSocket]_block_invoke + 1294 (XYZEventManager.m:1294)
8  libdispatch.dylib              0x1e68 _dispatch_call_block_and_release + 32
9  libdispatch.dylib              0x3a2c _dispatch_client_callout + 20
10 libdispatch.dylib              0x15280 _dispatch_root_queue_drain + 680
11 libdispatch.dylib              0x1596c _dispatch_worker_thread2 + 164
12 libsystem_pthread.dylib        0x1080 _pthread_wqthread + 228
13 libsystem_pthread.dylib        0xe5c start_wqthread + 8

Thread #1
Thread
0  libsystem_kernel.dylib         0x1ab4 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x1108 _pthread_wqthread + 364
2  libsystem_pthread.dylib        0xe5c start_wqthread + 8

Thread #2
Thread
0  libsystem_kernel.dylib         0x1ab4 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x1108 _pthread_wqthread + 364
2  libsystem_pthread.dylib        0xe5c start_wqthread + 8

Thread #3
Thread
0  libsystem_kernel.dylib         0x1ab4 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x1108 _pthread_wqthread + 364
2  libsystem_pthread.dylib        0xe5c start_wqthread + 8

Thread #4
Thread
0  libsystem_kernel.dylib         0x1ab4 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x1108 _pthread_wqthread + 364
2  libsystem_pthread.dylib        0xe5c start_wqthread + 8

com.sendbird.sdk.core.runloop.thread
com.sendbird.sdk.core.runloop.thread
0  libsystem_kernel.dylib         0x14e0 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x1b24 mach_msg + 76
2  CoreFoundation                 0x7820 __CFRunLoopServiceMachPort + 372
3  CoreFoundation                 0xbcac __CFRunLoopRun + 1180
4  CoreFoundation                 0x1f6b8 CFRunLoopRunSpecific + 600
5  Foundation                     0x18414 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 236
6  SendBirdSDK                    0x93c64 -[SBDRunLoopThread main] + 63 (SBDRunLoopThread.m:63)
7  Foundation                     0x6855c __NSThread__start__ + 808
8  libsystem_pthread.dylib        0x19ac _pthread_start + 148
9  libsystem_pthread.dylib        0xe68 thread_start + 8

Thread #5
Thread
0  libsystem_kernel.dylib         0x1ab4 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x1108 _pthread_wqthread + 364
2  libsystem_pthread.dylib        0xe5c start_wqthread + 8

Thread #6
Thread
0  libsystem_kernel.dylib         0x1ab4 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x1108 _pthread_wqthread + 364
2  libsystem_pthread.dylib        0xe5c start_wqthread + 8

@yan-zaitsev-hs
Copy link

As @mkj-is said about this crash in our application, I would like to add my ideas:
I think it could be related to UILabel.text selection and corruption memory in the application.
We don't use RxSwift so widely, but it looks like some memory leak / memory corruption problem. And RxSwift/Cocoa classes are appeared to be in memory at locations of corrupted memory. Maybe it has something like 0x0 address that are used for other cases.
My conclusion is, that when memory is corrupted and some UILabels are bkoren, application tries to access UILabel.text selector in part of memory where RxCocoa classes are defined

@danielt1263
Copy link
Collaborator

It looks like react native is also having a problem with CKContextContentProviderUIScene _bestVisibleStringForView:usingExecutor. (facebook/react-native#33084)

@SlashDevSlashGnoll
Copy link
Contributor Author

I went back and looked and can confirm what @mwilson-within said, the OS version for this crash are not just any flavor of iOS15 but specifically iOS15.4 and later if that helps.

@mkj-is
Copy link
Contributor

mkj-is commented Jun 17, 2022

It looks like react native is also having a problem with CKContextContentProviderUIScene _bestVisibleStringForView:usingExecutor. (facebook/react-native#33084)

There is a good point, this could be some internal change in accessibility. It looks like the system is traversing the view hierarchy and when it encounters the RxCocoa.RxTableViewDelegateProxy it crashes. But it's just a presumption, I couldn't find any relevant info about the CKContextKit framework. I suppose I'll also send feedback to Apple.

@stivmac
Copy link

stivmac commented Jun 20, 2022

We're having the exact same crash within our app, iOS version 15+, been tracking it for weeks trying to find solutions. We've tried upgrading to the latest Rx release but it doesn't seem to solve the issue.

@Rakchon-n
Copy link

We've just found this issue and also has been happening since iOS 15.4+
Do you guys have any clue or solution?

@freak4pc
Copy link
Member

Hey all,
Thanks for the reports.

To seriously look into this I need a non-Firebase crash report. Meaning an entire non-obfuscated crash report or xccrashpoint file that I can look into would be immensely helpful.

Looking at some of the traces here this doesn't seem like something we could necessarily work around but more like a regression in iOS itself, but I'm happy to try and look into this if I get detailed enough crash details.

Thanks!

@HabMcRuger
Copy link

Looking over the implementation of "DelegateProxy.swift" and "_RXDelegateProxy.m", I'm not sure the logic is correct. In "DelegateProxy.swift", "responds(to..." is checking super:

super.responds(to: aSelector)

But in "_RXDelegateProxy.m", "forwardInvocation" is ignoring super.

The problem is that if the base class object also chooses to use object proxying, then the first check will return true (because the base class DOES respond to the selector) but the forwardInvocation call will fail with "selector not found"(since the message was never forward to "super", which would have responded).

@yan-zaitsev-hs
Copy link

yan-zaitsev-hs commented Jun 28, 2022

Hey all, Thanks for the reports.

To seriously look into this I need a non-Firebase crash report. Meaning an entire non-obfuscated crash report or xccrashpoint file that I can look into would be immensely helpful.

Looking at some of the traces here this doesn't seem like something we could necessarily work around but more like a regression in iOS itself, but I'm happy to try and look into this if I get detailed enough crash details.

Thanks!

2022-06-07_23-03-54.9047_+0400-601c39d876053890e09ae677c7fd948089429656.crash.log

@jackson0122
Copy link

We are seeing a similar issue NSInvalidArgumentException
-[RxCocoa.RxCollectionViewDelegateProxy text]: unrecognized selector sent to instance 0x284862450
image

@iMatkovic
Copy link
Contributor

Any updates?

@SlashDevSlashGnoll
Copy link
Contributor Author

I've got nothing but over the last 90 days we have almost 25k crashes on this over 10.5k users. It accounts for 60% of all of our crashes over that time and the next biggest one accounts for 5%. It's a doozy and I can't reproduce it myself 😭

@mkj-is
Copy link
Contributor

mkj-is commented Jul 19, 2022

We are experimenting with this patch. We don't have conclusive results yet. I will update you when we do. But the root cause is still unknown.

@objc
extension RxCollectionViewDelegateProxy {
    var text: String {
        return String()
    }
}

@Arlindo-g
Copy link

Arlindo-g commented Jul 28, 2022

We are experimenting with this patch. We don't have conclusive results yet. I will update you when we do. But the root cause is still unknown.

@objc
extension RxCollectionViewDelegateProxy {
    var text: String {
        return String()
    }
}

@mkj-is we only have 3 days of it being live, but so far no crashes on the version with this patch in place in our app. I'll update with any changes if more crashes happen with this patch in place.

@SlashDevSlashGnoll
Copy link
Contributor Author

We'll give this a try as well. It's a workaround as it doesn't solve why something thinks the proxy should have a text method, but maybe just stop the crashing.

@yan-zaitsev-hs
Copy link

yan-zaitsev-hs commented Aug 5, 2022

We are experimenting with this patch. We don't have conclusive results yet. I will update you when we do. But the root cause is still unknown.

@objc
extension RxCollectionViewDelegateProxy {
    var text: String {
        return String()
    }
}

This fix is working good.
Moreover, we added non-fatal logging

Screen Shot 2022-08-05 at 19 42 38

with results:

Screen Shot 2022-08-05 at 19 42 48

It means,

that DelegateProxy.swift class returns true for this lines of code.
Screen Shot 2022-08-05 at 19 45 02

Question is why _RXDelegateProxy was not invoked. This class has handled this case and it should work.
Screen Shot 2022-08-05 at 19 44 35

@freak4pc
Copy link
Member

freak4pc commented Aug 5, 2022

I'm OK with taking a PR for this "workaround" if anyone has some time to make one.
As for the reason, this obviously seems like some regression on Apple's side as this underlying piece of code hasn't changed for ~6 years.

@yan-zaitsev-hs
Copy link

yan-zaitsev-hs commented Aug 5, 2022

-deleted-

@rajaraph
Copy link

Hello @mkj-is ,
We're having the exact same crash within our app, and today we were able to reproduce it.
It seems like the crash is happening when the App is open and we try to use Siri

@SlashDevSlashGnoll
Copy link
Contributor Author

@rajaraph Any more details? What did you do with Siri to cause it? Simply trying to use Siri with our app open did not cause the problem.

The bright side I can confirm that the extension fix above to "eat" the errant method calls works for us as well, no new crashes since we sent a build out with this fix.

I'd still like to get to the bottom of this though because until the repo itself is corrected in some way, basically every app that uses RxSwift is guaranteed to have tons of crashes on later OSes.

@rajaraph
Copy link

@SlashDevSlashGnoll Yes we just try to use Siri and it crashes immediately

@freak4pc
Copy link
Member

Hey @SlashDevSlashGnoll @yan-zaitsev-hs -
As I mentioned, I'd appreciate a quick PR with this "workaround". For the time being it's safe as far as I'm concerned.

SlashDevSlashGnoll added a commit to SlashDevSlashGnoll/RxSwift that referenced this issue Sep 9, 2022
Implement crash workaround discussed here ReactiveX#2428 until a more permanent solution is found
SlashDevSlashGnoll added a commit to SlashDevSlashGnoll/RxSwift that referenced this issue Sep 9, 2022
Implement crash workaround discussed here ReactiveX#2428 until a more permanent solution is found
@SlashDevSlashGnoll
Copy link
Contributor Author

PR opened! #2445

@freak4pc
Copy link
Member

Thank you!

freak4pc pushed a commit that referenced this issue Sep 28, 2022
Implement crash workaround discussed here #2428 until a more permanent solution is found
@davidlin-crypto
Copy link

Will we have a new release version of this workaround? Like 6.5.1?

@liweican1992
Copy link

I have a same issue, but in Firebase Crash Log,It shows that:

Fatal Exception: NSInvalidArgumentException
-[RACDelegateProxy text]: unrecognized selector sent to instance 0x283414be0

Fatal Exception: NSInvalidArgumentException
0  CoreFoundation                 0x92d1c __exceptionPreprocess
1  libobjc.A.dylib                0x14ee4 objc_exception_throw
2  CoreFoundation                 0x16375c +[NSObject(NSObject) _copyDescription]
3  CoreFoundation                 0x2c61c ___forwarding___
4  CoreFoundation                 0x2b82c _CF_forwarding_prep_0
5  ContextKitExtraction           0x5660 +[CKContextContentProviderUIScene _bestVisibleStringForView:usingExecutor:]
6  ContextKitExtraction           0x4a1c +[CKContextContentProviderUIScene _donateContentsOfWindow:usingExecutor:withOptions:]
7  ContextKitExtraction           0x45d8 __78+[CKContextContentProviderUIScene extractFromScene:usingExecutor:withOptions:]_block_invoke
8  ContextKitExtraction           0x5144 __64-[CKContextExecutor addWorkItemToQueue:withWorkItem:andContext:]_block_invoke
9  libdispatch.dylib              0x63094 _dispatch_call_block_and_release
10 libdispatch.dylib              0x64094 _dispatch_client_callout
11 libdispatch.dylib              0x458a8 _dispatch_main_queue_drain
12 libdispatch.dylib              0x454d0 _dispatch_main_queue_callback_4CF$VARIANT$armv81
13 CoreFoundation                 0x4e0d4 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
14 CoreFoundation                 0xb5f8 __CFRunLoopRun
15 CoreFoundation                 0x1e250 CFRunLoopRunSpecific
16 GraphicsServices               0x1988 GSEventRunModal
17 UIKitCore                      0x4e5a94 -[UIApplication _run]
18 UIKitCore                      0x27efd4 UIApplicationMain
19 UDictionary                    0x265408 main + 31 (AppDelegate.swift:31)

In Xcode Crash Log:

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Triggered by Thread:  0

Last Exception Backtrace:
0   CoreFoundation                	0x180b5bd1c __exceptionPreprocess + 216 (NSException.m:200)
1   libobjc.A.dylib               	0x19837bee4 objc_exception_throw + 56 (objc-exception.mm:565)
2   CoreFoundation                	0x180c2c75c -[NSObject(NSObject) doesNotRecognizeSelector:] + 140 (NSObject.m:147)
3   CoreFoundation                	0x180af561c ___forwarding___ + 1472 (NSForwarding.m:3577)
4   CoreFoundation                	0x180af482c _CF_forwarding_prep_0 + 92 (:-1)
**5   ContextKitExtraction          	0x1b2988660 +[CKContextContentProviderUIScene _bestVisibleStringForView:usingExecutor:] + 1292 (CKContextContentProviderUIScene.m:570)**
6   ContextKitExtraction          	0x1b2987a1c +[CKContextContentProviderUIScene _donateContentsOfWindow:usingExecutor:withOptions:] + 604 (CKContextContentProviderUIScene.m:308)
7   ContextKitExtraction          	0x1b29875d8 __78+[CKContextContentProviderUIScene extractFromScene:usingExecutor:withOptions:]_block_invoke + 68 (CKContextContentProviderUIScene.m:174)
8   ContextKitExtraction          	0x1b2988144 __64-[CKContextExecutor addWorkItemToQueue:withWorkItem:andContext:]_block_invoke + 68 (CKContextExecutor.m:129)
9   libdispatch.dylib             	0x18081b094 _dispatch_call_block_and_release + 24 (init.c:1517)
10  libdispatch.dylib             	0x18081c094 _dispatch_client_callout + 16 (object.m:560)
11  libdispatch.dylib             	0x1807fd8a8 _dispatch_main_queue_drain + 968 (inline_internal.h:2608)
12  libdispatch.dylib             	0x1807fd4d0 _dispatch_main_queue_callback_4CF$VARIANT$armv81 + 36 (queue.c:7770)
13  CoreFoundation                	0x180b170d4 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12 (CFRunLoop.c:1795)
14  CoreFoundation                	0x180ad45f8 __CFRunLoopRun + 2544 (CFRunLoop.c:3144)
15  CoreFoundation                	0x180ae7250 CFRunLoopRunSpecific + 572 (CFRunLoop.c:3268)
16  GraphicsServices              	0x1a1622988 GSEventRunModal + 160 (GSEvent.c:2200)
17  UIKitCore                     	0x1832e7a94 -[UIApplication _run] + 1080 (UIApplication.m:3511)
18  UIKitCore                     	0x183080fd4 UIApplicationMain + 336 (UIApplication.m:5064)
19  UDictionary                   	0x103005408 main + 64 (AppDelegate.swift:31)
20  dyld                          	0x107a7c4d0 start + 444 (dyldMain.cpp:879)

Thread 0 name:
Thread 0 Crashed:
0   libsystem_kernel.dylib        	0x00000001bb3adbbc __pthread_kill + 8
1   libsystem_pthread.dylib       	0x00000001dbe1c854 pthread_kill + 208 (pthread.c:1668)
2   libsystem_c.dylib             	0x000000018b29a0b0 __abort + 124 (abort.c:155)
3   libsystem_c.dylib             	0x000000018b2456b8 abort + 136 (abort.c:126)
4   libc++abi.dylib               	0x0000000198473dd8 abort_message + 128 (abort_message.cpp:78)
5   libc++abi.dylib               	0x000000019846455c demangling_terminate_handler() + 300 (cxa_default_handlers.cpp:71)
6   libobjc.A.dylib               	0x00000001983818f8 _objc_terminate() + 124 (objc-exception.mm:701)
7   UDictionary                   	0x00000001032b48d8 FIRCLSTerminateHandler() + 340 (FIRCLSException.mm:327)
8   UDictionary                   	0x00000001034d8170 hmd_cpp_terminate_handle() + 380 (HMDCrashDetectCPP.mm:114)
9   libc++abi.dylib               	0x0000000198473274 std::__terminate(void (*)()) + 16 (cxa_handlers.cpp:59)
10  libc++abi.dylib               	0x000000019847321c std::terminate() + 60 (cxa_handlers.cpp:88)
11  libdispatch.dylib             	0x000000018081c0a8 _dispatch_client_callout + 36 (object.m:563)
12  libdispatch.dylib             	0x00000001807fd8a8 _dispatch_main_queue_drain + 968 (inline_internal.h:2608)
13  libdispatch.dylib             	0x00000001807fd4d0 _dispatch_main_queue_callback_4CF$VARIANT$armv81 + 36 (queue.c:7770)
14  CoreFoundation                	0x0000000180b170d4 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12 (CFRunLoop.c:1795)
15  CoreFoundation                	0x0000000180ad45f8 __CFRunLoopRun + 2544 (CFRunLoop.c:3144)
16  CoreFoundation                	0x0000000180ae7250 CFRunLoopRunSpecific + 572 (CFRunLoop.c:3268)
17  GraphicsServices              	0x00000001a1622988 GSEventRunModal + 160 (GSEvent.c:2200)
18  UIKitCore                     	0x00000001832e7a94 -[UIApplication _run] + 1080 (UIApplication.m:3511)
19  UIKitCore                     	0x0000000183080fd4 UIApplicationMain + 336 (UIApplication.m:5064)
20  UDictionary                   	0x0000000103005408 main + 64 (AppDelegate.swift:31)
21  dyld                          	0x0000000107a7c4d0 start + 444 (dyldMain.cpp:879)

Anyway, I will see if this Extension works

@objc
extension RxCollectionViewDelegateProxy {
    var text: String {
        return String()
    }
}

@liweican1992
Copy link

I have a same issue, but in Firebase Crash Log,It shows that:

Fatal Exception: NSInvalidArgumentException
-[RACDelegateProxy text]: unrecognized selector sent to instance 0x283414be0

Fatal Exception: NSInvalidArgumentException
0  CoreFoundation                 0x92d1c __exceptionPreprocess
1  libobjc.A.dylib                0x14ee4 objc_exception_throw
2  CoreFoundation                 0x16375c +[NSObject(NSObject) _copyDescription]
3  CoreFoundation                 0x2c61c ___forwarding___
4  CoreFoundation                 0x2b82c _CF_forwarding_prep_0
5  ContextKitExtraction           0x5660 +[CKContextContentProviderUIScene _bestVisibleStringForView:usingExecutor:]
6  ContextKitExtraction           0x4a1c +[CKContextContentProviderUIScene _donateContentsOfWindow:usingExecutor:withOptions:]
7  ContextKitExtraction           0x45d8 __78+[CKContextContentProviderUIScene extractFromScene:usingExecutor:withOptions:]_block_invoke
8  ContextKitExtraction           0x5144 __64-[CKContextExecutor addWorkItemToQueue:withWorkItem:andContext:]_block_invoke
9  libdispatch.dylib              0x63094 _dispatch_call_block_and_release
10 libdispatch.dylib              0x64094 _dispatch_client_callout
11 libdispatch.dylib              0x458a8 _dispatch_main_queue_drain
12 libdispatch.dylib              0x454d0 _dispatch_main_queue_callback_4CF$VARIANT$armv81
13 CoreFoundation                 0x4e0d4 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
14 CoreFoundation                 0xb5f8 __CFRunLoopRun
15 CoreFoundation                 0x1e250 CFRunLoopRunSpecific
16 GraphicsServices               0x1988 GSEventRunModal
17 UIKitCore                      0x4e5a94 -[UIApplication _run]
18 UIKitCore                      0x27efd4 UIApplicationMain
19 UDictionary                    0x265408 main + 31 (AppDelegate.swift:31)

In Xcode Crash Log:

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Triggered by Thread:  0

Last Exception Backtrace:
0   CoreFoundation                	0x180b5bd1c __exceptionPreprocess + 216 (NSException.m:200)
1   libobjc.A.dylib               	0x19837bee4 objc_exception_throw + 56 (objc-exception.mm:565)
2   CoreFoundation                	0x180c2c75c -[NSObject(NSObject) doesNotRecognizeSelector:] + 140 (NSObject.m:147)
3   CoreFoundation                	0x180af561c ___forwarding___ + 1472 (NSForwarding.m:3577)
4   CoreFoundation                	0x180af482c _CF_forwarding_prep_0 + 92 (:-1)
**5   ContextKitExtraction          	0x1b2988660 +[CKContextContentProviderUIScene _bestVisibleStringForView:usingExecutor:] + 1292 (CKContextContentProviderUIScene.m:570)**
6   ContextKitExtraction          	0x1b2987a1c +[CKContextContentProviderUIScene _donateContentsOfWindow:usingExecutor:withOptions:] + 604 (CKContextContentProviderUIScene.m:308)
7   ContextKitExtraction          	0x1b29875d8 __78+[CKContextContentProviderUIScene extractFromScene:usingExecutor:withOptions:]_block_invoke + 68 (CKContextContentProviderUIScene.m:174)
8   ContextKitExtraction          	0x1b2988144 __64-[CKContextExecutor addWorkItemToQueue:withWorkItem:andContext:]_block_invoke + 68 (CKContextExecutor.m:129)
9   libdispatch.dylib             	0x18081b094 _dispatch_call_block_and_release + 24 (init.c:1517)
10  libdispatch.dylib             	0x18081c094 _dispatch_client_callout + 16 (object.m:560)
11  libdispatch.dylib             	0x1807fd8a8 _dispatch_main_queue_drain + 968 (inline_internal.h:2608)
12  libdispatch.dylib             	0x1807fd4d0 _dispatch_main_queue_callback_4CF$VARIANT$armv81 + 36 (queue.c:7770)
13  CoreFoundation                	0x180b170d4 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12 (CFRunLoop.c:1795)
14  CoreFoundation                	0x180ad45f8 __CFRunLoopRun + 2544 (CFRunLoop.c:3144)
15  CoreFoundation                	0x180ae7250 CFRunLoopRunSpecific + 572 (CFRunLoop.c:3268)
16  GraphicsServices              	0x1a1622988 GSEventRunModal + 160 (GSEvent.c:2200)
17  UIKitCore                     	0x1832e7a94 -[UIApplication _run] + 1080 (UIApplication.m:3511)
18  UIKitCore                     	0x183080fd4 UIApplicationMain + 336 (UIApplication.m:5064)
19  UDictionary                   	0x103005408 main + 64 (AppDelegate.swift:31)
20  dyld                          	0x107a7c4d0 start + 444 (dyldMain.cpp:879)

Thread 0 name:
Thread 0 Crashed:
0   libsystem_kernel.dylib        	0x00000001bb3adbbc __pthread_kill + 8
1   libsystem_pthread.dylib       	0x00000001dbe1c854 pthread_kill + 208 (pthread.c:1668)
2   libsystem_c.dylib             	0x000000018b29a0b0 __abort + 124 (abort.c:155)
3   libsystem_c.dylib             	0x000000018b2456b8 abort + 136 (abort.c:126)
4   libc++abi.dylib               	0x0000000198473dd8 abort_message + 128 (abort_message.cpp:78)
5   libc++abi.dylib               	0x000000019846455c demangling_terminate_handler() + 300 (cxa_default_handlers.cpp:71)
6   libobjc.A.dylib               	0x00000001983818f8 _objc_terminate() + 124 (objc-exception.mm:701)
7   UDictionary                   	0x00000001032b48d8 FIRCLSTerminateHandler() + 340 (FIRCLSException.mm:327)
8   UDictionary                   	0x00000001034d8170 hmd_cpp_terminate_handle() + 380 (HMDCrashDetectCPP.mm:114)
9   libc++abi.dylib               	0x0000000198473274 std::__terminate(void (*)()) + 16 (cxa_handlers.cpp:59)
10  libc++abi.dylib               	0x000000019847321c std::terminate() + 60 (cxa_handlers.cpp:88)
11  libdispatch.dylib             	0x000000018081c0a8 _dispatch_client_callout + 36 (object.m:563)
12  libdispatch.dylib             	0x00000001807fd8a8 _dispatch_main_queue_drain + 968 (inline_internal.h:2608)
13  libdispatch.dylib             	0x00000001807fd4d0 _dispatch_main_queue_callback_4CF$VARIANT$armv81 + 36 (queue.c:7770)
14  CoreFoundation                	0x0000000180b170d4 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12 (CFRunLoop.c:1795)
15  CoreFoundation                	0x0000000180ad45f8 __CFRunLoopRun + 2544 (CFRunLoop.c:3144)
16  CoreFoundation                	0x0000000180ae7250 CFRunLoopRunSpecific + 572 (CFRunLoop.c:3268)
17  GraphicsServices              	0x00000001a1622988 GSEventRunModal + 160 (GSEvent.c:2200)
18  UIKitCore                     	0x00000001832e7a94 -[UIApplication _run] + 1080 (UIApplication.m:3511)
19  UIKitCore                     	0x0000000183080fd4 UIApplicationMain + 336 (UIApplication.m:5064)
20  UDictionary                   	0x0000000103005408 main + 64 (AppDelegate.swift:31)
21  dyld                          	0x0000000107a7c4d0 start + 444 (dyldMain.cpp:879)

Anyway, I will see if this Extension works

@objc
extension RxCollectionViewDelegateProxy {
    var text: String {
        return String()
    }
}

It didn't work for me

@mkj-is
Copy link
Contributor

mkj-is commented Nov 7, 2022

@liweican1992 That is because RACDelegateProxy is not part of RxSwift, but seems like it is a part of some old ReactiveCocoa version. Using correct class name should fix.

Since this bug is present in more FRP project I suspect this is indeed caused by some internal change in iOS.

@objc
extension RACDelegateProxy {
    var text: String {
        return String()
    }
}

@SlashDevSlashGnoll
Copy link
Contributor Author

@liweican1992 Are you even using RxSwift in your project? Or are you using ReactiveObjC? The crash you listed shows the same problem but for a class as part of the ReactiveObjC project shown here. If so apply a similar patch there for RACDelegateProxy as @mkj-is explained.

@liweican1992
Copy link

liweican1992 commented Jan 13, 2023

@liweican1992 That is because RACDelegateProxy is not part of RxSwift, but seems like it is a part of some old ReactiveCocoa version. Using correct class name should fix.

Since this bug is present in more FRP project I suspect this is indeed caused by some internal change in iOS.

@objc
extension RACDelegateProxy {
    var text: String {
        return String()
    }
}

@mkj-is @SlashDevSlashGnoll Thank you very much. We used ReactiveCocoa and RxSwift in our project, and the crash did resolve with this extension.

The crash happened mostly in the ads show, some advertising SDK caused this strange bug

@DemonionFF
Copy link

DemonionFF commented May 31, 2023

I'm receiving same issue, but for RxScrollViewDelegateProxy text.

Added extension to it in a similar way to what is shown for collection/tableViews, but for ScrollView.

Crash appeared again.

Do you think adding text properties to collection/table proxies may resolve it?

GalBerezansky pushed a commit to GalBerezansky/RxSwift that referenced this issue Jul 23, 2023
Implement crash workaround discussed here ReactiveX#2428 until a more permanent solution is found
@yan-zaitsev-hs
Copy link

Small update:
we found, that this stack trace appear much often on iOS 17.0.0
Afraid, that is may indicate some more serious issue with the app :(

Screenshot 2023-08-23 at 10 12 05

In our project, we not only added text property but also sent the non-fatal to Firebase about it. Also, 100% on iOS 17.0.0 of them are coming with flag background=true in Firebase.

@yan-zaitsev-hs
Copy link

Guys please check our solution for this crash #2546

@pnzr00t
Copy link

pnzr00t commented Feb 1, 2024

Guys please check our solution for this crash #2546

As i see this MR is merged. May you say when new release will be?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests