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

Subscriptions auto reconnect not working in 3.x #317

Closed
mxalbert1996 opened this issue Oct 5, 2020 · 1 comment
Closed

Subscriptions auto reconnect not working in 3.x #317

mxalbert1996 opened this issue Oct 5, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@mxalbert1996
Copy link
Contributor

Describe the bug
AppSync SDK is not trying to reconnect after connection failure.

com.apollographql.apollo.exception.ApolloException: Subscription failed.
    at com.amazonaws.mobileconnectors.appsync.WebSocketConnectionManager.notifyFailure(WebSocketConnectionManager.java:212)
    at com.amazonaws.mobileconnectors.appsync.WebSocketConnectionManager.access$400(WebSocketConnectionManager.java:39)
    at com.amazonaws.mobileconnectors.appsync.WebSocketConnectionManager$1.onFailure(WebSocketConnectionManager.java:141)
    at okhttp3.internal.ws.RealWebSocket.failWebSocket(RealWebSocket.kt:592)
    at okhttp3.internal.ws.RealWebSocket$connect$1.onResponse(RealWebSocket.kt:197)
    at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    at java.lang.Thread.run(Thread.java:764)
 Caused by: javax.net.ssl.SSLException: Read error: ssl=0x7b1b2808: I/O error during system call, Software caused connection abort
    at com.android.org.conscrypt.NativeCrypto.SSL_read(Native Method)
    at com.android.org.conscrypt.NativeSsl.read(NativeSsl.java:399)
    at com.android.org.conscrypt.ConscryptFileDescriptorSocket$SSLInputStream.read(ConscryptFileDescriptorSocket.java:546)
    at okio.InputStreamSource.read(JvmOkio.kt:90)
    at okio.AsyncTimeout$source$1.read(AsyncTimeout.kt:129)
    at okio.RealBufferedSource.request(RealBufferedSource.kt:207)
    at okio.RealBufferedSource.require(RealBufferedSource.kt:201)
    at okio.RealBufferedSource.readByte(RealBufferedSource.kt:210)
    at okhttp3.internal.ws.WebSocketReader.readHeader(WebSocketReader.kt:119)
    at okhttp3.internal.ws.WebSocketReader.processNextFrame(WebSocketReader.kt:102)
    at okhttp3.internal.ws.RealWebSocket.loopReader(RealWebSocket.kt:293)
    at okhttp3.internal.ws.RealWebSocket$connect$1.onResponse(RealWebSocket.kt:195)
    at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
    at java.lang.Thread.run(Thread.java:764) 

To Reproduce
For example you can disable Wi-Fi while a subscription is active.

Expected behavior
AppSync SDK should try to reconnect if subscriptionsAutoReconnect is enabled (which is by default).

Environment(please complete the following information):

  • AppSync SDK Version: 3.1.1

Device Information (please complete the following information):

  • Device: All devices
  • Android Version: Pie 9.0

Additional context
The only place where subscriptionsAutoReconnect is used in the library seems to be the legacy MQTT-related code.
In the code where WebSockets are created, there is no occurences of subscriptionsAutoReconnect and no reconnecting logic in the onFailure callback of the WebSocketListener, which is needed because OkHttp will not automatically try to reconnect unless you mannually do so.

@richardmcclellan
Copy link
Contributor

The 2.x releases use MQTT as a subscription transport, instead of WebSockets, as in 3.x. If you are blocked by this error, please try using 2.x.

@raphkim raphkim added the bug Something isn't working label Nov 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants