-
Notifications
You must be signed in to change notification settings - Fork 549
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
Response timeout issues in the AWS SDK for Android #3492
Comments
Thanks for reporting the issue. I have following questions:
|
|
Hello, |
Hello, |
Hello @ankpshah Regarding the custom timeout in my app, it is not worth implementing. Because in the IPv6 situation, it will solve the problem of freezing the application, but my client will never be able to login to the application. |
Any news about this bug? |
Hello,
Otherwise returns Cached User Details. At no point application is freezes or goes in ANR state. I also verified that Http Client uses backoff strategy as configured in ClientConfiguration class. As I am unable to replicate the issue I need to understand where exactly application freezes. It was mentioned earlier that it freezes at cognitoIdentityProviderClient.getUser() but there are more calls within this method.
|
@jflmateusnassar In reading this: "To simulate the problem here I created a rule in my router to block packets" Are you blocking writes out from the device, but possibly not incoming data? Android/Java's HttpsUrlConnection allows connectTimeout and readTimeout values to be set.
You may have created a scenario where the device is allowed to make a connection to the url, potentially read from the url, but is in an infinitate wait period trying to write to the connection (connection.getOutputStream). A custom timer task on our end could potentially help to resolve this, but I want to understand the real world scenarios of this ocurring, as the forced used case feels like a significant edge case. Can you provide more info on how often you are seeing this happen in your app. Is it believed that in these scenarios the customer may be in a situation such as being in a captive portal (ex: hotel, or airplane internet paywall) |
Connect timeout and read timeout are set, but are completely ignored in this scenario. |
Can you elaborate on what you are referring to by "freezing"? "Regarding the custom timeout in my app, it is not worth implementing. Because in the IPv6 situation, it will solve the problem of freezing the application, but my client will never be able to login to the application." Any of these calls should be run in the background and not freeze the ui. I see in your screenshot that you are just showing a white screen. You should be able to continue updating the UI however you think is best for your application (Possibly letting the customer know they seem to not have internet access). |
When I make any request to the SDK (logging in with Cognito, sending data to IoT Core, accessing Dynamo DB) the SDK never returns a value. I could implement a custom timeout, to close the splash screen and to close the loadings reporting a net error, but I opened the issue to see with you what else could be done or if you can do something about it. |
Thanks for the context on the splash screen. We can continue to look at what a reasonable solution would be here, but from what I'm gathering, this would be a writeTimeout. I do not think it would be safe to use either of the other 2 timeouts in our ClientConfig (especially since the change could alter current expected behavior). The implementation of this config would require additional reviews on our end since it expands the API surface of ClientConfig. If setting a timeout on your end is reasonable on your end, I would suggest to do so at the moment. I can update this ticket if any changes are pushed on our end that would help your scenario. |
Ok, I got it. And I will implement custom timeout. Now, to close this case, I would like to know why in the Android SDK most of my customers who use IPv6 have this same problem. Those who use IPv4 do not have this problem. I have the same application for the iOS platform that uses the SDK and works in any situation, both IPv6 and IPv4. Never had a problem. The real reason I opened this issue is this error with IPv6 that my many customers have. Is there any way to force the use of IPv4 only? (if yes, I believe this would solve all my problems) |
@jflmateusnassar We do not have any special logic in handling IPv4 and IPv6. That is entirely done by Android's default network stack. I want to make sure I understand the scenario you believe is happening, correct me if I am wrong. You believe that IPv6 + Android SDK are not working correctly for many customers that have full internet access (send/receive)? We've been looking at this replication scenario where the customer is unable to send packets with speculation their internet may be blocked in some way (ex captive portal). In the first message you stated "An important detail is also that the problem also occurs on networks that do not support IPv6", but the last message says "Those who use IPv4 do not have this problem". I'm not sure about differences between Android and IOS, except for that they have entirely different network stacks. We are using HttpsUrlConnection on Android, which is the default network stack for Android. Our newer Amplify v2 and the Kotlin SDK, instead use OkHttp. |
I can't tell you that customers have full access to the internet. This always depends on the customer's internet provider and I don't have access. But I believe there is some blocking, but not a total blocking of the network. About this statement:
When I wrote the message I still didn't understand correctly how the problem occurred with IPv6, but now I managed to discover that the problem always occurs when IPv6 is supported and there is probably some type of blocking. This I believe is the correct scenario. Note: When I say that he does not have a total internet block, I mean that he can access websites normally with the network using IPv6. But our app freezes. |
I did a test with the custom timeout implementation, and it solved the freezing problem. Every time I try to login with cognito it gets stuck in executeHelper() method. If I try 10 times, it will get stuck 10 times, consuming the smartphone's memory resources unnecessarily. For this reason I think you better:
I like option 2 more. I believe it is possible to do this without too many problems. |
@jflmateusnassar I agree, it is not optimal for these calls to be left hanging in the sdk. Will mark as a task for our team to further take a look and will update this ticket when we have updates to provide. Thank you for your help in investigating this. |
@tylerjroach Ok, thank you very much for your help and information. |
Describe the bug
I encountered a problem in the AWS SDK for Android that took me a long time to understand how it happened. Today, after a few years, I discovered how to reproduce the problem.
The problem occurs when the smartphone is connected to a Wi-Fi network that has no internet access, but the Android did not detect that there is a problem in the network.
The bug is that any request that I make using the SDK to fetch some data (Cognito, IoT Core, DynamoDB, etc.) has no return from the SDK, and the application simply freezes.
To Reproduce
Connect the android to a wifi network without connection, but the android cannot detect that there is a problem with the wifi. To simulate the problem here I created a rule in my router to block packets. The android takes about 5 minutes to detect that there is a problem with the wifi network and that's where all the problems occur.
An example of a request that causes the problem is:
When invoking this method, nothing is returned (no error, no success, no failure, no timeout). Debugging inside this method, I found out that it invokes the method:
The exact point where the application freezes is in:
Which AWS service(s) are affected?
I use Cognito, IoT Core, DynamoDB services and they are all affected. I think any service will be affected.
Expected behavior
The request should return a timeout error, but this does not happen.
Environment Information:
Additional context
I need to highlight that Android needs to be on a WiFi network that does not have access to the internet, but Android cannot detect that there is a problem with the network.
When Android detects that there is a problem on the network, the SDK returns a failure (which is expected)
An important detail is also that the problem also occurs on networks that do not support IPv6
The text was updated successfully, but these errors were encountered: