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

Error during SignIn - null object reference #3608

Open
mortphose opened this issue Jul 10, 2024 · 7 comments
Open

Error during SignIn - null object reference #3608

mortphose opened this issue Jul 10, 2024 · 7 comments
Labels
bug Something isn't working cognito Issues with the AWS Android SDK for Cognito

Comments

@mortphose
Copy link

Describe the bug
When using signIn, I rarely receive this error:

Fatal Exception: java.lang.NullPointerException: Attempt to invoke interface method 'void com.amazonaws.mobile.client.Callback.onError(java.lang.Exception)' on a null object reference
       at com.amazonaws.mobile.client.internal.InternalCallback.call(InternalCallback.java:77)
       at com.amazonaws.mobile.client.internal.InternalCallback.access$000(InternalCallback.java:34)
       at com.amazonaws.mobile.client.internal.InternalCallback$1.run(InternalCallback.java:103)
       at java.lang.Thread.run(Thread.java:923)

To Reproduce
Only way to reproduce it is using signIn, and even then, it's not every time.

Which AWS service(s) are affected?
android-sdk-mobile-client and maybe android-sdk-auth-userpools

Expected behavior
I don't expect this to happen with signIn.

Environment Information (please complete the following information):

  • AWS Android SDK Version: 2.75.1
  • Device: Any device, but currently - Pixel 2XL, Xiaomi Redmi A2, Blackshark 4, etc.
  • Android Version: 11-13, but potentially all supported versions.
  • Specific to simulators: No

Additional context
I'm not able to replicate this reliably, so I'm not sure how common this is for users.

@vincetran vincetran added the cognito Issues with the AWS Android SDK for Cognito label Jul 12, 2024
@vincetran
Copy link
Member

Hi @mortphose, thanks for your report. Can you provide the code snippet of your sign in code to better understand how it's being called? And is that the full stacktrace?

@vincetran vincetran added pending-community-response Issue is pending response from the issue requestor bug Something isn't working labels Jul 12, 2024
@mattcreaser mattcreaser added the closing soon Issue will auto-close if there is no additional activity within 7 days. label Jul 23, 2024
@mortphose
Copy link
Author

mortphose commented Jul 29, 2024

Apologies for the delay in my response, here's my sign in:

fun signIn(username: String?, password: String?) {
        AWSMobileClient.getInstance().signIn(username?.trim(), password?.trim(), null,
            object : Callback<SignInResult?> {
                override fun onResult(signInResult: SignInResult?) {
                    val signInState = signInResult?.signInState
                    when (signInState) {
                       <redacted>
                    }
                }

                override fun onError(e: Exception) {
                    <redacted>
                }
            }
        )
    }

It's a pretty basic call and function - I'm dealing with the data elsewhere after a login. I've also attached a firebase stacktrace.

firebase_aws_crash_stacktrace.txt

@lolucosmin
Copy link

@mortphose @vincetran can be link to this? #3572

@phantumcode phantumcode removed the closing soon Issue will auto-close if there is no additional activity within 7 days. label Aug 9, 2024
@mortphose
Copy link
Author

@lolucosmin doesn't look like any of the errors I've seen on my end, but can't rule out being related.

@tylerjroach tylerjroach added pending-maintainer-response Issue is pending response from an Amplify team member and removed pending-community-response Issue is pending response from the issue requestor labels Aug 13, 2024
@tylerjroach
Copy link
Member

I believe there may be a race condition here where onError is firing twice and the second time userCallback is null.

The value gets set to Done and is not supposed to fire again, but if different threads try to provide a callback at the same time, a race condition may allow this null pointer.

We will look into fixing.

@tylerjroach tylerjroach removed the pending-maintainer-response Issue is pending response from an Amplify team member label Aug 16, 2024
@lgassense
Copy link

@tylerjroach any progress on that?

@github-actions github-actions bot added the pending-maintainer-response Issue is pending response from an Amplify team member label Oct 23, 2024
@vincetran
Copy link
Member

@lgassense Unfortunately we haven't been able to carve out the time to come back into this yet but we'll be sure to update the issue once we do.

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending response from an Amplify team member label Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cognito Issues with the AWS Android SDK for Cognito
Projects
None yet
Development

No branches or pull requests

7 participants