Open stam0912 opened 3 months ago
Hi @stam0912, we're looking into this issue now and will get back to you with any updates.
Hi @stam0912, we have been working to reproduce the issue on our end but so far have been unable to. Just for confirm, are you turning off wifi while keeping data on? Or are you turning off wifi while data is off, cutting off all network to the device?
Hi @khatruong2009, I encountered errors when
Using data only, then turn off the data and turn it back on
Having both WiFi and data turned on, then turn off WiFi and turn it back on, after 10 seconds I'll get:
W/amplify:aws-api(20780): Websocket connection failed. W/amplify:aws-api(20780): java.net.SocketException: Software caused connection abort W/amplify:aws-api(20780): at java.net.SocketInputStream.socketRead0(Native Method) W/amplify:aws-api(20780): at java.net.SocketInputStream.socketRead(SocketInputStream.java:118) W/amplify:aws-api(20780): at java.net.SocketInputStream.read(SocketInputStream.java:173) W/amplify:aws-api(20780): at java.net.SocketInputStream.read(SocketInputStream.java:143) W/amplify:aws-api(20780): at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.readFromSocket(ConscryptEngineSocket.java:983) W/amplify:aws-api(20780): at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.processDataFromSocket(ConscryptEngineSocket.java:947) W/amplify:aws-api(20780): at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.readUntilDataAvailable(ConscryptEngineSocket.java:862) W/amplify:aws-api(20780): at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.read(ConscryptEngineSocket.java:835) W/amplify:aws-api(20780): at okio.InputStreamSource.read(JvmOkio.kt:93) W/amplify:aws-api(20780): at okio.AsyncTimeout$source$1.read(AsyncTimeout.kt:128) W/amplify:aws-api(20780): at okio.RealBufferedSource.request(RealBufferedSource.kt:209) W/amplify:aws-api(20780): at okio.RealBufferedSource.require(RealBufferedSource.kt:202) W/amplify:aws-api(20780): at okio.RealBufferedSource.readByte(RealBufferedSource.kt:212) W/amplify:aws-api(20780): at okhttp3.internal.ws.WebSocketReader.readHeader(WebSocketReader.kt:119) W/amplify:aws-api(20780): at okhttp3.internal.ws.WebSocketReader.processNextFrame(WebSocketReader.kt:102) W/amplify:aws-api(20780): at okhttp3.internal.ws.RealWebSocket.loopReader(RealWebSocket.kt:293) W/amplify:aws-api(20780): at okhttp3.internal.ws.RealWebSocket$connect$1.onResponse(RealWebSocket.kt:195) W/amplify:aws-api(20780): at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:539) W/amplify:aws-api(20780): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) W/amplify:aws-api(20780): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644) W/amplify:aws-api(20780): at java.lang.Thread.run(Thread.java:1012) W/amplify:aws-datastore(20780): API sync failed - transitioning to LOCAL_ONLY. W/amplify:aws-datastore(20780): DataStoreException{message=Error during subscription., cause=ApiException{message=Subscription failed., cause=java.net.SocketException: Software caused connection abort, recoverySuggestion=Check your Internet connection. Is your device online?}, recoverySuggestion=Evaluate details.} W/amplify:aws-datastore(20780): at com.amplifyframework.datastore.appsync.AppSyncClient.lambda$subscription$2(AppSyncClient.java:322) W/amplify:aws-datastore(20780): at com.amplifyframework.datastore.appsync.AppSyncClient$$ExternalSyntheticLambda1.accept(D8$$SyntheticClass:0) W/amplify:aws-datastore(20780): at com.amplifyframework.api.aws.SubscriptionOperation.lambda$start$1$com-amplifyframework-api-aws-SubscriptionOperation(SubscriptionOperation.java:87) W/amplify:aws-datastore(20780): at com.amplifyframework.api.aws.SubscriptionOperation$$ExternalSyntheticLambda3.accept(D8$$SyntheticClass:0) W/amplify:aws-datastore(20780): at com.amplifyframework.api.aws.SubscriptionEndpoint$Subscription.dispatchError(SubscriptionEndpoint.java:468) W/amplify:aws-datastore(20780): at com.amplifyframework.api.aws.SubscriptionEndpoint.notifyError(SubscriptionEndpoint.java:242) W/amplify:aws-datastore(20780): at com.amplifyframework.api.aws.SubscriptionEndpoint.-$$Nest$mnotifyError(Unknown Source:0) W/amplify:aws-datastore(20780): at com.amplifyframework.api.aws.SubscriptionEndpoint$AmplifyWebSocketListener.onFailure(SubscriptionEndpoint.java:563) W/amplify:aws-datastore(20780): at okhttp3.internal.ws.RealWebSocket.failWebSocket(RealWebSocket.kt:592) W/amplify:aws-datastore(20780): at okhttp3.internal.ws.RealWebSocket$connect$1.onResponse(RealWebSocket.kt:197) W/amplify:aws-datastore(20780): at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:539) W/amplify:aws-datastore(20780): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) W/amplify:aws-datastore(20780): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644) W/amplify:aws-datastore(20780): at java.lang.Thread.run(Thread.java:1012) W/amplify:aws-datastore(20780): Caused by: ApiException{message=Subscription failed., cause=java.net.SocketException: Software caused connection abort, recoverySuggestion=Check your Internet connection. Is your device online?} W/amplify:aws-datastore(20780): ... 9 more W/amplify:aws-datastore(20780): Caused by: java.net.SocketException: Software caused connection abort W/amplify:aws-datastore(20780): at java.net.SocketInputStream.socketRead0(Native Method) W/amplify:aws-datastore(20780): at java.net.SocketInputStream.socketRead(SocketInputStream.java:118) W/amplify:aws-datastore(20780): at java.net.SocketInputStream.read(SocketInputStream.java:173) W/amplify:aws-datastore(20780): at java.net.SocketInputStream.read(SocketInputStream.java:143) W/amplify:aws-datastore(20780): at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.readFromSocket(ConscryptEngineSocket.java:983) W/amplify:aws-datastore(20780): at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.processDataFromSocket(ConscryptEngineSocket.java:947) W/amplify:aws-datastore(20780): at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.readUntilDataAvailable(ConscryptEngineSocket.java:862) W/amplify:aws-datastore(20780): at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.read(ConscryptEngineSocket.java:835) W/amplify:aws-datastore(20780): at okio.InputStreamSource.read(JvmOkio.kt:93) W/amplify:aws-datastore(20780): at okio.AsyncTimeout$source$1.read(AsyncTimeout.kt:128) W/amplify:aws-datastore(20780): at okio.RealBufferedSource.request(RealBufferedSource.kt:209) W/amplify:aws-datastore(20780): at okio.RealBufferedSource.require(RealBufferedSource.kt:202) W/amplify:aws-datastore(20780): at okio.RealBufferedSource.readByte(RealBufferedSource.kt:212) W/amplify:aws-datastore(20780): at okhttp3.internal.ws.WebSocketReader.readHeader(WebSocketReader.kt:119) W/amplify:aws-datastore(20780): at okhttp3.internal.ws.WebSocketReader.processNextFrame(WebSocketReader.kt:102) W/amplify:aws-datastore(20780): at okhttp3.internal.ws.RealWebSocket.loopReader(RealWebSocket.kt:293) W/amplify:aws-datastore(20780): at okhttp3.internal.ws.RealWebSocket$connect$1.onResponse(RealWebSocket.kt:195) W/amplify:aws-datastore(20780): ... 4 more I/amplify:aws-datastore(20780): Orchestrator transitioning from SYNC_VIA_API to LOCAL_ONLY I/amplify:aws-datastore(20780): Stopping subscription processor. I/amplify:aws-datastore(20780): Stopped subscription processor. I/amplify:aws-datastore(20780): Setting currentState to LOCAL_ONLY
Having both WiFi and data turned on, then turn off both
Hi @stam0912, I was able to reproduce this issue and get the same error that you listed above. The following issue has been marked as a bug. We will work to address it and get back to you with any updates.
Hi @stam0912, I was able to reproduce this issue and get the same error that you listed above. The following issue has been marked as a bug. We will work to address it and get back to you with any updates.
Hi @khatruong2009 , is there any update on this issue?
Hi @stam0912, we are still working to determine the root cause of the issue. Thank you for your patience and we will get back to you with any updates.
Hi @stam0912, we are still working to determine the root cause of the issue. Thank you for your patience and we will get back to you with any updates.
Is there any workaround? I tried adding a sync button which triggers a datastore clear , stop and start, but it doesn't help. I'm still seeing errors.
Hi @stam0912, we're still working on this issue and don't have any updates at the moment. We'll let you know as soon as we have one.
Description
I'm getting errors after internet interruption (tested on Android 14 emulator and physical device). I've been testing it repeatedly, and I found the error occurs if I use mobile data (or have both wifi and mobile data turned on, error occurs if I toggle the wifi and mobile data). I believe that's also the reason why the app won't sync after waking up from app standby mode and device doze mode.
It works fine if I use WiFi only. The app is able to close the web socket when there is no internet, and it can reconnect and start subscription successfully after the internet is back.
Turn off WiFi (WiFi -> none) W/amplify:aws-api(20780): Websocket connection failed. W/amplify:aws-api(20780): java.net.SocketException: Software caused connection abort W/amplify:aws-api(20780): at java.net.SocketInputStream.socketRead0(Native Method) W/amplify:aws-api(20780): at java.net.SocketInputStream.socketRead(SocketInputStream.java:118) W/amplify:aws-api(20780): at java.net.SocketInputStream.read(SocketInputStream.java:173) W/amplify:aws-api(20780): at java.net.SocketInputStream.read(SocketInputStream.java:143) W/amplify:aws-api(20780): at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.readFromSocket(ConscryptEngineSocket.java:983) W/amplify:aws-api(20780): at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.processDataFromSocket(ConscryptEngineSocket.java:947) W/amplify:aws-api(20780): at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.readUntilDataAvailable(ConscryptEngineSocket.java:862) W/amplify:aws-api(20780): at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.read(ConscryptEngineSocket.java:835) W/amplify:aws-api(20780): at okio.InputStreamSource.read(JvmOkio.kt:93) W/amplify:aws-api(20780): at okio.AsyncTimeout$source$1.read(AsyncTimeout.kt:128) W/amplify:aws-api(20780): at okio.RealBufferedSource.request(RealBufferedSource.kt:209) W/amplify:aws-api(20780): at okio.RealBufferedSource.require(RealBufferedSource.kt:202) W/amplify:aws-api(20780): at okio.RealBufferedSource.readByte(RealBufferedSource.kt:212) W/amplify:aws-api(20780): at okhttp3.internal.ws.WebSocketReader.readHeader(WebSocketReader.kt:119) W/amplify:aws-api(20780): at okhttp3.internal.ws.WebSocketReader.processNextFrame(WebSocketReader.kt:102) W/amplify:aws-api(20780): at okhttp3.internal.ws.RealWebSocket.loopReader(RealWebSocket.kt:293) W/amplify:aws-api(20780): at okhttp3.internal.ws.RealWebSocket$connect$1.onResponse(RealWebSocket.kt:195) W/amplify:aws-api(20780): at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:539) W/amplify:aws-api(20780): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) W/amplify:aws-api(20780): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644) W/amplify:aws-api(20780): at java.lang.Thread.run(Thread.java:1012) W/amplify:aws-datastore(20780): API sync failed - transitioning to LOCAL_ONLY. W/amplify:aws-datastore(20780): DataStoreException{message=Error during subscription., cause=ApiException{message=Subscription failed., cause=java.net.SocketException: Software caused connection abort, recoverySuggestion=Check your Internet connection. Is your device online?}, recoverySuggestion=Evaluate details.} W/amplify:aws-datastore(20780): at com.amplifyframework.datastore.appsync.AppSyncClient.lambda$subscription$2(AppSyncClient.java:322) W/amplify:aws-datastore(20780): at com.amplifyframework.datastore.appsync.AppSyncClient$$ExternalSyntheticLambda1.accept(D8$$SyntheticClass:0) W/amplify:aws-datastore(20780): at com.amplifyframework.api.aws.SubscriptionOperation.lambda$start$1$com-amplifyframework-api-aws-SubscriptionOperation(SubscriptionOperation.java:87) W/amplify:aws-datastore(20780): at com.amplifyframework.api.aws.SubscriptionOperation$$ExternalSyntheticLambda3.accept(D8$$SyntheticClass:0) W/amplify:aws-datastore(20780): at com.amplifyframework.api.aws.SubscriptionEndpoint$Subscription.dispatchError(SubscriptionEndpoint.java:468) W/amplify:aws-datastore(20780): at com.amplifyframework.api.aws.SubscriptionEndpoint.notifyError(SubscriptionEndpoint.java:242) W/amplify:aws-datastore(20780): at com.amplifyframework.api.aws.SubscriptionEndpoint.-$$Nest$mnotifyError(Unknown Source:0) W/amplify:aws-datastore(20780): at com.amplifyframework.api.aws.SubscriptionEndpoint$AmplifyWebSocketListener.onFailure(SubscriptionEndpoint.java:563) W/amplify:aws-datastore(20780): at okhttp3.internal.ws.RealWebSocket.failWebSocket(RealWebSocket.kt:592) W/amplify:aws-datastore(20780): at okhttp3.internal.ws.RealWebSocket$connect$1.onResponse(RealWebSocket.kt:197) W/amplify:aws-datastore(20780): at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:539) W/amplify:aws-datastore(20780): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) W/amplify:aws-datastore(20780): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644) W/amplify:aws-datastore(20780): at java.lang.Thread.run(Thread.java:1012) W/amplify:aws-datastore(20780): Caused by: ApiException{message=Subscription failed., cause=java.net.SocketException: Software caused connection abort, recoverySuggestion=Check your Internet connection. Is your device online?} W/amplify:aws-datastore(20780): ... 9 more W/amplify:aws-datastore(20780): Caused by: java.net.SocketException: Software caused connection abort W/amplify:aws-datastore(20780): at java.net.SocketInputStream.socketRead0(Native Method) W/amplify:aws-datastore(20780): at java.net.SocketInputStream.socketRead(SocketInputStream.java:118) W/amplify:aws-datastore(20780): at java.net.SocketInputStream.read(SocketInputStream.java:173) W/amplify:aws-datastore(20780): at java.net.SocketInputStream.read(SocketInputStream.java:143) W/amplify:aws-datastore(20780): at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.readFromSocket(ConscryptEngineSocket.java:983) W/amplify:aws-datastore(20780): at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.processDataFromSocket(ConscryptEngineSocket.java:947) W/amplify:aws-datastore(20780): at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.readUntilDataAvailable(ConscryptEngineSocket.java:862) W/amplify:aws-datastore(20780): at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.read(ConscryptEngineSocket.java:835) W/amplify:aws-datastore(20780): at okio.InputStreamSource.read(JvmOkio.kt:93) W/amplify:aws-datastore(20780): at okio.AsyncTimeout$source$1.read(AsyncTimeout.kt:128) W/amplify:aws-datastore(20780): at okio.RealBufferedSource.request(RealBufferedSource.kt:209) W/amplify:aws-datastore(20780): at okio.RealBufferedSource.require(RealBufferedSource.kt:202) W/amplify:aws-datastore(20780): at okio.RealBufferedSource.readByte(RealBufferedSource.kt:212) W/amplify:aws-datastore(20780): at okhttp3.internal.ws.WebSocketReader.readHeader(WebSocketReader.kt:119) W/amplify:aws-datastore(20780): at okhttp3.internal.ws.WebSocketReader.processNextFrame(WebSocketReader.kt:102) W/amplify:aws-datastore(20780): at okhttp3.internal.ws.RealWebSocket.loopReader(RealWebSocket.kt:293) W/amplify:aws-datastore(20780): at okhttp3.internal.ws.RealWebSocket$connect$1.onResponse(RealWebSocket.kt:195) W/amplify:aws-datastore(20780): ... 4 more I/amplify:aws-datastore(20780): Orchestrator transitioning from SYNC_VIA_API to LOCAL_ONLY I/amplify:aws-datastore(20780): Stopping subscription processor. I/amplify:aws-datastore(20780): Stopped subscription processor. I/amplify:aws-api(20780): No more active subscriptions. Closing web socket. I/amplify:aws-datastore(20780): Setting currentState to LOCAL_ONLY I/flutter (20780): Network is up: false I/flutter (20780): Connectivity changed (stream): [ConnectivityResult.none]
Turn on WiFi (none -> WiFi) I/flutter (20780): Connectivity changed (stream): [ConnectivityResult.wifi] I/amplify:aws-datastore(20780): Orchestrator transitioning from LOCAL_ONLY to SYNC_VIA_API I/amplify:aws-datastore(20780): Setting currentState to SYNC_VIA_API I/amplify:aws-datastore(20780): Starting API synchronization mode. I/amplify:aws-datastore(20780): Starting processing subscription events. I/flutter (20780): Network is up: true D/TrafficStats(20780): tagSocket(157) with statsTag=0xffffffff, statsUid=-1 I/amplify:aws-datastore(20780): Started subscription processor for models: [User, FcmNotification, Device] of types [ON_CREATE, ON_UPDATE, ON_DELETE]. I/flutter (20780): subscriptionsEstablished: DataStoreHubEventType.subscriptionsEstablished I/flutter (20780): syncQueriesStarted: [FcmNotification, Device, User] D/TrafficStats(20780): tagSocket(176) with statsTag=0xffffffff, statsUid=-1 I/amplify:aws-datastore(20780): Successfully sync'd down model state from cloud. I/flutter (20780): modelSynced: I/flutter (20780): name: FcmNotification isFullSync: false isDeltaSync: true added: 0 updated: 0 deleted: 0 I/amplify:aws-datastore(20780): Orchestrator lock acquired. I/amplify:aws-datastore(20780): DataStore plugin initialized. I/amplify:aws-datastore(20780): Orchestrator lock released. I/amplify:aws-datastore(20780): Orchestrator lock acquired. I/amplify:aws-datastore(20780): DataStore plugin initialized. I/amplify:aws-datastore(20780): Orchestrator lock released. I/amplify:aws-datastore(20780): Successfully sync'd down model state from cloud. I/flutter (20780): modelSynced: I/flutter (20780): name: Device isFullSync: false isDeltaSync: true added: 0 updated: 2 deleted: 0 I/amplify:aws-datastore(20780): Orchestrator lock acquired. I/amplify:aws-datastore(20780): DataStore plugin initialized. I/amplify:aws-datastore(20780): Orchestrator lock released. I/amplify:aws-datastore(20780): Orchestrator lock acquired. I/amplify:aws-datastore(20780): DataStore plugin initialized. I/amplify:aws-datastore(20780): Orchestrator lock released. I/amplify:aws-datastore(20780): Successfully sync'd down model state from cloud. I/amplify:aws-datastore(20780): Starting processing subscription data buffer. I/amplify:aws-datastore(20780): Started the orchestrator in API sync mode. I/amplify:aws-datastore(20780): Started processing the mutation outbox. Pending mutations will be published to the cloud. I/flutter (20780): modelSynced: I/flutter (20780): name: User isFullSync: false isDeltaSync: true added: 0 updated: 0 deleted: 0 I/flutter (20780): syncQueriesReady I/flutter (20780): Datastore ready I/flutter (20780): outboxState empty : true
I expect to see similar result when using mobile data, but it failed to reconnect after the internet is back.
Turn off mobile data (mobile data -> none) I/amplify:aws-datastore(20780): Orchestrator transitioning from SYNC_VIA_API to LOCAL_ONLY I/amplify:aws-datastore(20780): Stopping subscription processor. I/amplify:aws-datastore(20780): Stopped subscription processor. I/amplify:aws-datastore(20780): Setting currentState to LOCAL_ONLY I/flutter (20780): Network is up: false I/flutter (20780): Connectivity changed (stream): [ConnectivityResult.none] I/amplify:aws-api(20780): No more active subscriptions. Closing web socket.
Turn on mobile data (none -> mobile data) I/flutter (20780): Connectivity changed (stream): [ConnectivityResult.mobile] I/amplify:aws-datastore(20780): Orchestrator transitioning from LOCAL_ONLY to SYNC_VIA_API I/amplify:aws-datastore(20780): Setting currentState to SYNC_VIA_API I/amplify:aws-datastore(20780): Starting API synchronization mode. I/amplify:aws-datastore(20780): Starting processing subscription events. I/flutter (20780): Network is up: true D/TrafficStats(20780): tagSocket(181) with statsTag=0xffffffff, statsUid=-1 I/amplify:aws-datastore(20780): Started subscription processor for models: [User, FcmNotification, Device] of types [ON_CREATE, ON_UPDATE, ON_DELETE]. I/flutter (20780): subscriptionsEstablished: DataStoreHubEventType.subscriptionsEstablished I/flutter (20780): syncQueriesStarted: [FcmNotification, Device, User] W/amplify:aws-datastore(20780): Initial cloud sync failed for FcmNotification. W/amplify:aws-datastore(20780): DataStoreException{message=Failure performing sync query to AppSync., cause=ApiException{message=OkHttp client request failed., cause=java.net.SocketTimeoutException: timeout, recoverySuggestion=See attached exception for more details.}, recoverySuggestion=Sorry, we don’t have a recovery suggestion for this error.} W/amplify:aws-datastore(20780): at com.amplifyframework.datastore.appsync.AppSyncClient.lambda$sync$0(AppSyncClient.java:115) W/amplify:aws-datastore(20780): at com.amplifyframework.datastore.appsync.AppSyncClient$$ExternalSyntheticLambda4.accept(D8$$SyntheticClass:0) W/amplify:aws-datastore(20780): at com.amplifyframework.api.aws.AppSyncGraphQLOperation$OkHttpCallback.onFailure(AppSyncGraphQLOperation.java:163) W/amplify:aws-datastore(20780): at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:545) W/amplify:aws-datastore(20780): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) W/amplify:aws-datastore(20780): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644) W/amplify:aws-datastore(20780): at java.lang.Thread.run(Thread.java:1012) W/amplify:aws-datastore(20780): Caused by: ApiException{message=OkHttp client request failed., cause=java.net.SocketTimeoutException: timeout, recoverySuggestion=See attached exception for more details.} W/amplify:aws-datastore(20780): ... 5 more W/amplify:aws-datastore(20780): Caused by: java.net.SocketTimeoutException: timeout W/amplify:aws-datastore(20780): at okhttp3.internal.http2.Http2Stream$StreamTimeout.newTimeoutException(Http2Stream.kt:704) W/amplify:aws-datastore(20780): at okhttp3.internal.http2.Http2Stream$StreamTimeout.exitAndThrowIfTimedOut(Http2Stream.kt:713) W/amplify:aws-datastore(20780): at okhttp3.internal.http2.Http2Stream.takeHeaders(Http2Stream.kt:150) W/amplify:aws-datastore(20780): at okhttp3.internal.http2.Http2ExchangeCodec.readResponseHeaders(Http2ExchangeCodec.kt:96) W/amplify:aws-datastore(20780): at okhttp3.internal.connection.Exchange.readResponseHeaders(Exchange.kt:111) W/amplify:aws-datastore(20780): at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.kt:95) W/amplify:aws-datastore(20780): at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) W/amplify:aws-datastore(20780): at com.amplifyframework.api.aws.UserAgentInterceptor.intercept(UserAgentInterceptor.java:56) W/amplify:aws-datastore(20780): at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) W/amplify:aws-datastore(20780): at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:34) W/amplify:aws-datastore(20780): at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) W/amplify:aws-datastore(20780): at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95) W/amplify:aws-datastore(20780): at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) W/amplify:aws-datastore(20780): at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:84) W/amplify:aws-datastore(20780): at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) W/amplify:aws-datastore(20780): at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:65) W/amplify:aws-datastore(20780): at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) W/amplify:aws-datastore(20780): at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:205) W/amplify:aws-datastore(20780): at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:537) W/amplify:aws-datastore(20780): ... 3 more E/amplify:aws-datastore(20780): Failure encountered while attempting to start API sync. E/amplify:aws-datastore(20780): DataStoreException{message=Initial sync during DataStore initialization failed., cause=io.reactivex.rxjava3.exceptions.CompositeException: 2 exceptions occurred. , recoverySuggestion=There is a possibility that there is a bug if this error persists. Please take a look at E/amplify:aws-datastore(20780): https://github.com/aws-amplify/amplify-android/issues to see if there are any existing issues that E/amplify:aws-datastore(20780): match your scenario, and file an issue with the details of the bug if there isn't.} E/amplify:aws-datastore(20780): at com.amplifyframework.datastore.syncengine.Orchestrator.lambda$startApiSync$4$com-amplifyframework-datastore-syncengine-Orchestrator(Orchestrator.java:362) E/amplify:aws-datastore(20780): at com.amplifyframework.datastore.syncengine.Orchestrator$$ExternalSyntheticLambda10.subscribe(D8$$SyntheticClass:0) E/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.operators.completable.CompletableCreate.subscribeActual(CompletableCreate.java:40) E/amplify:aws-datastore(20780): at io.reactivex.rxjava3.core.Completable.subscribe(Completable.java:2850) E/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.operators.completable.CompletablePeek.subscribeActual(CompletablePeek.java:51) E/amplify:aws-datastore(20780): at io.reactivex.rxjava3.core.Completable.subscribe(Completable.java:2850) E/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.operators.completable.CompletablePeek.subscribeActual(CompletablePeek.java:51) E/amplify:aws-datastore(20780): at io.reactivex.rxjava3.core.Completable.subscribe(Completable.java:2850) E/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.operators.completable.CompletablePeek.subscribeActual(CompletablePeek.java:51) E/amplify:aws-datastore(20780): at io.reactivex.rxjava3.core.Completable.subscribe(Completable.java:2850) E/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.operators.completable.CompletableSubscribeOn$SubscribeOnObserver.run(CompletableSubscribeOn.java:64) E/amplify:aws-datastore(20780): at io.reactivex.rxjava3.core.Scheduler$DisposeTask.run(Scheduler.java:614) E/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:65) E/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:56) E/amplify:aws-datastore(20780): at java.util.concurrent.FutureTask.run(FutureTask.java:264) E/amplify:aws-datastore(20780): at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:307) E/amplify:aws-datastore(20780): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) E/amplify:aws-datastore(20780): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644) E/amplify:aws-datastore(20780): at java.lang.Thread.run(Thread.java:1012) E/amplify:aws-datastore(20780): Caused by: io.reactivex.rxjava3.exceptions.CompositeException: 2 exceptions occurred. E/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.operators.completable.CompletablePeek$CompletableObserverImplementation.onError(CompletablePeek.java:92) E/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.operators.single.SingleFlatMapCompletable$FlatMapCompletableObserver.onError(SingleFlatMapCompletable.java:97) E/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.operators.single.SingleFlatMap$SingleFlatMapCallback$FlatMapSingleObserver.onError(SingleFlatMap.java:117) E/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.operators.completable.CompletableToSingle$ToSingle.onError(CompletableToSingle.java:73) E/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.util.AtomicThrowable.tryTerminateConsumer(AtomicThrowable.java:156) E/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.operators.mixed.FlowableConcatMapCompletable$ConcatMapCompletableObserver.onError(FlowableConcatMapCompletable.java:129) E/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.operators.flowable.FlowableDematerialize$DematerializeSubscriber.onError(FlowableDematerialize.java:104) E/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.operators.flowable.FlowableDematerialize$DematerializeSubscriber.onNext(FlowableDematerialize.java:87) E/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.operators.flowable.FlowableFilter$FilterSubscriber.tryOnNext(FlowableFilter.java:74) E/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.operators.flowable.FlowableFilter$FilterSubscriber.onNext(FlowableFilter.java:52) E/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.subscribers.SinglePostCompleteSubscriber.complete(SinglePostCompleteSubscriber.java:81) E/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.operators.flowable.FlowableMaterialize$MaterializeSubscriber.onError(FlowableMaterialize.java:49) E/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.operators.flowable.FlowableObserveOn$BaseObserveOnSubscriber.checkTerminated(FlowableObserveOn.java:209) E/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.operators.flowable.FlowableObserveOn$ObserveOnSubscriber.runAsync(FlowableObserveOn.java:394) E/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.operators.flowable.FlowableObserveOn$BaseObserveOnSubscriber.run(FlowableObserveOn.java:176) E/amplify:aws-datastore(20780): ... 7 more E/amplify:aws-datastore(20780): Caused by: io.reactivex.rxjava3.exceptions.CompositeException$ExceptionOverview: Multiple exceptions (2) E/amplify:aws-datastore(20780): |-- com.amplifyframework.datastore.DataStoreException: Failure performing sync query to AppSync. E/amplify:aws-datastore(20780): at com.amplifyframework.datastore.appsync.AppSyncClient.lambda$sync$0(AppSyncClient.java:115) E/amplify:aws-datastore(20780): |-- com.amplifyframework.api.ApiException: OkHttp client request failed. E/amplify:aws-datastore(20780): at com.amplifyframework.api.aws.AppSyncGraphQLOperation$OkHttpCallback.onFailure(AppSyncGraphQLOperation.java:163) E/amplify:aws-datastore(20780): |-- java.net.SocketTimeoutException: timeout E/amplify:aws-datastore(20780): at okhttp3.internal.http2.Http2Stream$StreamTimeout.newTimeoutException(Http2Stream.kt:704) E/amplify:aws-datastore(20780): |-- java.lang.RuntimeException: Methods marked with @UiThread must be executed on the main thread. Current thread: RxCachedThreadScheduler-84 E/amplify:aws-datastore(20780): at io.flutter.embedding.engine.FlutterJNI.ensureRunningOnMainThread(FlutterJNI.java:1497) W/amplify:aws-datastore(20780): API sync failed - transitioning to LOCAL_ONLY. W/amplify:aws-datastore(20780): DataStoreException{message=Initial sync during DataStore initialization failed., cause=io.reactivex.rxjava3.exceptions.CompositeException: 2 exceptions occurred. , recoverySuggestion=There is a possibility that there is a bug if this error persists. Please take a look at W/amplify:aws-datastore(20780): https://github.com/aws-amplify/amplify-android/issues to see if there are any existing issues that W/amplify:aws-datastore(20780): match your scenario, and file an issue with the details of the bug if there isn't.} W/amplify:aws-datastore(20780): at com.amplifyframework.datastore.syncengine.Orchestrator.lambda$startApiSync$4$com-amplifyframework-datastore-syncengine-Orchestrator(Orchestrator.java:362) W/amplify:aws-datastore(20780): at com.amplifyframework.datastore.syncengine.Orchestrator$$ExternalSyntheticLambda10.subscribe(D8$$SyntheticClass:0) W/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.operators.completable.CompletableCreate.subscribeActual(CompletableCreate.java:40) W/amplify:aws-datastore(20780): at io.reactivex.rxjava3.core.Completable.subscribe(Completable.java:2850) W/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.operators.completable.CompletablePeek.subscribeActual(CompletablePeek.java:51) W/amplify:aws-datastore(20780): at io.reactivex.rxjava3.core.Completable.subscribe(Completable.java:2850) W/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.operators.completable.CompletablePeek.subscribeActual(CompletablePeek.java:51) W/amplify:aws-datastore(20780): at io.reactivex.rxjava3.core.Completable.subscribe(Completable.java:2850) W/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.operators.completable.CompletablePeek.subscribeActual(CompletablePeek.java:51) W/amplify:aws-datastore(20780): at io.reactivex.rxjava3.core.Completable.subscribe(Completable.java:2850) W/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.operators.completable.CompletableSubscribeOn$SubscribeOnObserver.run(CompletableSubscribeOn.java:64) W/amplify:aws-datastore(20780): at io.reactivex.rxjava3.core.Scheduler$DisposeTask.run(Scheduler.java:614) W/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:65) W/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:56) W/amplify:aws-datastore(20780): at java.util.concurrent.FutureTask.run(FutureTask.java:264) W/amplify:aws-datastore(20780): at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:307) W/amplify:aws-datastore(20780): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) W/amplify:aws-datastore(20780): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644) W/amplify:aws-datastore(20780): at java.lang.Thread.run(Thread.java:1012) W/amplify:aws-datastore(20780): Caused by: io.reactivex.rxjava3.exceptions.CompositeException: 2 exceptions occurred. W/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.operators.completable.CompletablePeek$CompletableObserverImplementation.onError(CompletablePeek.java:92) W/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.operators.single.SingleFlatMapCompletable$FlatMapCompletableObserver.onError(SingleFlatMapCompletable.java:97) W/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.operators.single.SingleFlatMap$SingleFlatMapCallback$FlatMapSingleObserver.onError(SingleFlatMap.java:117) W/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.operators.completable.CompletableToSingle$ToSingle.onError(CompletableToSingle.java:73) W/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.util.AtomicThrowable.tryTerminateConsumer(AtomicThrowable.java:156) W/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.operators.mixed.FlowableConcatMapCompletable$ConcatMapCompletableObserver.onError(FlowableConcatMapCompletable.java:129) W/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.operators.flowable.FlowableDematerialize$DematerializeSubscriber.onError(FlowableDematerialize.java:104) W/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.operators.flowable.FlowableDematerialize$DematerializeSubscriber.onNext(FlowableDematerialize.java:87) W/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.operators.flowable.FlowableFilter$FilterSubscriber.tryOnNext(FlowableFilter.java:74) W/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.operators.flowable.FlowableFilter$FilterSubscriber.onNext(FlowableFilter.java:52) W/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.subscribers.SinglePostCompleteSubscriber.complete(SinglePostCompleteSubscriber.java:81) W/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.operators.flowable.FlowableMaterialize$MaterializeSubscriber.onError(FlowableMaterialize.java:49) W/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.operators.flowable.FlowableObserveOn$BaseObserveOnSubscriber.checkTerminated(FlowableObserveOn.java:209) W/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.operators.flowable.FlowableObserveOn$ObserveOnSubscriber.runAsync(FlowableObserveOn.java:394) W/amplify:aws-datastore(20780): at io.reactivex.rxjava3.internal.operators.flowable.FlowableObserveOn$BaseObserveOnSubscriber.run(FlowableObserveOn.java:176) W/amplify:aws-datastore(20780): ... 7 more W/amplify:aws-datastore(20780): Caused by: io.reactivex.rxjava3.exceptions.CompositeException$ExceptionOverview: Multiple exceptions (2) W/amplify:aws-datastore(20780): |-- com.amplifyframework.datastore.DataStoreException: Failure performing sync query to AppSync. W/amplify:aws-datastore(20780): at com.amplifyframework.datastore.appsync.AppSyncClient.lambda$sync$0(AppSyncClient.java:115) W/amplify:aws-datastore(20780): |-- com.amplifyframework.api.ApiException: OkHttp client request failed. W/amplify:aws-datastore(20780): at com.amplifyframework.api.aws.AppSyncGraphQLOperation$OkHttpCallback.onFailure(AppSyncGraphQLOperation.java:163) W/amplify:aws-datastore(20780): |-- java.net.SocketTimeoutException: timeout W/amplify:aws-datastore(20780): at okhttp3.internal.http2.Http2Stream$StreamTimeout.newTimeoutException(Http2Stream.kt:704) W/amplify:aws-datastore(20780): |-- java.lang.RuntimeException: Methods marked with @UiThread must be executed on the main thread. Current thread: RxCachedThreadScheduler-84 W/amplify:aws-datastore(20780): at io.flutter.embedding.engine.FlutterJNI.ensureRunningOnMainThread(FlutterJNI.java:1497) I/amplify:aws-datastore(20780): Orchestrator transitioning from SYNC_VIA_API to LOCAL_ONLY I/amplify:aws-datastore(20780): Stopping subscription processor. I/amplify:aws-datastore(20780): Stopped subscription processor. I/amplify:aws-datastore(20780): Setting currentState to LOCAL_ONLY I/amplify:aws-api(20780): No more active subscriptions. Closing web socket. W/amplify:aws-api(20780): Websocket connection failed. W/amplify:aws-api(20780): java.net.SocketException: Socket closed W/amplify:aws-api(20780): at java.net.SocketInputStream.socketRead0(Native Method) W/amplify:aws-api(20780): at java.net.SocketInputStream.socketRead(SocketInputStream.java:118) W/amplify:aws-api(20780): at java.net.SocketInputStream.read(SocketInputStream.java:173) W/amplify:aws-api(20780): at java.net.SocketInputStream.read(SocketInputStream.java:143) W/amplify:aws-api(20780): at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.readFromSocket(ConscryptEngineSocket.java:983) W/amplify:aws-api(20780): at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.processDataFromSocket(ConscryptEngineSocket.java:947) W/amplify:aws-api(20780): at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.readUntilDataAvailable(ConscryptEngineSocket.java:862) W/amplify:aws-api(20780): at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.read(ConscryptEngineSocket.java:835) W/amplify:aws-api(20780): at okio.InputStreamSource.read(JvmOkio.kt:93) W/amplify:aws-api(20780): at okio.AsyncTimeout$source$1.read(AsyncTimeout.kt:128) W/amplify:aws-api(20780): at okio.RealBufferedSource.request(RealBufferedSource.kt:209) W/amplify:aws-api(20780): at okio.RealBufferedSource.require(RealBufferedSource.kt:202) W/amplify:aws-api(20780): at okio.RealBufferedSource.readByte(RealBufferedSource.kt:212) W/amplify:aws-api(20780): at okhttp3.internal.ws.WebSocketReader.readHeader(WebSocketReader.kt:119) W/amplify:aws-api(20780): at okhttp3.internal.ws.WebSocketReader.processNextFrame(WebSocketReader.kt:102) W/amplify:aws-api(20780): at okhttp3.internal.ws.RealWebSocket.loopReader(RealWebSocket.kt:293) W/amplify:aws-api(20780): at okhttp3.internal.ws.RealWebSocket$connect$1.onResponse(RealWebSocket.kt:195) W/amplify:aws-api(20780): at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:539) W/amplify:aws-api(20780): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) W/amplify:aws-api(20780): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644) W/amplify:aws-api(20780): at java.lang.Thread.run(Thread.java:1012)
If I toggle the data again, it reconnects and sync successfully. Toggle mobile data after failed reconnecting after an internet interruption I/flutter (20780): Network is up: false I/flutter (20780): Connectivity changed (stream): [ConnectivityResult.none] I/flutter (20780): Connectivity changed (stream): [ConnectivityResult.mobile] I/amplify:aws-datastore(20780): Orchestrator transitioning from LOCAL_ONLY to SYNC_VIA_API I/amplify:aws-datastore(20780): Setting currentState to SYNC_VIA_API I/amplify:aws-datastore(20780): Starting API synchronization mode. I/flutter (20780): Network is up: true I/amplify:aws-datastore(20780): Starting processing subscription events. D/TrafficStats(20780): tagSocket(5) with statsTag=0xffffffff, statsUid=-1 I/amplify:aws-datastore(20780): Started subscription processor for models: [User, FcmNotification, Device] of types [ON_CREATE, ON_UPDATE, ON_DELETE]. I/flutter (20780): subscriptionsEstablished: DataStoreHubEventType.subscriptionsEstablished I/flutter (20780): syncQueriesStarted: [FcmNotification, Device, User] D/TrafficStats(20780): tagSocket(175) with statsTag=0xffffffff, statsUid=-1 I/amplify:aws-datastore(20780): Successfully sync'd down model state from cloud. I/flutter (20780): modelSynced: I/flutter (20780): name: FcmNotification isFullSync: false isDeltaSync: true added: 0 updated: 0 deleted: 0 I/amplify:aws-datastore(20780): Successfully sync'd down model state from cloud. I/flutter (20780): modelSynced: I/flutter (20780): name: Device isFullSync: false isDeltaSync: true added: 0 updated: 0 deleted: 0 I/amplify:aws-datastore(20780): Successfully sync'd down model state from cloud. I/amplify:aws-datastore(20780): Starting processing subscription data buffer. I/amplify:aws-datastore(20780): Started the orchestrator in API sync mode. I/amplify:aws-datastore(20780): Started processing the mutation outbox. Pending mutations will be published to the cloud. I/flutter (20780): modelSynced: I/flutter (20780): name: User isFullSync: false isDeltaSync: true added: 0 updated: 0 deleted: 0 I/flutter (20780): syncQueriesReady I/flutter (20780): Datastore ready I/flutter (20780): outboxState empty : true
I observed similar behaviour on iOS as well, I may open a new issue for that if the problem persists.
Categories
Steps to Reproduce
To reproduce the bug, just play around with the internet connection. WiFi seems to be stable. Mobile data interruption seems to be the cause of errors. Try toggling mobile data, or toggling mobile data and wifi at the same time. Then you will see socket exception, datastore exception, api exception etc.
Screenshots
No response
Platforms
Flutter Version
3.19.6
Amplify Flutter Version
2.0.0
Deployment Method
Amplify CLI
Schema