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

DataStoreSyncExpression failed on Android devices #4535

Open
2 of 14 tasks
dadaocao opened this issue Mar 7, 2024 · 12 comments
Open
2 of 14 tasks

DataStoreSyncExpression failed on Android devices #4535

dadaocao opened this issue Mar 7, 2024 · 12 comments
Assignees
Labels
Android Issues specific to the Android Platform bug Something is not working; the issue has reproducible steps and has been reproduced datastore Issues related to the DataStore Category Investigating Issues that are assigned and are being looked into

Comments

@dadaocao
Copy link

dadaocao commented Mar 7, 2024

Description

When useing DataStoreSyncExpression to speed up loading time, it turns out that it only takes effect on iOS devices, and Android devices will throw an exception.
Is there a potential bug that I haven't discovered, or is there an alternative way to speed up loading after logging.

DataStoreException{message=Initial sync during DataStore initialization failed., cause=java.lang.RuntimeException: IrRecoverableException{message=Empty response from AppSync., cause=null, recoverySuggestion=Report to AWS team.}

Categories

  • Analytics
  • API (REST)
  • API (GraphQL)
  • Auth
  • Authenticator
  • DataStore
  • Notifications (Push)
  • Storage

Steps to Reproduce

  1. flutter run -d on my real phone
  2. user login
  3. Setting currentState to LOCAL_ONLY + No more active subscriptions. Closing web socket. within a few seconds
    This issue is only for Android devices, DataStoreSyncExpression works properly on the iOS devices.
[flutter_background_geolocation] Purging debug resources in release build
Running Gradle task 'assembleDebug'...                             12.8s
✓  Built build/app/outputs/flutter-apk/app-debug.apk.
Installing build/app/outputs/flutter-apk/app-debug.apk...          19.9s
W/amplify:aws-datastore(24448): The doSyncRetry configuration will be deprecated in a future version. Please discontinue use of this API.
W/amplify:aws-datastore(24448): Disabling sync retries will be deprecated in a future version.
Syncing files to device 22041216UC...                              114ms

Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

A Dart VM Service on 22041216UC is available at: http://127.0.0.1:58453/OsfCjFpuPGg=/
The Flutter DevTools debugger and profiler on 22041216UC is available at: http://127.0.0.1:9101?uri=http://127.0.0.1:58453/OsfCjFpuPGg=/
E/libEGL  (24448): pre_cache appList: ,,
D/BLASTBufferQueue(24448): [SurfaceView[com.pandoraBio.pandoraBioApp/com.pandoraBio.pandoraBioApp.MainActivity]#3](f:0,a:1) acquireNextBufferLocked size=1080x2416 mFrameNumber=1 applyTransaction=true mTimestamp=99660891127016(auto) mPendingTransactions.size=0 graphicBufferId=105003360452608 transform=0
D/o.pandoraBioApp(24448): MiuiProcessManagerServiceStub setSchedFifo
I/MiuiProcessManagerImpl(24448): setSchedFifo pid:24448, mode:3
D/BLASTBufferQueue(24448): [VRI[MainActivity]#2](f:0,a:1) acquireNextBufferLocked size=1080x2460 mFrameNumber=1 applyTransaction=true mTimestamp=99660961146400(auto) mPendingTransactions.size=0 graphicBufferId=105003360452610 transform=0
W/Parcel  (24448): Expecting binder but got null!
D/DecorView[](24448): onWindowFocusChanged hasWindowFocus true
I/HandWritingStubImpl(24448): refreshLastKeyboardType: 1
I/HandWritingStubImpl(24448): getCurrentKeyboardType: 1
I/HandWritingStubImpl(24448): getCurrentKeyboardType: 1
W/BpBinder(24448): Slow Binder: BpBinder transact took 1169 ms, interface=android.system.keystore2.IKeystoreSecurityLevel, code=2 oneway=false
W/BpBinder(24448): Slow Binder: BpBinder transact took 768 ms, interface=android.system.keystore2.IKeystoreSecurityLevel, code=2 oneway=false
I/amplify:flutter:datastore(24448): Added Auth plugin
I/amplify:flutter:datastore(24448): Added API plugin
I/flutter (24448): Amplify configured successfully
I/amplify:aws-datastore(24448): Creating table: LastSyncMetadata
I/amplify:aws-datastore(24448): Creating table: PersistentModelVersion
I/amplify:aws-datastore(24448): Creating table: User
I/amplify:aws-datastore(24448): Creating table: PersistentRecord
I/amplify:aws-datastore(24448): Creating table: Journal
I/amplify:aws-datastore(24448): Creating table: ModelMetadata
I/amplify:aws-datastore(24448): Creating index for table: User
I/amplify:aws-datastore(24448): Creating index for table: PersistentRecord
I/amplify:aws-datastore(24448): Creating index for table: Journal
I/amplify:flutter:datastore(24448): Unhandled DataStoreHubEvent: SUCCEEDED
I/amplify:flutter:datastore(24448): com.amplifyframework.core.category.CategoryInitializationResult@b6334b0
I/amplify:aws-datastore(24448): DataStore plugin initialized.
I/flutter (24448): DataStore event: networkStatus
D/ProfileInstaller(24448): Installing profile for com.pandoraBio.pandoraBioApp
I/o.pandoraBioApp(24448): ProcessProfilingInfo new_methods=8389 is saved saved_to_disk=1 resolve_classes_delay=8000
I/SmartPower.com.google.android.webview:sandboxed_process0:org.chromium.content.app.SandboxedProcessService0background->idle(3082ms) R(service end com.xingin.xhs/org.chromium.content.app.SandboxedProcessService0:0) adj=700.
W/o.pandoraBioApp(24448): Cleared Reference was only reachable from finalizer (only reported once)
I/o.pandoraBioApp(24448): This is non sticky GC, maxfree is 8388608 minfree is 524288
I/HandWritingStubImpl(24448): refreshLastKeyboardType: 1
I/HandWritingStubImpl(24448): getCurrentKeyboardType: 1
D/InputMethodManager(24448): showSoftInput() view=io.flutter.embedding.android.FlutterView{ef9d65d VFED..... .F....ID 0,0-1080,2416 #2 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT
W/OnBackInvokedCallback(24448): OnBackInvokedCallback is not enabled for the application.
W/OnBackInvokedCallback(24448): Set 'android:enableOnBackInvokedCallback="true"' in the application manifest.
D/InsetsController(24448): show(ime(), fromIme=true)
D/InputMethodManager(24448): showSoftInput() view=io.flutter.embedding.android.FlutterView{ef9d65d VFED..... .F...... 0,0-1080,2416 #2 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT
D/InsetsController(24448): show(ime(), fromIme=true)
D/InputMethodManager(24448): showSoftInput() view=io.flutter.embedding.android.FlutterView{ef9d65d VFED..... .F...... 0,0-1080,2416 #2 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT
D/InsetsController(24448): show(ime(), fromIme=true)
D/InputMethodManager(24448): showSoftInput() view=io.flutter.embedding.android.FlutterView{ef9d65d VFED..... .F...... 0,0-1080,2416 #2 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT
D/InsetsController(24448): show(ime(), fromIme=true)
D/InputMethodManager(24448): showSoftInput() view=io.flutter.embedding.android.FlutterView{ef9d65d VFED..... .F...... 0,0-1080,2416 #2 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT
D/InsetsController(24448): show(ime(), fromIme=true)
D/InputMethodManager(24448): showSoftInput() view=io.flutter.embedding.android.FlutterView{ef9d65d VFED..... .F...... 0,0-1080,2416 #2 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT
D/InsetsController(24448): show(ime(), fromIme=true)
D/InputMethodManager(24448): showSoftInput() view=io.flutter.embedding.android.FlutterView{ef9d65d VFED..... .F...... 0,0-1080,2416 #2 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT
D/InsetsController(24448): show(ime(), fromIme=true)
D/InputMethodManager(24448): showSoftInput() view=io.flutter.embedding.android.FlutterView{ef9d65d VFED..... .F...... 0,0-1080,2416 #2 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT
D/InsetsController(24448): show(ime(), fromIme=true)
I/HandWritingStubImpl(24448): getCurrentKeyboardType: 1
D/InputMethodManager(24448): showSoftInput() view=io.flutter.embedding.android.FlutterView{ef9d65d VFED..... .F...... 0,0-1080,2416 #2 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT
I/HandWritingStubImpl(24448): refreshLastKeyboardType: 1
I/HandWritingStubImpl(24448): getCurrentKeyboardType: 1
I/HandWritingStubImpl(24448): refreshLastKeyboardType: 1
I/HandWritingStubImpl(24448): getCurrentKeyboardType: 1
I/HandWritingStubImpl(24448): getCurrentKeyboardType: 1
W/OnBackInvokedCallback(24448): OnBackInvokedCallback is not enabled for the application.
W/OnBackInvokedCallback(24448): Set 'android:enableOnBackInvokedCallback="true"' in the application manifest.
D/InsetsController(24448): show(ime(), fromIme=true)
D/InputMethodManager(24448): showSoftInput() view=io.flutter.embedding.android.FlutterView{ef9d65d VFED..... .F...... 0,0-1080,2416 #2 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT
D/InsetsController(24448): show(ime(), fromIme=true)
D/InputMethodManager(24448): showSoftInput() view=io.flutter.embedding.android.FlutterView{ef9d65d VFED..... .F...... 0,0-1080,2416 #2 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT
D/InsetsController(24448): show(ime(), fromIme=true)
D/InputMethodManager(24448): showSoftInput() view=io.flutter.embedding.android.FlutterView{ef9d65d VFED..... .F...... 0,0-1080,2416 #2 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT
D/InsetsController(24448): show(ime(), fromIme=true)
D/InputMethodManager(24448): showSoftInput() view=io.flutter.embedding.android.FlutterView{ef9d65d VFED..... .F...... 0,0-1080,2416 #2 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT
D/InsetsController(24448): show(ime(), fromIme=true)
D/InputMethodManager(24448): showSoftInput() view=io.flutter.embedding.android.FlutterView{ef9d65d VFED..... .F...... 0,0-1080,2416 #2 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT
D/InsetsController(24448): show(ime(), fromIme=true)
D/InputMethodManager(24448): showSoftInput() view=io.flutter.embedding.android.FlutterView{ef9d65d VFED..... .F...... 0,0-1080,2416 #2 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT
D/InsetsController(24448): show(ime(), fromIme=true)
D/InputMethodManager(24448): showSoftInput() view=io.flutter.embedding.android.FlutterView{ef9d65d VFED..... .F...... 0,0-1080,2416 #2 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT
D/InsetsController(24448): show(ime(), fromIme=true)
D/InputMethodManager(24448): showSoftInput() view=io.flutter.embedding.android.FlutterView{ef9d65d VFED..... .F...... 0,0-1080,2416 #2 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT
D/InsetsController(24448): show(ime(), fromIme=true)
D/InputMethodManager(24448): showSoftInput() view=io.flutter.embedding.android.FlutterView{ef9d65d VFED..... .F...... 0,0-1080,2416 #2 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT
D/InsetsController(24448): show(ime(), fromIme=true)
D/InputMethodManager(24448): showSoftInput() view=io.flutter.embedding.android.FlutterView{ef9d65d VFED..... .F...... 0,0-1080,2416 #2 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT
D/InsetsController(24448): show(ime(), fromIme=true)
D/InputMethodManager(24448): showSoftInput() view=io.flutter.embedding.android.FlutterView{ef9d65d VFED..... .F...... 0,0-1080,2416 #2 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT
D/InputMethodManager(24448): showSoftInput() view=io.flutter.embedding.android.FlutterView{ef9d65d VFED..... .F...... 0,0-1080,2416 #2 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT
D/InsetsController(24448): show(ime(), fromIme=true)
D/InsetsController(24448): show(ime(), fromIme=true)
D/InputMethodManager(24448): showSoftInput() view=io.flutter.embedding.android.FlutterView{ef9d65d VFED..... .F...... 0,0-1080,2416 #2 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT
D/InsetsController(24448): show(ime(), fromIme=true)
D/InputMethodManager(24448): showSoftInput() view=io.flutter.embedding.android.FlutterView{ef9d65d VFED..... .F...... 0,0-1080,2416 #2 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT
D/InsetsController(24448): show(ime(), fromIme=true)
I/flutter (24448): USER HAS JUST SIGNED IN
I/flutter (24448): currentUser.userId: 8bdb75e3-ec15-4bc4-b6bd-0d24f5e6c1a4
I/flutter (24448): userId: 9b3164db-00cb-4b87-a73b-b1cfa016d605
I/amplify:aws-datastore(24448): Orchestrator lock acquired.
I/amplify:aws-datastore(24448): DataStore plugin initialized.
I/amplify:aws-datastore(24448): Orchestrator transitioning from STOPPED to SYNC_VIA_API
I/amplify:aws-datastore(24448): Starting to observe local storage changes.
I/flutter (24448): DataStore event: outboxStatus
I/amplify:aws-datastore(24448): Now observing local storage. Local changes will be enqueued to mutation outbox.
I/amplify:aws-datastore(24448): Setting currentState to LOCAL_ONLY
I/amplify:aws-datastore(24448): Setting currentState to SYNC_VIA_API
I/amplify:aws-datastore(24448): Starting API synchronization mode.
I/amplify:aws-datastore(24448): Orchestrator lock released.
I/amplify:flutter:datastore(24448): Successfully started datastore remote synchronization
I/amplify:aws-datastore(24448): Starting processing subscription events.
D/TrafficStats(24448): tagSocket(103) with statsTag=0xffffffff, statsUid=-1
I/System.out(24448): [com.mediatek.cta.CtaAdapter]:check permission begin!
W/System  (24448): ClassLoader referenced unknown path: system/framework/mediatek-cta.jar
I/System.out(24448): [com.mediatek.cta.CtaAdapter] e:java.lang.ClassNotFoundException: com.mediatek.cta.CtaUtils
I/o.pandoraBioApp(24448): This is sticky GC, maxfree is 8388608 minfree is 524288
W/o.pandoraBioApp(24448): Long monitor contention with owner pool-11-thread-4 (25643) at void com.amplifyframework.api.aws.SubscriptionEndpoint.requestSubscription(com.amplifyframework.api.graphql.GraphQLRequest, com.amplifyframework.api.aws.AuthorizationType, com.amplifyframework.core.Consumer, com.amplifyframework.core.Consumer, com.amplifyframework.core.Consumer, com.amplifyframework.core.Action)(SubscriptionEndpoint.java:207) waiters=0 in void com.amplifyframework.api.aws.SubscriptionEndpoint.requestSubscription(com.amplifyframework.api.graphql.GraphQLRequest, com.amplifyframework.api.aws.AuthorizationType, com.amplifyframework.core.Consumer, com.amplifyframework.core.Consumer, com.amplifyframework.core.Consumer, com.amplifyframework.core.Action) for 400ms
W/o.pandoraBioApp(24448): Long monitor contention with owner pool-11-thread-4 (25643) at void com.amplifyframework.api.aws.SubscriptionEndpoint.requestSubscription(com.amplifyframework.api.graphql.GraphQLRequest, com.amplifyframework.api.aws.AuthorizationType, com.amplifyframework.core.Consumer, com.amplifyframework.core.Consumer, com.amplifyframework.core.Consumer, com.amplifyframework.core.Action)(SubscriptionEndpoint.java:207) waiters=1 in void com.amplifyframework.api.aws.SubscriptionEndpoint.requestSubscription(com.amplifyframework.api.graphql.GraphQLRequest, com.amplifyframework.api.aws.AuthorizationType, com.amplifyframework.core.Consumer, com.amplifyframework.core.Consumer, com.amplifyframework.core.Consumer, com.amplifyframework.core.Action) for 527ms
W/o.pandoraBioApp(24448): Long monitor contention with owner pool-11-thread-4 (25643) at void com.amplifyframework.api.aws.SubscriptionEndpoint.requestSubscription(com.amplifyframework.api.graphql.GraphQLRequest, com.amplifyframework.api.aws.AuthorizationType, com.amplifyframework.core.Consumer, com.amplifyframework.core.Consumer, com.amplifyframework.core.Consumer, com.amplifyframework.core.Action)(SubscriptionEndpoint.java:207) waiters=2 in void com.amplifyframework.api.aws.SubscriptionEndpoint.requestSubscription(com.amplifyframework.api.graphql.GraphQLRequest, com.amplifyframework.api.aws.AuthorizationType, com.amplifyframework.core.Consumer, com.amplifyframework.core.Consumer, com.amplifyframework.core.Consumer, com.amplifyframework.core.Action) for 643ms
W/o.pandoraBioApp(24448): Long monitor contention with owner pool-11-thread-4 (25643) at void com.amplifyframework.api.aws.SubscriptionEndpoint.requestSubscription(com.amplifyframework.api.graphql.GraphQLRequest, com.amplifyframework.api.aws.AuthorizationType, com.amplifyframework.core.Consumer, com.amplifyframework.core.Consumer, com.amplifyframework.core.Consumer, com.amplifyframework.core.Action)(SubscriptionEndpoint.java:207) waiters=3 in void com.amplifyframework.api.aws.SubscriptionEndpoint.requestSubscription(com.amplifyframework.api.graphql.GraphQLRequest, com.amplifyframework.api.aws.AuthorizationType, com.amplifyframework.core.Consumer, com.amplifyframework.core.Consumer, com.amplifyframework.core.Consumer, com.amplifyframework.core.Action) for 779ms
W/o.pandoraBioApp(24448): Long monitor contention with owner pool-11-thread-4 (25643) at void com.amplifyframework.api.aws.SubscriptionEndpoint.requestSubscription(com.amplifyframework.api.graphql.GraphQLRequest, com.amplifyframework.api.aws.AuthorizationType, com.amplifyframework.core.Consumer, com.amplifyframework.core.Consumer, com.amplifyframework.core.Consumer, com.amplifyframework.core.Action)(SubscriptionEndpoint.java:207) waiters=4 in void com.amplifyframework.api.aws.SubscriptionEndpoint.requestSubscription(com.amplifyframework.api.graphql.GraphQLRequest, com.amplifyframework.api.aws.AuthorizationType, com.amplifyframework.core.Consumer, com.amplifyframework.core.Consumer, com.amplifyframework.core.Consumer, com.amplifyframework.core.Action) for 935ms
I/amplify:aws-datastore(24448): Started subscription processor for models: [User, Journal] of types [ON_CREATE, ON_UPDATE, ON_DELETE].
I/flutter (24448): DataStore event: subscriptionsEstablished
I/flutter (24448): DataStore event: syncQueriesStarted
D/TrafficStats(24448): tagSocket(5) with statsTag=0xffffffff, statsUid=-1
I/System.out(24448): [com.mediatek.cta.CtaAdapter]:check permission begin!
I/amplify:aws-datastore(24448): Successfully sync'd down model state from cloud.
I/flutter (24448): DataStore event: modelSynced
W/amplify:aws-datastore(24448): Initial cloud sync failed for Journal.
W/amplify:aws-datastore(24448): IrRecoverableException{message=Empty response from AppSync., cause=null, recoverySuggestion=Report to AWS team.}
W/amplify:aws-datastore(24448):         at com.amplifyframework.datastore.syncengine.SyncProcessor.lambda$syncPage$16(SyncProcessor.java:325)
W/amplify:aws-datastore(24448):         at com.amplifyframework.datastore.syncengine.SyncProcessor$$ExternalSyntheticLambda19.accept(Unknown Source:4)
W/amplify:aws-datastore(24448):         at com.amplifyframework.datastore.appsync.AppSyncClient$$ExternalSyntheticLambda1.accept(Unknown Source:4)
W/amplify:aws-datastore(24448):         at com.amplifyframework.api.aws.AppSyncGraphQLOperation$OkHttpCallback.onResponse(AppSyncGraphQLOperation.java:154)
W/amplify:aws-datastore(24448):         at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:539)
W/amplify:aws-datastore(24448):         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
W/amplify:aws-datastore(24448):         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
W/amplify:aws-datastore(24448):         at java.lang.Thread.run(Thread.java:1012)
E/amplify:flutter:datastore(24448): DataStoreException{message=Initial cloud sync failed for Journal., cause=IrRecoverableException{message=Empty response from AppSync., cause=null, recoverySuggestion=Report to AWS team.}, recoverySuggestion=Check your internet connection.}
E/amplify:aws-datastore(24448): Failure encountered while attempting to start API sync.
E/amplify:aws-datastore(24448): DataStoreException{message=Initial sync during DataStore initialization failed., cause=java.lang.RuntimeException: IrRecoverableException{message=Empty response from AppSync., cause=null, recoverySuggestion=Report to AWS team.}, recoverySuggestion=There is a possibility that there is a bug if this error persists. Please take a look at 
E/amplify:aws-datastore(24448): https://github.com/aws-amplify/amplify-android/issues to see if there are any existing issues that 
E/amplify:aws-datastore(24448): match your scenario, and file an issue with the details of the bug if there isn't.}
E/amplify:aws-datastore(24448):         at com.amplifyframework.datastore.syncengine.Orchestrator.lambda$startApiSync$4$com-amplifyframework-datastore-syncengine-Orchestrator(Orchestrator.java:362)
E/amplify:aws-datastore(24448):         at com.amplifyframework.datastore.syncengine.Orchestrator$$ExternalSyntheticLambda8.subscribe(Unknown Source:2)
E/amplify:aws-datastore(24448):         at io.reactivex.rxjava3.internal.operators.completable.CompletableCreate.subscribeActual(CompletableCreate.java:40)
E/amplify:aws-datastore(24448):         at io.reactivex.rxjava3.core.Completable.subscribe(Completable.java:2850)
E/amplify:aws-datastore(24448):         at io.reactivex.rxjava3.internal.operators.completable.CompletablePeek.subscribeActual(CompletablePeek.java:51)
E/amplify:aws-datastore(24448):         at io.reactivex.rxjava3.core.Completable.subscribe(Completable.java:2850)
E/amplify:aws-datastore(24448):         at io.reactivex.rxjava3.internal.operators.completable.CompletablePeek.subscribeActual(CompletablePeek.java:51)
E/amplify:aws-datastore(24448):         at io.reactivex.rxjava3.core.Completable.subscribe(Completable.java:2850)
E/amplify:aws-datastore(24448):         at io.reactivex.rxjava3.internal.operators.completable.CompletablePeek.subscribeActual(CompletablePeek.java:51)
E/amplify:aws-datastore(24448):         at io.reactivex.rxjava3.core.Completable.subscribe(Completable.java:2850)
E/amplify:aws-datastore(24448):         at io.reactivex.rxjava3.internal.operators.completable.CompletableSubscribeOn$SubscribeOnObserver.run(CompletableSubscribeOn.java:64)
E/amplify:aws-datastore(24448):         at io.reactivex.rxjava3.core.Scheduler$DisposeTask.run(Scheduler.java:614)
E/amplify:aws-datastore(24448):         at io.reactivex.rxjava3.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:65)
E/amplify:aws-datastore(24448):         at io.reactivex.rxjava3.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:56)
E/amplify:aws-datastore(24448):         at java.util.concurrent.FutureTask.run(FutureTask.java:264)
E/amplify:aws-datastore(24448):         at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:307)
E/amplify:aws-datastore(24448):         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
E/amplify:aws-datastore(24448):         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
E/amplify:aws-datastore(24448):         at java.lang.Thread.run(Thread.java:1012)
E/amplify:aws-datastore(24448): Caused by: java.lang.RuntimeException: IrRecoverableException{message=Empty response from AppSync., cause=null, recoverySuggestion=Report to AWS team.}
E/amplify:aws-datastore(24448):         at io.reactivex.rxjava3.internal.util.ExceptionHelper.wrapOrThrow(ExceptionHelper.java:46)
E/amplify:aws-datastore(24448):         at io.reactivex.rxjava3.internal.observers.BlockingMultiObserver.blockingGet(BlockingMultiObserver.java:94)
E/amplify:aws-datastore(24448):         at io.reactivex.rxjava3.core.Completable.blockingAwait(Completable.java:1461)
E/amplify:aws-datastore(24448):         at com.amplifyframework.datastore.syncengine.Orchestrator.lambda$startApiSync$4$com-amplifyframework-datastore-syncengine-Orchestrator(Orchestrator.java:358)
E/amplify:aws-datastore(24448):         ... 18 more
E/amplify:aws-datastore(24448): Caused by: IrRecoverableException{message=Empty response from AppSync., cause=null, recoverySuggestion=Report to AWS team.}
E/amplify:aws-datastore(24448):         at com.amplifyframework.datastore.syncengine.SyncProcessor.lambda$syncPage$16(SyncProcessor.java:325)
E/amplify:aws-datastore(24448):         at com.amplifyframework.datastore.syncengine.SyncProcessor$$ExternalSyntheticLambda19.accept(Unknown Source:4)
E/amplify:aws-datastore(24448):         at com.amplifyframework.datastore.appsync.AppSyncClient$$ExternalSyntheticLambda1.accept(Unknown Source:4)
E/amplify:aws-datastore(24448):         at com.amplifyframework.api.aws.AppSyncGraphQLOperation$OkHttpCallback.onResponse(AppSyncGraphQLOperation.java:154)
E/amplify:aws-datastore(24448):         at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:539)
E/amplify:aws-datastore(24448):         ... 3 more
W/amplify:aws-datastore(24448): API sync failed - transitioning to LOCAL_ONLY.
W/amplify:aws-datastore(24448): DataStoreException{message=Initial sync during DataStore initialization failed., cause=java.lang.RuntimeException: IrRecoverableException{message=Empty response from AppSync., cause=null, recoverySuggestion=Report to AWS team.}, recoverySuggestion=There is a possibility that there is a bug if this error persists. Please take a look at 
W/amplify:aws-datastore(24448): https://github.com/aws-amplify/amplify-android/issues to see if there are any existing issues that 
W/amplify:aws-datastore(24448): match your scenario, and file an issue with the details of the bug if there isn't.}
W/amplify:aws-datastore(24448):         at com.amplifyframework.datastore.syncengine.Orchestrator.lambda$startApiSync$4$com-amplifyframework-datastore-syncengine-Orchestrator(Orchestrator.java:362)
W/amplify:aws-datastore(24448):         at com.amplifyframework.datastore.syncengine.Orchestrator$$ExternalSyntheticLambda8.subscribe(Unknown Source:2)
W/amplify:aws-datastore(24448):         at io.reactivex.rxjava3.internal.operators.completable.CompletableCreate.subscribeActual(CompletableCreate.java:40)
W/amplify:aws-datastore(24448):         at io.reactivex.rxjava3.core.Completable.subscribe(Completable.java:2850)
W/amplify:aws-datastore(24448):         at io.reactivex.rxjava3.internal.operators.completable.CompletablePeek.subscribeActual(CompletablePeek.java:51)
W/amplify:aws-datastore(24448):         at io.reactivex.rxjava3.core.Completable.subscribe(Completable.java:2850)
W/amplify:aws-datastore(24448):         at io.reactivex.rxjava3.internal.operators.completable.CompletablePeek.subscribeActual(CompletablePeek.java:51)
W/amplify:aws-datastore(24448):         at io.reactivex.rxjava3.core.Completable.subscribe(Completable.java:2850)
W/amplify:aws-datastore(24448):         at io.reactivex.rxjava3.internal.operators.completable.CompletablePeek.subscribeActual(CompletablePeek.java:51)
W/amplify:aws-datastore(24448):         at io.reactivex.rxjava3.core.Completable.subscribe(Completable.java:2850)
W/amplify:aws-datastore(24448):         at io.reactivex.rxjava3.internal.operators.completable.CompletableSubscribeOn$SubscribeOnObserver.run(CompletableSubscribeOn.java:64)
W/amplify:aws-datastore(24448):         at io.reactivex.rxjava3.core.Scheduler$DisposeTask.run(Scheduler.java:614)
W/amplify:aws-datastore(24448):         at io.reactivex.rxjava3.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:65)
W/amplify:aws-datastore(24448):         at io.reactivex.rxjava3.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:56)
W/amplify:aws-datastore(24448):         at java.util.concurrent.FutureTask.run(FutureTask.java:264)
W/amplify:aws-datastore(24448):         at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:307)
W/amplify:aws-datastore(24448):         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
W/amplify:aws-datastore(24448):         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
W/amplify:aws-datastore(24448):         at java.lang.Thread.run(Thread.java:1012)
W/amplify:aws-datastore(24448): Caused by: java.lang.RuntimeException: IrRecoverableException{message=Empty response from AppSync., cause=null, recoverySuggestion=Report to AWS team.}
W/amplify:aws-datastore(24448):         at io.reactivex.rxjava3.internal.util.ExceptionHelper.wrapOrThrow(ExceptionHelper.java:46)
W/amplify:aws-datastore(24448):         at io.reactivex.rxjava3.internal.observers.BlockingMultiObserver.blockingGet(BlockingMultiObserver.java:94)
W/amplify:aws-datastore(24448):         at io.reactivex.rxjava3.core.Completable.blockingAwait(Completable.java:1461)
W/amplify:aws-datastore(24448):         at com.amplifyframework.datastore.syncengine.Orchestrator.lambda$startApiSync$4$com-amplifyframework-datastore-syncengine-Orchestrator(Orchestrator.java:358)
W/amplify:aws-datastore(24448):         ... 18 more
W/amplify:aws-datastore(24448): Caused by: IrRecoverableException{message=Empty response from AppSync., cause=null, recoverySuggestion=Report to AWS team.}
W/amplify:aws-datastore(24448):         at com.amplifyframework.datastore.syncengine.SyncProcessor.lambda$syncPage$16(SyncProcessor.java:325)
W/amplify:aws-datastore(24448):         at com.amplifyframework.datastore.syncengine.SyncProcessor$$ExternalSyntheticLambda19.accept(Unknown Source:4)
W/amplify:aws-datastore(24448):         at com.amplifyframework.datastore.appsync.AppSyncClient$$ExternalSyntheticLambda1.accept(Unknown Source:4)
W/amplify:aws-datastore(24448):         at com.amplifyframework.api.aws.AppSyncGraphQLOperation$OkHttpCallback.onResponse(AppSyncGraphQLOperation.java:154)
W/amplify:aws-datastore(24448):         at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:539)
W/amplify:aws-datastore(24448):         ... 3 more
I/amplify:aws-datastore(24448): Orchestrator transitioning from SYNC_VIA_API to LOCAL_ONLY
I/amplify:aws-datastore(24448): Stopping subscription processor.
I/amplify:aws-datastore(24448): Stopped subscription processor.
I/amplify:aws-datastore(24448): Setting currentState to LOCAL_ONLY
W/o.pandoraBioApp(24448): Long monitor contention with owner pool-11-thread-3 (25640) at void com.amplifyframework.api.aws.SubscriptionEndpoint.releaseSubscription(java.lang.String)(SubscriptionEndpoint.java:315) waiters=3 in void com.amplifyframework.api.aws.SubscriptionEndpoint.releaseSubscription(java.lang.String) for 202ms
W/o.pandoraBioApp(24448): Long monitor contention with owner pool-11-thread-3 (25640) at void com.amplifyframework.api.aws.SubscriptionEndpoint.releaseSubscription(java.lang.String)(SubscriptionEndpoint.java:315) waiters=4 in void com.amplifyframework.api.aws.SubscriptionEndpoint.releaseSubscription(java.lang.String) for 235ms
I/amplify:aws-api(24448): No more active subscriptions. Closing web socket.

Screenshots

No response

Platforms

  • iOS
  • Android
  • Web
  • macOS
  • Windows
  • Linux

Flutter Version

3.3.0

Amplify Flutter Version

1.7.0

Deployment Method

Amplify CLI

Schema

# This "input" configures a global authorization rule to enable public access to
# all models in this schema. Learn more about authorization rules here: https://docs.amplify.aws/cli/graphql/authorization-rules
# input AMPLIFY { globalAuthRule: AuthRule = { allow: public } } # FOR TESTING ONLY!

type User @model @auth(rules: [{ allow: private }]) {
  id: ID!
  cognitoUserId: String! @index(name: "byCognitoUserId", queryField: "userByCognitoUserId")
  cache: AWSJSON
  firstName: String
  lastName: String
  joinedAt: AWSDate!
  photoImg: String
  email: String
  verifiedOver18: Boolean
  displayName: String
  acceptedPrivacyPolicy: Boolean
  acceptedTermsAndConditions: Boolean
  participatingLeaderboard: Boolean
  participatingProgram: String
  paymentOption: String
  usernameOfPaymentOption: String
  journals: [Journal] @hasMany(indexName: "byUser", fields: ["id"])
}

type Journal @model @auth(rules: [{ allow: private }]) {
  id: ID!
  userId: ID! @index(name: "byUser", sortKeyFields: ["stampString"])
  user: User @belongsTo(fields: ["userId"])
  kind: String!
  stampString: String!
  stamp: AWSDateTime!
  data: AWSJSON!
  version: String
}
@khatruong2009 khatruong2009 added Android Issues specific to the Android Platform datastore Issues related to the DataStore Category pending-triage This issue is in the backlog of issues to triage labels Mar 8, 2024
@khatruong2009
Copy link
Contributor

Hi @dadaocao, thank you for submitting this issue. We are going to look into it now and get back to you when we have an update, thanks.

@MelodyXinyi
Copy link

By the way, our team is planning to add web platform to our current project. Does it mean the Datastore strategy should no longer be suitable for our flutter project?

@Equartey
Copy link
Contributor

Hi @MelodyXinyi, Amplify Flutter currently does not support the web platform when using the DataStore category.

If web is a requirement, I would suggest exploring if the GraphQL category can fulfill your data needs. Most of the time we see the offline feature (main difference) of DataStore is not a hard requirement and GraphQL is more than enough to solve your business needs.

@MelodyXinyi
Copy link

If we use GraphQL for web part, does it mean we have to throw away all DataStore configuration for current iOS and Android?

@Equartey
Copy link
Contributor

Hi @MelodyXinyi, unsure what you're referring to as "DataStore configuration".

At its core DataStore is built on top of the API category, Amplify Flutter's DataStore uses Amplify Android & Amplify Swift's API implementation, but even those still use the same backend as Amplify Flutter GraphQL. You will be connecting to the same backend so no data is lost, the only change is the API you will interact with the models.

Is there specific configuration you are concerned about losing?

Also, I'm not sure if you work with the original author of this issue, @dadaocao, if not please open a new issue so we can keep discussion focused.

@dadaocao
Copy link
Author

Sorry for making you misunderstand, these two accounts both belong to me, so one issue is enough.

Thanks for your reply, I understand what you mean. By the way, is there any update about the origin error? Our Android users are still experiencing long-loading time due to the invalidation of SyncExpression.

@Equartey
Copy link
Contributor

@dadaocao, no worries.

Can you share the sync expression you are seeing the issue with?

@Equartey Equartey added the pending-response Issue is pending response from the issue requestor label Mar 14, 2024
@MelodyXinyi
Copy link

MelodyXinyi commented Mar 14, 2024

      if (!Platform.isAndroid) {
        // userId will be set in _fetchAndSetUserId
        // then when Amplify.DataStore.start is called in handleSignedIn, it will use userId to sync data
        dataStore = AmplifyDataStore(
            modelProvider: ModelProvider.instance,
            syncExpressions: [
              DataStoreSyncExpression(
                  User.classType, () => User.ID.eq(appData.userId)),
              DataStoreSyncExpression(
                  Journal.classType,
                  () => Journal.USER
                      .eq(appData.userId)
                      .and(Journal.STAMPSTRING.ge(startString)))
            ]);
      }

// Currently, it seems like Android version of DataStore has bug, and we can not use syncExpression on index

@dadaocao
Copy link
Author

When I ran on Andoird, the following errors will repeat for more than ten times before allowing the user to enter, which cauing long-loading time. Still, there is no problem on iOS.

User
 This is sticky GC, maxfree is 8388608 minfree is 524288
I/o.pandoraBioApp(21033): This is non sticky GC, maxfree is 8388608 minfree is 524288
I/o.pandoraBioApp(21033): This is sticky GC, maxfree is 8388608 minfree is 524288
I/o.pandoraBioApp(21033): This is non sticky GC, maxfree is 8388608 minfree is 524288
I/o.pandoraBioApp(21033): This is sticky GC, maxfree is 8388608 minfree is 524288
I/o.pandoraBioApp(21033): This is non sticky GC, maxfree is 8388608 minfree is 524288
I/o.pandoraBioApp(21033): This is sticky GC, maxfree is 8388608 minfree is 524288
I/amplify:aws-datastore(21033): Successfully sync'd down model state from cloud.
I/flutter (21033): DataStore event: modelSynced
I/o.pandoraBioApp(21033): This is non sticky GC, maxfree is 8388608 minfree is 524288
W/amplify:aws-datastore(21033): Sync failed: foreign key constraint violation: ModelWithMetadata{model=SerializedModel{id='56b09280-3c86-4c23-b45a-202d205e9cf2', serializedData={createdAt=2023-09-29T20:37:21.097Z, stampString=2023-09-29T21:00:39.964843000Z, data={"responses":["1994-09-22","0","4","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""]}, kind=personalHistory, stamp=2023-09-29T21:00:39.964843000Z, id=56b09280-3c86-4c23-b45a-202d205e9cf2, user=SerializedModel{id='5f234cef-71de-4fa8-9cf8-c3433d47356f', serializedData={lastName=null, cache=null, _deleted=true, _lastChangedAt=1.709665759678E12, acceptedPrivacyPolicy=true, displayName=test23, joinedAt=2023-09-22, __typename=User, participatingLeaderboard=null, verifiedOver18=true, createdAt=2023-09-22T02:34:04.905Z, firstName=null, participatingProgram=null, cognitoUserId=f057dcb7-39c5-406d-9218-b602bdeb32c0, usernameOfPaymentOption=None123, paymentOption=Zelle, acceptedTermsAndConditions=true, photoImg=assets/images/default_user/user1.png, id=5f234cef-71de-4fa8-9cf8-c3433d47356f, _version=4, email=null, updatedAt=2024-02-23T23:27:40.146Z}, modelName=User}, version=null, updatedAt=2023-09-29T21:00:40.292Z}, modelName=Journal}, syncMetadata=ModelMetadata{id='Journal|56b09280-3c86-4c23-b45a-202d205e9cf2', _deleted=null, _version=13, _lastChangedAt=Temporal.Timestamp{timestamp=1696021240330}}}
W/amplify:aws-datastore(21033): DataStoreException{message=Invalid SQL statement: INSERT INTO `Journal` (`id`, `createdAt`, `data`, `kind`, `stamp`, `stampString`, `updatedAt`, `version`, `userId`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?), cause=android.database.sqlite.SQLiteConstraintException: FOREIGN KEY constraint failed (code 787 SQLITE_CONSTRAINT_FOREIGNKEY), recoverySuggestion=There is a possibility that there is a bug if this error persists. Please take a look at 
W/amplify:aws-datastore(21033): https://github.com/aws-amplify/amplify-android/issues to see if there are any existing issues that 
W/amplify:aws-datastore(21033): match your scenario, and file an issue with the details of the bug if there isn't.}
W/amplify:aws-datastore(21033):         at com.amplifyframework.datastore.storage.sqlite.SQLCommandProcessor.dataStoreException(SQLCommandProcessor.java:87)
W/amplify:aws-datastore(21033):         at com.amplifyframework.datastore.storage.sqlite.SQLCommandProcessor.execute(SQLCommandProcessor.java:82)
W/amplify:aws-datastore(21033):         at com.amplifyframework.datastore.storage.sqlite.SQLiteStorageAdapter.writeData(SQLiteStorageAdapter.java:769)
W/amplify:aws-datastore(21033):         at com.amplifyframework.datastore.storage.sqlite.SQLiteStorageAdapter.lambda$save$3$com-amplifyframework-datastore-storage-sqlite-SQLiteStorageAdapter(SQLiteStorageAdapter.java:366)
W/amplify:aws-datastore(21033):         at com.amplifyframework.datastore.storage.sqlite.SQLiteStorageAdapter$$ExternalSyntheticLambda7.run(Unknown Source:12)
W/amplify:aws-datastore(21033):         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:463)
W/amplify:aws-datastore(21033):         at java.util.concurrent.FutureTask.run(FutureTask.java:264)
W/amplify:aws-datastore(21033):         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
W/amplify:aws-datastore(21033):         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
W/amplify:aws-datastore(21033):         at java.lang.Thread.run(Thread.java:1012)
W/amplify:aws-datastore(21033): Caused by: android.database.sqlite.SQLiteConstraintException: FOREIGN KEY constraint failed (code 787 SQLITE_CONSTRAINT_FOREIGNKEY)
W/amplify:aws-datastore(21033):         at android.database.sqlite.SQLiteConnection.nativeExecute(Native Method)
W/amplify:aws-datastore(21033):         at android.database.sqlite.SQLiteConnection.execute(SQLiteConnection.java:730)
W/amplify:aws-datastore(21033):         at android.database.sqlite.SQLiteSession.execute(SQLiteSession.java:621)
W/amplify:aws-datastore(21033):         at android.database.sqlite.SQLiteStatement.execute(SQLiteStatement.java:47)
W/amplify:aws-datastore(21033):         at com.amplifyframework.datastore.storage.sqlite.SQLCommandProcessor.execute(SQLCommandProcessor.java:78)
W/amplify:aws-datastore(21033):         ... 8 more

@Equartey Equartey added to-be-reproduced Issues that have not been reproduced yet, but have reproduction steps provided and removed pending-response Issue is pending response from the issue requestor labels Mar 21, 2024
@khatruong2009 khatruong2009 added bug Something is not working; the issue has reproducible steps and has been reproduced and removed to-be-reproduced Issues that have not been reproduced yet, but have reproduction steps provided labels Mar 22, 2024
@khatruong2009
Copy link
Contributor

Hi @dadaocao, I was able to confirm this issue and received the "Setting currentState to LOCAL_ONLY" message when running the app on android. We will investigate how to fix this and get back to you with any updates, thank you.

@dadaocao
Copy link
Author

Thanks, please let me know if you need more info.

@NikaHsn NikaHsn added Investigating Issues that are assigned and are being looked into and removed pending-triage This issue is in the backlog of issues to triage labels Mar 28, 2024
@Jordan-Nelson
Copy link
Contributor

Apologies for the delay. I don't believe we need any other info at this time but we are looking into this and will let you know if we need further info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Android Issues specific to the Android Platform bug Something is not working; the issue has reproducible steps and has been reproduced datastore Issues related to the DataStore Category Investigating Issues that are assigned and are being looked into
Projects
None yet
Development

No branches or pull requests

6 participants