-
Notifications
You must be signed in to change notification settings - Fork 45
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
Fix for a crash in logout (closes #263) #303
Conversation
Thanks for the PR. Could you sign our CLA? https://developer.okta.com/cla/ We will also want to add a test for this. Could you do that? |
I have already signed SLA with my first pull request. Is it required to sign it for every PR? I added the test for this. |
Sorry, we don't have an easy way to check for CLAs, one signature is enough. Thanks. |
@@ -134,6 +139,29 @@ public void handleAuthorizationResponseLogoutSuccess() throws AuthorizationExcep | |||
assert (resultTypeCapture.getValue() == AuthenticationResultHandler.ResultType.SIGN_OUT); | |||
} | |||
|
|||
@Test | |||
public void handleAuthorizationResponseLogoutSuccessWhenFragmentManagerIsDestroyed() throws AuthorizationException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test doesn't fail in our master branch, which I'd expect it to given the change in production code.
I'm also not in love with this fix. We don't have any way to notify the caller that their logout failed, and didn't do what they expected. I think this could be detected in application logic by checking if the activity is finished before calling into the Okta SDK. |
This is how we call Okta SDK for logout:
So I don't see a way how we could check if activity is finished before calling Okta SDK. I think this check needs to be inside Okta SDK. Do you have some suggestions how to do it better? I don't have a big knowledge of internals of the SDK and didn't want to change it too much. |
For step 2, could you wrap that in an |
You might be right, we never finish the activity before we get callback from the SDK. But the user could do that. I will add that if and let you know in the issue if that stopped the crashes. I will close this PR for now. |
Thank you! And thanks again for putting the time in to post a PR. Really appreciate it. |
Did this fixed the crash for |
Hi @ashish-d-hh please see #263 as we're still working through it in that issue. |
Reopening based on discussion in the issue. |
@davidvavra Sure. If you want to remove the test portion of the PR, I can merge that, and follow up with a test in another PR. |
This reverts commit 1dfebb0.
Thanks, reverted. |
We see crashes in logout in our production app. Here is the stacktrace:
The app crashes, because
FragmentManager
is destroyed, but the SDK is trying to commit aFragment
transaction.I'm not sure about the root cause, but the fix is a simple check if
FragmentManager
is destroyed. It should not crash in this case and normal functionality should not be affected.Closes this issue: #263