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

io.reactivex.rxjava3.exceptions.UndeliverableException in DataStore #2898

Open
1 task done
tobias-feldmann opened this issue Aug 19, 2024 · 6 comments
Open
1 task done
Assignees
Labels
bug Something isn't working datastore DataStore category/plugins

Comments

@tobias-feldmann
Copy link

Before opening, please confirm:

Language and Async Model

Java

Amplify Categories

DataStore

Gradle script dependencies

    //Amplify
    implementation("com.amplifyframework:core:2.21.0")
    implementation("com.amplifyframework:aws-api:2.21.0")
    implementation("com.amplifyframework:aws-auth-cognito:2.21.0")
    implementation("com.amplifyframework:aws-datastore:2.21.0")
    implementation("com.amplifyframework:aws-storage-s3:2.21.0")

Environment information

------------------------------------------------------------
Gradle 8.2
------------------------------------------------------------

Build time:   2023-06-30 18:02:30 UTC
Revision:     5f4a070a62a31a17438ac998c2b849f4f6892877

Kotlin:       1.8.20
Groovy:       3.0.17
Ant:          Apache Ant(TM) version 1.10.13 compiled on January 4 2023
JVM:          17.0.1 (Oracle Corporation 17.0.1+12-LTS-39)
OS:           Mac OS X 14.4 aarch64



Please include any relevant guides or documentation you're referencing

No response

Describe the bug

We see this error on many devices via the Google Play logs.
But I can't reproduce it on our test devices.

Occurs with various Android SDKs and devices:
Android 9 (SDK 28)
Android 10 (SDK 29)
Android 11 (SDK 30)
Android 12 (SDK 31)
Android 13 (SDK 33)
Android 14 (SDK 34)
Android 15 Beta (SDK 35)

Same issue as in the ticket: #2654

com.amplifyframework.datastore.storage.sqlite.PersistentModelVersion$$ExternalSyntheticLambda2.accept
Exception io.reactivex.rxjava3.exceptions.UndeliverableException:
at io.reactivex.rxjava3.plugins.RxJavaPlugins.onError (RxJavaPlugins.java:367)
at io.reactivex.rxjava3.internal.operators.single.SingleCreate$Emitter.onError (SingleCreate.java:82)
at com.amplifyframework.datastore.storage.sqlite.PersistentModelVersion$$ExternalSyntheticLambda2.accept
at com.amplifyframework.datastore.appsync.AppSyncClient.lambda$sync$0 (AppSyncClient.java:115)
at com.amplifyframework.datastore.appsync.AppSyncClient$$ExternalSyntheticLambda0.accept
at com.amplifyframework.api.aws.MultiAuthAppSyncGraphQLOperation$OkHttpCallback.onFailure (MultiAuthAppSyncGraphQLOperation.java:199)
at okhttp3.internal.connection.RealCall$AsyncCall.run (RealCall.kt:535)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:644)
at java.lang.Thread.run (Thread.java:1012)

Reproduction steps (if applicable)

No response

Code Snippet

// Put your code below this line.

Log output

// Put your logs below this line


amplifyconfiguration.json

No response

GraphQL Schema

// Put your schema below this line

Additional information and screenshots

No response

@github-actions github-actions bot added pending-triage Issue is pending triage pending-maintainer-response Issue is pending response from an Amplify team member labels Aug 19, 2024
@lawmicha
Copy link
Contributor

Hi @tobias-feldmann, thanks for opening this issue. The error logs indicate thie code being executed.

public void onFailure(@NonNull Call call, @NonNull IOException exception) {
      onFailure.accept(new ApiException(
          "OkHttp client request failed.", exception, "See attached exception for more details."
      ));
  }

Is this issue causing a crash in your application? That will indicate that DataStore which uses the MultiAuthAppSyncGraphQLOperation may not be handling failures correctly and re-throwing. Network failures are expected to happen and the app should not crash while providing eventual consistency.

@lawmicha lawmicha added pending-community-response Issue is pending response from the issue requestor bug Something isn't working datastore DataStore category/plugins and removed pending-maintainer-response Issue is pending response from an Amplify team member pending-triage Issue is pending triage labels Aug 19, 2024
@tobias-feldmann
Copy link
Author

Hi @lawmicha
I can't say for sure whether the app crashes because we don't have this problem on our test devices.
However, we regularly have support cases where a user cannot log in and gets stuck in the loading screen. The DataStore sync is started when logging in and the user only gets into the app when this is completed. I think this behavior could have something to do with the error.
The user always gets the error. Reinstalling the app etc. does not help.

@github-actions github-actions bot added pending-maintainer-response Issue is pending response from an Amplify team member and removed pending-community-response Issue is pending response from the issue requestor labels Aug 19, 2024
@vincetran
Copy link
Member

@tobias-feldmann, can you provide more of the stacktrace in the exception? Based on some research on the top-level UndeliverableException, the issue is that an exception was trying to be delivered to a consumer but it was canceled/disposed of before the exception was sent. As in the issue you linked, there should be a link to the RxJava documentation regarding that and I also read up on this article that summarizes it.

In the issue that you linked, a couple people posted similar exceptions that also showed the underlying exception being something different (e.g. this cause was due to the device not having internet connectivity). Do you have any logs that provide a little more detail regarding what the underlying issue may be for your log in scenario? It may very well be what @lawmicha linked to above but wanted to confirm.

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending response from an Amplify team member label Aug 19, 2024
@tobias-feldmann
Copy link
Author

Sorry @vincetran,
Unfortunately I don't have a more detailed stacktrace via Google Play.
I could provide you the different devices on which the problem occurred.

But I don't think it's a connection problem here. Because we reinstalled the app together with the users and it still didn't work.

@github-actions github-actions bot added the pending-maintainer-response Issue is pending response from an Amplify team member label Aug 20, 2024
@tobias-feldmann
Copy link
Author

Today we also had the following error in the Google Play Console. But I'm not sure if it has anything to do with the other one.

Exception io.reactivex.rxjava3.exceptions.OnErrorNotImplementedException:
at io.reactivex.rxjava3.internal.observers.EmptyCompletableObserver.onError (EmptyCompletableObserver.java:50)
at io.reactivex.rxjava3.internal.operators.completable.CompletablePeek$CompletableObserverImplementation.onError (CompletablePeek.java:95)
at io.reactivex.rxjava3.internal.operators.completable.CompletableFromAction.subscribeActual (CompletableFromAction.java:40)
at io.reactivex.rxjava3.core.Completable.subscribe (Completable.java:2850)
at io.reactivex.rxjava3.internal.operators.completable.CompletablePeek.subscribeActual (CompletablePeek.java:51)
at io.reactivex.rxjava3.core.Completable.subscribe (Completable.java:2850)
at io.reactivex.rxjava3.core.Completable.subscribe (Completable.java:2836)
at com.amplifyframework.datastore.syncengine.Orchestrator.onApiSyncFailure (Orchestrator.java:409)
at com.amplifyframework.datastore.syncengine.Orchestrator.$r8$lambda$ZuF_qcrER9a6iXcDjWdbix62tCI
at com.amplifyframework.datastore.syncengine.Orchestrator$$ExternalSyntheticLambda1.accept
at com.amplifyframework.datastore.syncengine.SubscriptionProcessor.lambda$subscriptionObservable$4$com-amplifyframework-datastore-syncengine-SubscriptionProcessor (SubscriptionProcessor.java:220)
at com.amplifyframework.datastore.syncengine.SubscriptionProcessor$$ExternalSyntheticLambda1.accept
at com.amplifyframework.datastore.appsync.AppSyncClient.lambda$subscription$2 (AppSyncClient.java:322)
at com.amplifyframework.datastore.appsync.AppSyncClient$$ExternalSyntheticLambda5.accept
at com.amplifyframework.api.aws.MultiAuthSubscriptionOperation.emitErrorAndCancelSubscription (MultiAuthSubscriptionOperation.java:182)
at com.amplifyframework.api.aws.MultiAuthSubscriptionOperation.dispatchRequest (MultiAuthSubscriptionOperation.java:108)
at com.amplifyframework.api.aws.MultiAuthSubscriptionOperation.$r8$lambda$JtcabZnNSNwb3eJHAsHinrqaFTo
at com.amplifyframework.api.aws.MultiAuthSubscriptionOperation$$ExternalSyntheticLambda4.run
at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:487)
at java.util.concurrent.FutureTask.run (FutureTask.java:264)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:644)
at java.lang.Thread.run (Thread.java:1012)
Caused by : DataStoreException{message=Timed out while starting to observe storage changes., cause=java.util.concurrent.RejectedExecutionException
at com.amplifyframework.datastore.syncengine.Orchestrator.startObservingStorageChanges (Orchestrator.java:312)
at com.amplifyframework.datastore.syncengine.Orchestrator.transitionToLocalOnly (Orchestrator.java:252)
at com.amplifyframework.datastore.syncengine.Orchestrator.$r8$lambda$mOnL_20CKOMo4oOZZmx8JpE-7k0
at com.amplifyframework.datastore.syncengine.Orchestrator$$ExternalSyntheticLambda0.run
at io.reactivex.rxjava3.internal.operators.completable.CompletableFromAction.subscribeActual (CompletableFromAction.java:36)
Caused by java.util.concurrent.RejectedExecutionException:
at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution (ThreadPoolExecutor.java:2082)
at java.util.concurrent.ThreadPoolExecutor.reject (ThreadPoolExecutor.java:842)
at java.util.concurrent.ThreadPoolExecutor.execute (ThreadPoolExecutor.java:1374)
at java.util.concurrent.AbstractExecutorService.submit (AbstractExecutorService.java:123)
at com.amplifyframework.datastore.storage.sqlite.SQLiteStorageAdapter.query (SQLiteStorageAdapter.java:514)
at com.amplifyframework.datastore.syncengine.PersistentMutationOutbox.load$lambda$23 (PersistentMutationOutbox.kt:289)
at com.amplifyframework.datastore.syncengine.PersistentMutationOutbox.$r8$lambda$rdajT2lfxZn874JF_D-K5WXxa3Q
at com.amplifyframework.datastore.syncengine.PersistentMutationOutbox$$ExternalSyntheticLambda21.subscribe
at io.reactivex.rxjava3.internal.operators.completable.CompletableCreate.subscribeActual (CompletableCreate.java:40)
at io.reactivex.rxjava3.core.Completable.subscribe (Completable.java:2850)
at io.reactivex.rxjava3.internal.operators.completable.CompletablePeek.subscribeActual (CompletablePeek.java:51)
at io.reactivex.rxjava3.core.Completable.subscribe (Completable.java:2850)
at io.reactivex.rxjava3.internal.operators.completable.CompletablePeek.subscribeActual (CompletablePeek.java:51)
at io.reactivex.rxjava3.core.Completable.subscribe (Completable.java:2850)
at io.reactivex.rxjava3.internal.operators.completable.CompletableAndThenCompletable.subscribeActual (CompletableAndThenCompletable.java:35)
at io.reactivex.rxjava3.core.Completable.subscribe (Completable.java:2850)
at io.reactivex.rxjava3.core.Completable.blockingAwait (Completable.java:1460)
at com.amplifyframework.datastore.syncengine.Orchestrator.startObservingStorageChanges (Orchestrator.java:310)

@harsh62
Copy link
Member

harsh62 commented Aug 27, 2024

Thanks for providing more details. Our team will try to reproduce the issue in a local environment and get back to you.

@harsh62 harsh62 removed the pending-maintainer-response Issue is pending response from an Amplify team member label Aug 27, 2024
@mattcreaser mattcreaser self-assigned this Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working datastore DataStore category/plugins
Projects
None yet
Development

No branches or pull requests

5 participants