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

Authentication exception #347

Closed
jphribovsek opened this issue Sep 12, 2014 · 7 comments · Fixed by #369
Closed

Authentication exception #347

jphribovsek opened this issue Sep 12, 2014 · 7 comments · Fixed by #369
Labels
Milestone

Comments

@jphribovsek
Copy link

We have a few crash reports regarding a missing auth token, even though we have checks in place to not start simperium if token is nil

Thread : Fatal Exception: NSInternalInconsistencyException
0  CoreFoundation                 0x2f6e5ecb __exceptionPreprocess + 130
1  libobjc.A.dylib                0x3a1b0ce7 objc_exception_throw + 38
2  CoreFoundation                 0x2f6e5d9d +[NSException raise:format:]
3  Foundation                     0x30093e2f -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 90
4  xxxxxxxxxx                     0x00b49aad -[SPWebSocketInterface authenticateChannel:] (SPWebSocketInterface.m:149)
5  xxxxxxxxxx                     0x00b49463 -[SPWebSocketInterface startChannels] (SPWebSocketInterface.m:115)
6  xxxxxxxxxx                     0x00b4a74b -[SPWebSocketInterface webSocketDidOpen:] (SPWebSocketInterface.m:284)
7  xxxxxxxxxx                     0x00b3862f -[SPWebSocket webSocketDidOpen:] (SPWebSocket.m:111)
8  xxxxxxxxxx                     0x00b43fe9 __36-[SRWebSocket _HTTPHeadersDidFinish]_block_invoke (SRWebSocket.m:496)
9  libdispatch.dylib              0x3a699d53 _dispatch_call_block_and_release + 10
10 libdispatch.dylib              0x3a699d3f _dispatch_client_callout + 22
11 libdispatch.dylib              0x3a69c6c3 _dispatch_main_queue_callback_4CF + 278
12 CoreFoundation                 0x2f6b0641 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
13 CoreFoundation                 0x2f6aef0d __CFRunLoopRun + 1308
14 CoreFoundation                 0x2f619729 CFRunLoopRunSpecific + 524
15 CoreFoundation                 0x2f61950b CFRunLoopRunInMode + 106
16 GraphicsServices               0x345456d3 GSEventRunModal + 138
17 UIKit                          0x31f7a871 UIApplicationMain + 1136
18 xxxxxxxxxx                     0x0006df53 main (main.m:12)
19 libdyld.dylib                  0x3a6aeab7 start + 2
@jleandroperez jleandroperez added this to the v0.7.0 milestone Sep 12, 2014
@jleandroperez
Copy link
Contributor

Hello JP,

Have you been able to reproduce this? Just by chance, do you have any details about the scenario that triggers this crash?.

I've been unable to spot a flow that would open the websocket, without calling any of the authentication calls. Currently, these are the flows that open the WebSocket:

  • Method authenticateWithAppID:token:, with valid parameters
  • Reachability event, with an authenticated user
  • Authentication UI callback

This bug would require any of the 3 flows outlined above, with a nil authToken. Would you please confirm that you're not setting the SPUser instance anyhow?

Thank you!

@jphribovsek
Copy link
Author

Hi Jorge,

No, I am not able to reproduce it, we have a low volume of this kind of crashes.
Ans I confirm that I am not setting SPUser

Thanks

@jleandroperez
Copy link
Contributor

@jphribovsek sorry about the lag on this one!.

Would you please confirm if SPWebSocketInterface, line 149 looks like this for you?:

NSAssert(self.simperium.clientID, @"Missing clientID");

Is it possible you're destroying the Simperium instance at any point? (that would be one potential candidate for this, since clientID property is never nil'ed out, but the reference between SPWebSocketInterface and Simperium is weak).

Thanks!

@jphribovsek
Copy link
Author

Yes, I confirm.

In our latest release, we have had only one crash report related to that, this is very low priority. I would be ok if we close this issue for now, and reopen if that becomes a problem again.

@jleandroperez
Copy link
Contributor

@jphribovsek this crash would be triggered by a dirty dealloc (say, the instance wasn't properly logged-out), while a network glitch occurred, and a websocket reconnection got triggered.

Nuking the Simperium instance isn't the common scenario, but as long as the app performs a clean signout, this shouldn't be a problem.

If needed, please, feel free to reopen. Thank you!

@jleandroperez jleandroperez reopened this Oct 10, 2014
@jleandroperez jleandroperez changed the title authentication exception Authentication exception Oct 10, 2014
@jleandroperez jleandroperez modified the milestones: v0.7.1, v0.7.0 Oct 10, 2014
@jleandroperez
Copy link
Contributor

I've been able to trigger this crash. Although the real problem here is not to wait until the Signout call completes, i'll add a workaround so at least it doesn't assert during unit tests.

@jleandroperez
Copy link
Contributor

@jphribovsek fix for the assertion merged into develop.

Important:

Please, note that an error will be logged. Not waiting for the signout's completion, and starting sync'ing again might lead to data loss, if the remove local data flag was set to true.

Thank you!

This was referenced Oct 15, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants