-
Notifications
You must be signed in to change notification settings - Fork 58
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
infinite offline mutation #102
Comments
Thanks for reporting this issue, and sorry you're having trouble. Are you convinced that this issue is actually the same as #95? If so, we should migrate this to a comment on that thread so we can keep the conversation centralized--can you move your information (and the link to your log file) to that thread? |
After reviewing the log, it looks like this is a different issue than #95. From my reading of the log, it looks like there are a couple of mutations and a cancellation and there may be a bug in the tracking logic for canceled mutations. It will be helpful if you can share code snippets around how you are creating the mutations, where they are being canceled etc. |
@cbommas We are executing one mutation after another. Just like that:
NotificationSubscriptionUseCase just create mutation: And then we try to create user profile via next mutation (it was executing in Thread: [1] in logs): That's it. I hope it will be helpfull. |
Thanks for attaching the code snippets. In the log that you posted earlier, I am seeing mutations being cancelled.
and
Both the code snippets that you posted have the following line
It appears that in both the code snippets Can you remove the call to cancel in your code and see if that changes the behavior? |
@cbommas If I understand you correctly: we can't cancel mutations. Although this mutations have such interface. First mutation (SubscribeToNotificationMutation) had been executed correctly. Than it was cancelled and started second mutation (CreateProfileMutation in Thread:[1]). Bottom line: Yes, if we remove this lines, there will be no more cancellations and everything works fine. |
Second mutation is being executed after reopen application (press button home -> open app again) |
@DeMoss15
As you can see, if you call cancel on a mutation, it will no longer be executed and will be removed from the queue. And in your case, the mutation will not be present ( or waiting) in the persistent queue - the queue will instead be empty. You can see this in the last few lines of
With that said, you don't have to call cancel for each mutation you create. There will not be any null pointer exceptions or memory leaks. When the mutation object goes out of scope and is no longer in the queue, it will be garbage collected. If you are seeing memory leaks, let me know and I will investigate it further on my side. |
@cbommas I got it. BUT Why THIS (CreateProfileMutation) mutation wait in queue and wasn't being executed?
It wasn't cancelled. |
@DeMoss15 |
@palpatim @cbommas H! I'm a @DeMoss15 teammate. I see that this disscusion going into wrong way). So I did some more clean code (removed rx's chain etc.) and added more logs for better understanding what goin on. And this is start poin for ower calls: `
And our SubscribeToNotificationsObservable , CreateUserProfileMutationObservable SubscribeToNotificationsObservable.txt As you can see in this rx wrappers I added Log for OnSubscribe, OnResponse and for disposable action And finaly our logs And what we can see: that first mutation was sucssefull completed and next observable was call onSubscrive event
Than the next mutation was processing with V/AppSyncOfflineMutationInterceptor
Than we see that first Comletable is completed and Disposable from action compelted
After than I see that 2019-01-22 23:28:08.817 17247-19159/com.moja V/PersistentOfflineMutationManager: Thread:[8406]:Removing mutation [7fe29d07-39cd-4f9a-ad8a-d3dfb36ca952] from persistent store but this mutation id for first mutation (SubscriptionNotificationMutation) End in the add we see that our next mutation didn't complete and we didn't cancel her. |
I've just added delay before second mutation and all work, so maybe we have some thread blocking in the mutation que |
@ukevgen This is causing the mutation queue processing logic to be thrown off and is causing the next mutation in the queue to be deleted due to a bug. The fix for this issue will be included in the next rev of the SDK. I will post back here once I have the release out. In the meantime, I'd recommend that you revisit the logic where the mutations are canceled - I am confused by why you have the logic to cancel the mutation after it has been executed. |
@cbommas This couple of mutations works correctly after update. Thank you! |
@DeMoss15 |
Bug description
Mutation waiting in Persistent Queue for long period of time. Although Internet connection is good enough. Pay attention to logs of mutation in Thread: [1]
Attachments
infinit_creat_mutation_log.txt
Environment
Lib versions:
app sync 2.7.5
cognito identity provider, s3 2.11
mobile client 2.7.4
The text was updated successfully, but these errors were encountered: