facebook-ios-sdk icon indicating copy to clipboard operation
facebook-ios-sdk copied to clipboard

SIGSEGV when [FBSDKGraphRequestConnection dealloc] called

Open david50407 opened this issue 3 years ago • 3 comments

Checklist before submitting a bug report

Xcode version

13.1 (13A1030d)

Facebook iOS SDK version

12.1.0

Dependency Manager

CocoaPods

SDK Framework

Core

Goals

Run with Detox without any exception on reloading/restarting app

Expected results

The app runs up and won't get crashed

Actual results

Got crashed from when using with Detox e2e testing:

Seem that chould be a memory leak issue when [FBSDKGraphRequestConnection dealloc]

detox[20898] ERROR: [WS_ERROR] The app has crashed, see the details below:
Signal 11 was raised
(
	0   Detox                               0x00000001085ac6a5 +[NSThread(DetoxUtils) dtx_demangledCallStackSymbols] + 37
	1   Detox                               0x00000001085af230 __DTXHandleCrash + 464
	2   Detox                               0x00000001085af971 __DTXHandleSignal + 59
	3   libsystem_platform.dylib            0x00007fff60334d7d _sigtramp + 29
	4   ???                                 0x0000700003e7f520 0x0 + 123145367844128
	5   CoreFoundation                      0x00007fff20492833 -[__NSDictionaryM dealloc] + 128
	6   libobjc.A.dylib                     0x00007fff20191604 objc_object::sidetable_release(bool, bool) + 174
	7   libobjc.A.dylib                     0x00007fff2018d8ad _object_remove_assocations + 562
	8   libobjc.A.dylib                     0x00007fff2018ac02 objc_destructInstance + 84
	9   CoreFoundation                      0x00007fff204321f6 -[NSObject(NSObject) __dealloc_zombie] + 159
	10  FBSDKCoreKit                        0x000000010879ca40 -[FBSDKGraphRequestConnection dealloc] + 96
	11  libobjc.A.dylib                     0x00007fff20191604 objc_object::sidetable_release(bool, bool) + 174
	12  CFNetwork                           0x00007fff236fc610 _CFNetworkHTTPConnectionCacheSetLimit + 162696
	13  CFNetwork                           0x00007fff23545183 CFNetwork + 24963
	14  DetoxSync                           0x000000010aa69b27 ____detox_sync_dispatch_wrapper_block_invoke + 23
	15  libdispatch.dylib                   0x00007fff2010670d _dispatch_call_block_and_release + 12
	16  libdispatch.dylib                   0x00007fff201078df _dispatch_client_callout + 8
	17  libdispatch.dylib                   0x00007fff2010de15 _dispatch_lane_serial_drain + 715
	18  libdispatch.dylib                   0x00007fff2010e9c3 _dispatch_lane_invoke + 455
	19  libdispatch.dylib                   0x00007fff20118f81 _dispatch_workloop_worker_thread + 772
	20  libsystem_pthread.dylib             0x00007fff6033f499 _pthread_wqthread + 314
	21  libsystem_pthread.dylib             0x00007fff6033e467 start_wqthread + 15
)

Steps to reproduce

  1. Init React Native project
  2. Install react-native-fbsdk-next@^6.1.1 with npm
  3. Install detox@^19.4.1 with npm
  4. write some random tests with beforeEach hook included await device.reloadReactNative()
  5. run test
  6. got crash report

Code samples & details

ReactNative: 0.64.2 FBSDK: 12.1.0 react-native-fbsdk-next: 6.1.1 detox: 19.4.1

Both crashed in iOS 14.2/15 simulator on M1/Intel Mac, with/without NSZombleEnabled flag

This issue might related with #1569

david50407 avatar Jan 04 '22 09:01 david50407

@david50407 We are unable to determine the source of this zombie or reproduce it with the basic tools (non-RN, non-detox). Are you able to reproduce it using a regular set of tests in Xcode with a non-ReactNative app? If this isn't causing a crash in a regular running app, we likely won't be able to fix it right now.

samodom avatar May 03 '22 20:05 samodom

This seems only to happened with Detox while reloading app, Detox triggers reload process by releasing this lib and load again. The exceptions happens during the releasing progress

david50407 avatar May 12 '22 18:05 david50407

We have made a change that we think will prevent a memory leak near this code, so hopefully you can help us understand if there is still a zombie after our next release.

samodom avatar May 13 '22 17:05 samodom