apollo-ios icon indicating copy to clipboard operation
apollo-ios copied to clipboard

crash if ApolloClient released before GraphQLQueryWatcher

Open RolandasRazma opened this issue 6 years ago • 2 comments

While trying to write better test for https://github.com/apollographql/apollo-ios/pull/552 I discovered that if ApolloClient released before GraphQLQueryWatcher app will crash with trace:

  • thread #7, queue = 'com.apollographql.ApolloClient', stop reason = EXC_BAD_ACCESS (code=1, address=0x185fc44b4)
    • frame #0: 0x0000000106ca3657 libobjc.A.dylibobjc_msgSend + 23 frame #1: 0x00000001065b5e35 Foundation__NSOQSchedule_f + 145 frame #2: 0x000000010980fccf libdispatch.dylib_dispatch_call_block_and_release + 12 frame #3: 0x0000000109810d02 libdispatch.dylib_dispatch_client_callout + 8 frame #4: 0x0000000109817720 libdispatch.dylib_dispatch_lane_serial_drain + 705 frame #5: 0x0000000109818261 libdispatch.dylib_dispatch_lane_invoke + 398 frame #6: 0x0000000109820fcb libdispatch.dylib_dispatch_workloop_worker_thread + 645 frame #7: 0x0000000109bf2611 libsystem_pthread.dylib_pthread_wqthread + 421 frame #8: 0x0000000109bf23fd libsystem_pthread.dylib`start_wqthread + 13

This ticket is placeholder, will try to write test to replicate that more reliably. It could be that crash happens for different reasons. As far as I can tell its not same crash as https://github.com/apollographql/apollo-ios/pull/552

RolandasRazma avatar Jul 29 '19 10:07 RolandasRazma

Good catch - I think in theory if a client hits dealloc we should probably kill all the query watchers, I'm just not sure how complex that will be in practice.

designatednerd avatar Jul 29 '19 10:07 designatednerd

This is going to be related to #516. I'm going to try to find some time to look into how we can make this week at some point in the near future.

AnthonyMDev avatar Jul 29 '19 20:07 AnthonyMDev