-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[Firebase/Performance] GULObjectSwizzler
crashes on objc_disposeClassPair
.
#9083
Comments
I found a few problems with this issue:
|
@paulb777 just to note this is of intense interest in react-native-firebase repo, our test harness is based entirely on Detox, and last time I did a survey of available e2e test tools, Detox still won, even with the horrific ios e2e crash frequency we're taking now. Would ❤️ to see some sort of fix or remediation or something here :-) |
Thanks @mikehardy, and sorry about the inconvenience around this thus far. Looks like we're really getting somewhere now. |
@asafkorem @mikehardy Thanks for the detailed report and background. We'll take a look. It's one of our priorities to overhaul how Firebase uses swizzling. However, a resolution may still be months out. In the meantime, is omitting FirebasePerformance when Detox is used a viable workaround? |
It is possible but is equivalent to saying omit performance from e2e testing for us |
Thanks for the response @paulb777, as @mikehardy mentioned it is possible but we'd rather avoid that, I think it would be also reasonable as a workaround to set some compiler flag that will only omit the deallocation part that triggers this crash, and this flag can be used when building the app for Detox tests. |
@asafkorem is there any reason we can't ride-along with Stated differently, perhaps the "NSZombiesEnabled" check could more properly be thought of as a "don't dispose generated classes" check, just with a too-specific name, but it would serve us as well 🤔 . Have you tried it? |
@mikehardy yes, I thought about it too and already tried this approach. |
If anyone knows how to set this variable using |
you have to pass environment variables very very carefully to get them through the simctl layer, examine this - it would probably work? I will try later (but maybe a few days) if you don't
from This is tested+working way that I inject my AppCheck debug key in (and yes, this a key you'd normally keep private, we accept that it is public in this case as it is on a project configured as a no-cost thing for testing / demonstration purposes only) |
Oh, this makes more sense now.. thanks @mikehardy. I'll try this soon |
cc: @visumickey |
Firebase performance relies a lot on Swizzling to measure performance out of the box. We are working on figuring out solutions outside of swizzling (or keep its dependency really low) to measure the performance. This is indeed tricky. So, we are definitely a few months out for a clean solution here. Until then the Zombie flags seems to be an agreeable solution (if that works). We will make sure to explore that option and add that to our FAQs as well. |
It appears to be working for me, if not completely, then "well". The first run I did I took a SIGSEGV in DetoxSync again, but then I was 10/10 on further runs (an incredible result, I was at maybe 1-2/10 success prior). I am using the special method of passing env vars through simctl as mentioned above. I'm about to make a commit to react-native-firebase that will have a github cross link so others may examine in case it's useful. Thanks for this trick, at least preliminary results show it appears workable to me |
root cause hypothesis is double-swizzling w/DetoxSync and performance mitigation hypothesis is to use new GUL swizzler feature to disable some object destruction firebase/firebase-ios-sdk#9083 wix/Detox#3000
root cause hypothesis is double-swizzling w/DetoxSync and performance mitigation hypothesis is to use new GUL swizzler feature to disable some object destruction firebase/firebase-ios-sdk#9083 wix/Detox#3000
I'm slightly concerned about the SIGSEGV. Was that just a freak accident? At least with the swizzling crash there was some transparency into what it was. With SIGSEGVs I dislike that they're usually a disaster to debug |
root cause hypothesis is double-swizzling w/DetoxSync and performance mitigation hypothesis is to use new GUL swizzler feature to disable some object destruction firebase/firebase-ios-sdk#9083 wix/Detox#3000
I'll need to wait to collect quite a few more results I think, before I want to spend anyone's time in this repo, possibly chasing ghosts. |
Hmm, sadly I think statistics is a thing and I simply had an improbably long run of good results. With quite a few more runs throughout the day / evening, I still definitely have a problem with Detox-current on firebase-ios-sdk-current on iOS-simulator-current on both local macOS x86-64 VMs and up on github actions macOS runners 🤷 - really seemed like an improvement, and I have a hunch statistically it still might be, but there's no silver bullet with the NSZombiesEnabled=1, at least the way I'm setting it https://github.com/invertase/react-native-firebase/runs/4511769043?check_suite_focus=true 🤷 |
Yeah can confirm still seeing Signal 11 with |
Thanks @mikehardy! this workaround works for us, @shamilovtim Note that you should use SIMCTL_CHILD_NSZombieEnabled ( |
This workaround solves the issue described here: firebase/firebase-ios-sdk#9083 And some of the crashes that was mentioned here: - wix#3000 - wix#3123 - wix#2641 - wix#2802
Really sorry I took everyone down the wrong path with my plural-zombies typo! Thanks @asafkorem for seeing that and clearing it up. Excited to have this mitigated, my CI is running now in react-native-firebase based off your PR there Asaf |
@asafkorem Nice catch! |
@paulb777 @ncooke3 @visumickey |
This workaround solves the issue described here: firebase/firebase-ios-sdk#9083 And some of the crashes that was mentioned here: - #3000 - #3123 - #2641 - #2802
I've opened a PR for this: google/GoogleUtilities#66 |
Thanks @asafkorem! GoogleUtilities 7.7.0 is now published to CocoaPods and SPM with your PR that disables class disposing when the |
Thanks @paulb777! |
Sample size of 10 runs which - for this bug, in the react-native-firebase harness - is strongly statistically significant already. Looks great, thanks for the ping @asafkorem |
Use `GULGeneratedClassDisposeDisabled` to disable Google's Swizzler from disposing generated classes. This replaces the `NSZombieEnabled` flag, which was used as a workaround. See: firebase/firebase-ios-sdk#9083.
Although enabling this flag is a bit workaround, it's a pretty decent one. In my opinion, we can definitely live with that, considering the fact that this crash happens when running the apps on Detox tests environment, and this kind of memory consumption (not disposing the generated classes) should not particularly worry us in this case. I opened this issue in the context of this bug, and I think we can close it now since it was resolved. Thanks guys! |
Thanks for the fixing PR @asafkorem ! |
#3167) Use `GULGeneratedClassDisposeDisabled` to disable Google's Swizzler from disposing generated classes. This replaces the `NSZombieEnabled` flag, which was used as a workaround. See: firebase/firebase-ios-sdk#9083.
[REQUIRED] Step 1: Describe your environment
13.1
8.10
iOS
[REQUIRED] Step 2: Describe the problem
Steps to reproduce:
When using Firebase Performance along with Detox Sync (a framework used by Detox), there is a double ISA Swizzling by the components. This causes a crash when
NSZombiesEnabled=NO
.GULObjectSwizzler
calls to dispose its own generated subclasses usingobjc_disposeClassPair()
.objc_disposeClassPair: class 'fir_<some uuid>_<class name>' still has subclasses, including 'fir_<some uuid>_<class name>(__detox_sync_<class name>)'!
This issue seems to be related: google/GoogleUtilities#15.
Also, another explanation of a similar issue, with zombie objects: #8321 (comment) (instead Zombie objects, we have DetoxSync objects).
This branch of DetoxSync reproduces the issue: https://github.com/asafkorem/DetoxSync/tree/feature/reproduce-detox-sync-crash: build and run ExampleApp/TimersTest.xcodeproj with
NSZombiesEnabled=NO
.The text was updated successfully, but these errors were encountered: