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

AppsyncMutationCall retry error in Appsync Android SDK #72

Closed
palpatim opened this issue Nov 28, 2018 · 2 comments
Closed

AppsyncMutationCall retry error in Appsync Android SDK #72

palpatim opened this issue Nov 28, 2018 · 2 comments
Assignees
Labels
pending-response Issue is pending response from the issue requestor question General question

Comments

@palpatim
Copy link
Contributor

palpatim commented Nov 28, 2018

(Migrating this issue from the AWS Forums on behalf of forums user ep-mt)

Describe the bug
I'm developing a chat screen with AWS Appsync and I found an error or probably a bug when the AppsyncMutationCall fails.

I'm trying to send 4 messages (4 mutations) with my Android phone with none internet connection signal. Then AppsyncMutationCall fails throwing the following exception:

 E/ChatManager$$Lambda: com.apollographql.apollo.exception.ApolloNetworkException: Failed to execute http call
        at com.apollographql.apollo.internal.interceptor.ApolloServerInterceptor$1$1.onFailure(ApolloServerInterceptor.java:105)
        at okhttp3.RealCall$AsyncCall.execute(RealCall.java:161)
        at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
        at java.lang.Thread.run(Thread.java:764)
     Caused by: java.net.SocketTimeoutException: failed to connect to jpdpd773vrhnjnzojnxddagfli.appsync-api.us-east-1.amazonaws.com/13.33.131.80 (port 443) from /10.210.90.89 (port 47932) after 10000ms
        at libcore.io.IoBridge.connectErrno(IoBridge.java:185)
        at libcore.io.IoBridge.connect(IoBridge.java:130)
        at java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:129)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:365)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:209)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:191)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:356)
        at java.net.Socket.connect(Socket.java:616)
        at okhttp3.internal.platform.AndroidPlatform.connectSocket(AndroidPlatform.java:71)
        at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:240)
        at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:160)
        at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:257)
        at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:135)
        at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:114)
        at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
        at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
        at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:126)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
        at com.amazonaws.mobileconnectors.appsync.sigv4.AppSyncSigV4SignerInterceptor.intercept(AppSyncSigV4SignerInterceptor.java:165)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
        at com.amazonaws.mobileconnectors.appsync.retry.RetryInterceptor.intercept(RetryInterceptor.java:43)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
        at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200)
        at okhttp3.RealCall$AsyncCall.execute(RealCall.java:147)
        at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) 
        at java.lang.Thread.run(Thread.java:764) 

The problem is that when I turn on the WiFi and network connection is on again, my mutations are written in a wrong order. I think my app is trying to mutate every message at the same time instead of mutate the first and if success try the second, and the third in chain.Is there any way to chain mutations and maintain the order of my retries with the Appsync SDK?

To Reproduce
See above

Expected behavior
See above

Screenshots
N/A

@palpatim palpatim added bug Something isn't working AppSync labels Nov 28, 2018
@scb01
Copy link
Contributor

scb01 commented Dec 1, 2018

thanks @palpatim

ep-mt,

Can you provide logs and a code snippet to help debug this further. The way the code works is that all mutations are added to a queue (regardless of whether the device is online or offline). The mutations are executed sequentially from the queue, in the order they were added.

I have added an integration test to the code base that creates 10 mutations when the device is offline, turns the device back online and then validates that the sequence was maintained.

@scb01 scb01 added question General question pending-response Issue is pending response from the issue requestor and removed bug Something isn't working labels Dec 1, 2018
@scb01
Copy link
Contributor

scb01 commented Dec 19, 2018

ep-mt,

Version 2.7.1 of the SDK contains fixes for the queuing logic to address the issue that you reported. I will go ahead and close out this out as I haven't heard back - please feel free to reopen if you run into further issues.

@scb01 scb01 closed this as completed Dec 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending-response Issue is pending response from the issue requestor question General question
Projects
None yet
Development

No branches or pull requests

3 participants