Skip to content

Auth / GTMSessionFetcher are re-using invalidated NSURLSessions #1261

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

Closed
dsanghan opened this issue May 11, 2018 · 6 comments
Closed

Auth / GTMSessionFetcher are re-using invalidated NSURLSessions #1261

dsanghan opened this issue May 11, 2018 · 6 comments
Assignees
Milestone

Comments

@dsanghan
Copy link

Environment

  • Xcode version: 9.3
  • Firebase SDK version: 4.0.11
  • Firebase Component: Auth
  • Component version: 4.3.2

Problem

Auth / GTMSessionFetcher are re-using invalidated NSURLSessions:

Fatal Exception: NSGenericException
0  CoreFoundation                 0x184596d8c __exceptionPreprocess
1  libobjc.A.dylib                0x1837505ec objc_exception_throw
2  CFNetwork                      0x184b25bfc __75-[__NSURLSessionLocal taskForClass:request:uploadFile:bodyData:completion:]_block_invoke
3  App                     	  0x1046a96c0 -[GTMSessionFetcher beginFetchMayDelay:mayAuthorize:] (GTMSessionFetcher.m:761)
4  App                     	  0x1045f5cc4 -[FIRAuthBackendRPCIssuerImplementation asyncPostToURLWithRequestConfiguration:URL:body:contentType:completionHandler:] (FIRAuthBackend.m:527)
5  App                     	  0x1045f77c4 -[FIRAuthBackendRPCImplementation postWithRequest:response:callback:] (FIRAuthBackend.m:779)
6  App                            0x1045f6990 -[FIRAuthBackendRPCImplementation secureToken:callback:] (FIRAuthBackend.m:629)
7  App                            0x1045f5484 +[FIRAuthBackend secureToken:callback:] (FIRAuthBackend.m:435)
8  App                            0x104605f68 -[FIRSecureTokenService requestAccessToken:] (FIRSecureTokenService.m:199)
9  App                            0x104605a44 __65-[FIRSecureTokenService fetchAccessTokenForcingRefresh:callback:]_block_invoke (FIRSecureTokenService.m:118)
10 App                            0x1045fca00 __38-[FIRAuthSerialTaskQueue enqueueTask:]_block_invoke (FIRAuthSerialTaskQueue.m:49)
11 libdispatch.dylib              0x183e88b24 _dispatch_call_block_and_release
12 libdispatch.dylib              0x183e88ae4 _dispatch_client_callout
13 libdispatch.dylib              0x183ec71b4 _dispatch_queue_serial_drain$VARIANT$armv81
14 libdispatch.dylib              0x183ec7ad8 _dispatch_queue_invoke$VARIANT$armv81
15 libdispatch.dylib              0x183ec7074 _dispatch_queue_serial_drain$VARIANT$armv81
16 libdispatch.dylib              0x183ec7ad8 _dispatch_queue_invoke$VARIANT$armv81
17 libdispatch.dylib              0x183ec847c _dispatch_root_queue_drain_deferred_wlh$VARIANT$armv81
18 libdispatch.dylib              0x183ed044c _dispatch_workloop_worker_thread$VARIANT$armv81
19 libsystem_pthread.dylib        0x1841bbe70 _pthread_wqthread
20 libsystem_pthread.dylib        0x1841bbb08 start_wqthread
@paulb777
Copy link
Member

@dsanghan Thanks for the report. Are you able to share a reproducible test case? Does the issue still occur with 5.0.0?

@dsanghan
Copy link
Author

@paulb777 Don't see the issue after updating to 5.0.0. Still monitoring. I'll close it if I don't see it in the next few days. Thanks!

@dsanghan
Copy link
Author

dsanghan commented May 28, 2018

@paulb777: Unfortunately, it's still happening on Core 5.0.1, with Auth 5.0.0.

Fatal Exception: NSGenericException
0  CoreFoundation                 0x184336d8c __exceptionPreprocess
1  libobjc.A.dylib                0x1834f05ec objc_exception_throw
2  CFNetwork                      0x1848c5bfc __75-[__NSURLSessionLocal taskForClass:request:uploadFile:bodyData:completion:]_block_invoke
3  App                            0x10538ed4c -[GTMSessionFetcher beginFetchMayDelay:mayAuthorize:] (GTMSessionFetcher.m:761)
4  App                            0x1052b81f0 -[FIRAuthBackendRPCIssuerImplementation asyncPostToURLWithRequestConfiguration:URL:body:contentType:completionHandler:] (FIRAuthBackend.m:541)
5  App                            0x1052b9e84 -[FIRAuthBackendRPCImplementation postWithRequest:response:callback:] (FIRAuthBackend.m:805)
6  App                            0x1052b9050 -[FIRAuthBackendRPCImplementation secureToken:callback:] (FIRAuthBackend.m:655)
7  App                            0x1052b79b0 +[FIRAuthBackend secureToken:callback:] (FIRAuthBackend.m:449)
8  App                            0x1052c9d38 -[FIRSecureTokenService requestAccessToken:] (FIRSecureTokenService.m:200)
9  App                            0x1052c9814 __65-[FIRSecureTokenService fetchAccessTokenForcingRefresh:callback:]_block_invoke (FIRSecureTokenService.m:118)
10 App                            0x1052bf164 __38-[FIRAuthSerialTaskQueue enqueueTask:]_block_invoke (FIRAuthSerialTaskQueue.m:49)
11 libdispatch.dylib              0x183c28b24 _dispatch_call_block_and_release
12 libdispatch.dylib              0x183c28ae4 _dispatch_client_callout
13 libdispatch.dylib              0x183c671b4 _dispatch_queue_serial_drain$VARIANT$armv81
14 libdispatch.dylib              0x183c67ad8 _dispatch_queue_invoke$VARIANT$armv81
15 libdispatch.dylib              0x183c67074 _dispatch_queue_serial_drain$VARIANT$armv81
16 libdispatch.dylib              0x183c67ad8 _dispatch_queue_invoke$VARIANT$armv81
17 libdispatch.dylib              0x183c6847c _dispatch_root_queue_drain_deferred_wlh$VARIANT$armv81
18 libdispatch.dylib              0x183c7044c _dispatch_workloop_worker_thread$VARIANT$armv81
19 libsystem_pthread.dylib        0x183f5be70 _pthread_wqthread
20 libsystem_pthread.dylib        0x183f5bb08 start_wqthread

@paulb777
Copy link
Member

@dsanghan Are you using FirebasePerformance? This looks similar to #213.

@dsanghan
Copy link
Author

dsanghan commented May 31, 2018

@paulb777: No. I think this is just a bug in FIRAuthBackendRPCIssuerImplementation . From Podfile.lock:

  - FirebaseAnalytics (5.0.0):
    - FirebaseCore (~> 5.0)
    - FirebaseInstanceID (~> 3.0)
    - "GoogleToolboxForMac/NSData+zlib (~> 2.1)"
    - nanopb (~> 0.3)
  - FirebaseAuth (5.0.0):
    - FirebaseCore (~> 5.0)
    - GTMSessionFetcher/Core (~> 1.1)
  - FirebaseCore (5.0.1):
    - "GoogleToolboxForMac/NSData+zlib (~> 2.1)"
  - FirebaseDatabase (5.0.0):
    - FirebaseCore (~> 5.0)
    - leveldb-library (~> 1.18)
  - FirebaseInstanceID (3.0.0):
    - FirebaseCore (~> 5.0)
  - FirebaseMessaging (3.0.0):
    - FirebaseCore (~> 5.0)
    - FirebaseInstanceID (~> 3.0)
    - GoogleToolboxForMac/Logger (~> 2.1)
    - Protobuf (~> 3.1)

It's probably asking GTMSessionFetcher to expire and then re-using it anyways.

@paulb777
Copy link
Member

@dsanghan Are you able to share a reproducible test case or debug it yourself with breakpoints in FIRAuthBackendRPCIssuerImplementation?

@morganchen12 morganchen12 self-assigned this Jun 21, 2018
@paulb777 paulb777 added this to the M29 milestone Jun 26, 2018
@firebase firebase locked and limited conversation to collaborators Nov 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants