-
Notifications
You must be signed in to change notification settings - Fork 29
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
IterableAuthManager.decodedExpiration(): infinite retry loop caused by an ArrayIndexOutOfBoundsException #617
Comments
A short logcat output about that:
|
Thank you @GBouerat for raising this issue with all the detailed logs! What is the format of passed authToken here? Does it conform to jwt authtoken format? Or is it a case where empty/ different/ malformed string is passed? Also, would be great if you could provide steps to reproduce this issue. Thanks again. |
It happens when for some reasons one of ours debug builds returns an empty string |
The idea of retry was to overcome the situation where When we set Would you be able to take a look into what makes the app return empty strings even for the subsequent attempts? |
Hi, we are facing a similar situation, is stated in the docs that the token will be requested in the following situations:
However the Iterable SDK is trying to get a token from the start even if we set the In our particular case the user needs to log in order to make a request to the backend so we can't provide a token to the Iterable SDK right away. Our expectation is that as soon as the user logs in we get the JWT token from our backend, set the email in iterable, call We can still do this but a lot of errors would happen in the background until the user logs in, is this expected? Thanks in advance. |
@Ayyanchira please help me, what token should be returned when the user logs out? |
While the retry mechanism is being taken a look at, it will be advisable to get jwt token for logged in user first and then use setEmail(email, authToken) for logging in the user. This will avoid many |
Hi @GBouerat following up on this, please see our updated Android SDK version 3.5.1, which includes a change that should prevent this issue. Let us know your results! |
Hi @punkrobot , @GBouerat ,and @baloghbalazsBB |
I just tried it, the retry really more stable :) Some thoughts:
I think we won't update to this version, because the requestNewAuthToken() is too complex, and I afraid that this will cause problems in production. We prefer to use the version 3.5.1 without the retry mechanism. |
@baloghbalazsBB thank you for trying it out and providing such a great feedback. My team highly appreciated it!
Thanks for pointing this out. Will have this logging part updated
Definitely great point. Incorporating more logs to understand why certain retries were skipped and when retryCount has maxed out 👍🏼 will be added in SDK |
The function
IterableAuthManager.decodedExpiration()
doesn't check the length of an array before reading the second index,iterable-android-sdk/iterableapi/src/main/java/com/iterable/iterableapi/IterableAuthManager.java
Line 131 in e8b6532
so this happens:
and when that happens, an auth token refresh is scheduled in 10 seconds which will encounter the same error and will lead to a kind of infinite loop.
Could you please do something about that ? thanks.
The text was updated successfully, but these errors were encountered: