aws-amplify / amplify-android

The fastest and easiest way to use AWS from your Android app.
https://docs.amplify.aws/lib/q/platform/android/
Apache License 2.0
249 stars 117 forks source link

Timed out while preparing local-only mode || Timed out while starting to observe storage changes #1466

Closed sach16795 closed 2 years ago

sach16795 commented 3 years ago

Before opening, please confirm:

Language and Async Model

Kotlin, RxJava

Amplify Categories

DataStore

Gradle script dependencies

Amplify versions

// Put output below this line
    implementation 'com.amplifyframework:core:1.24.1'
    implementation 'com.amplifyframework:aws-api:1.24.1'
    implementation 'com.amplifyframework:aws-datastore:1.24.1'

Environment information

``` # Put output below this line ```

Please include any relevant guides or documentation you're referencing

No response

Describe the bug

If a lot of data is stored up in the local storage while being not connected to network and if the datastore/app is stopped. On opening the app again this error is shown and the datastore fails to start and the app cannot save any further data.

I have already applied selective sync to an expression that will always evaluate false, so no data is synced down to the device. In my case, I only need to upload data from the device.

Despite no data is synced down, still the datastore fails to start. Need help urgently. Any help is appreciated.

Reproduction steps (if applicable)

  1. Start datastore
  2. Turn off network
  3. Save enough data samples
  4. Stop data store
  5. restart app

Code Snippet

// Put your code below this line.

Log output

``` // Put your logs below this line DataStoreException{message=Timed out while starting to observe storage changes., cause=java.util.concurrent.TimeoutException: Timed out while preparing local-only mode., recoverySuggestion=There is a possibility that there is a bug if this error persists. Please take a look at https://github.com/aws-amplify/amplify-android/issues to see if there are any existing issues that match your scenario, and file an issue with the details of the bug if there isn't.} at com.amplifyframework.datastore.syncengine.Orchestrator.startObservingStorageChanges(Orchestrator.java:277) at com.amplifyframework.datastore.syncengine.Orchestrator.transitionToApiSync(Orchestrator.java:251) at com.amplifyframework.datastore.syncengine.Orchestrator.lambda$start$0$Orchestrator(Orchestrator.java:158) at com.amplifyframework.datastore.syncengine.Orchestrator$$ExternalSyntheticLambda8.run(Unknown Source:2) at io.reactivex.rxjava3.internal.operators.completable.CompletableFromAction.subscribeActual(CompletableFromAction.java:36) at io.reactivex.rxjava3.core.Completable.subscribe(Completable.java:2850) at io.reactivex.rxjava3.internal.operators.completable.CompletableDoFinally.subscribeActual(CompletableDoFinally.java:43) at io.reactivex.rxjava3.core.Completable.subscribe(Completable.java:2850) at io.reactivex.rxjava3.internal.operators.completable.CompletableAndThenCompletable$SourceObserver.onComplete(CompletableAndThenCompletable.java:67) at io.reactivex.rxjava3.internal.operators.completable.CompletablePeek$CompletableObserverImplementation.onComplete(CompletablePeek.java:115) at io.reactivex.rxjava3.internal.operators.completable.CompletableSubscribeOn$SubscribeOnObserver.onComplete(CompletableSubscribeOn.java:79) at io.reactivex.rxjava3.internal.operators.completable.CompletableTimeout$TimeOutObserver.onComplete(CompletableTimeout.java:87) at io.reactivex.rxjava3.internal.operators.completable.CompletableFromAction.subscribeActual(CompletableFromAction.java:47) at io.reactivex.rxjava3.core.Completable.subscribe(Completable.java:2850) at io.reactivex.rxjava3.internal.operators.completable.CompletableTimeout.subscribeActual(CompletableTimeout.java:53) at io.reactivex.rxjava3.core.Completable.subscribe(Completable.java:2850) at io.reactivex.rxjava3.internal.operators.completable.CompletableSubscribeOn$SubscribeOnObserver.run(CompletableSubscribeOn.java:64) at io.reactivex.rxjava3.core.Scheduler$DisposeTask.run(Scheduler.java:614) at io.reactivex.rxjava3.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:65) at io.reactivex.rxjava3.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:56) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301) 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.util.concurrent.TimeoutException: Timed out while preparing local-only mode. at com.amplifyframework.datastore.syncengine.Orchestrator.startObservingStorageChanges(Orchestrator.java:274) ... 24 more ```

amplifyconfiguration.json

No response

GraphQL Schema

```graphql // Put your schema below this line type AccelData @model @key(name: "bytimestamp", fields: ["id", "timestamp"]){ id: ID! userID: String! timestamp: String! resultant: Float! xBins: [Float]! yBins: [Float]! zBins: [Float]! } ```

Additional information and screenshots

No response

sach16795 commented 3 years ago

@richardmcclellan I have noticed that you've resolved/offer workarounds for some time-out-related issues. Tagging you here in case you would be able to help. Urgently need a way to fix this.

alharris-at commented 2 years ago

Hi @sach16795, it looks like your use case may not be the most compatible with Amplify's datastore. Since you're primarily looking to stream data from many devices to the cloud, have you considered using something like Kinesis or Pinpoint to publish a channel of data unidirectionally? The DataStore sync engine is likely performing a lot of additional work here which isn't useful for your particular problem set.

github-actions[bot] commented 2 years ago

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.