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

Severe cache bug during submission on deposit #2577

Closed
atarix83 opened this issue Oct 26, 2023 · 3 comments · Fixed by #2596
Closed

Severe cache bug during submission on deposit #2577

atarix83 opened this issue Oct 26, 2023 · 3 comments · Fixed by #2596
Assignees
Labels
bug component: submission high priority performance / caching Related to performance, caching or embedded objects
Milestone

Comments

@atarix83
Copy link
Contributor

atarix83 commented Oct 26, 2023

Describe the bug
When a new submission that contains a relationship issue is created a severe cache bug occurs which doesn't allow to deposit the item.
Essentialy if all the changes in the submission have been saved, before to deposit the application try to retrieve the submission object again to check if the item can be deposited (it happens here). In the case the changes of the submission are not yet saved before to add a new relationship field they are saved when the relationship is added. This probably cause a cache problem and when the user try to deposit the item the application can't retrieve the updated submission object (it happens here) because it gets a remote data with status error stale and this leads to an endless loop of request to REST server.

To Reproduce
It can be reproduced in the sandbox environment also

  1. as submitter try to create a new publication in the collection Publication 2 which have a relationship field
  2. start to fill out the form following this order and without clicking on save:
  • accept the license
  • add the titlke and the date that are mandatory
  • add an author
  • upload a file
  1. click on deposit
  2. the submission is hanging forever and in the network endless requests are sent
Untitled_.Oct.26.2023.9_46.AM.mp4
Untitled_.Oct.26.2023.9_46.AM.webm

Expected behavior
The submission should be deposited

Related work
It's important to retrieve every time a fresh submission object because of the bug already resolved #1502

@atarix83 atarix83 added bug needs triage New issue needs triage and/or scheduling labels Oct 26, 2023
@github-project-automation github-project-automation bot moved this to 🆕 Triage in DSpace Backlog Oct 26, 2023
@artlowel
Copy link
Member

artlowel commented Oct 26, 2023

@atarix83 The problem seems to be caused by the reRequestOnStale feature, if you set that to false, in the call you mentioned, the problem goes away.

Since the submission always manually re-retrieves the submission objects it shouldn't be necessary anyway so disabling it shouldn't affect the functionality.

However I do think there's still a bug in that reRequestOnStale feature, in a complicated case like this. If i log the number of calls to the findByID method for that same submission object, that are still subscribed when the bug occurs, I count 6. Some with reRequestOnStale true, others false. Then we also manually re-retrieve the object in the effect (by setting useCachedIfAvailable to false). I suspect this causes an edge case where the request that one of these subscriptions makes gets immediately set to stale by one of the others, causing the reRequestOnStale to trigger, which sets it to stale again, causing an infinite loop

So I'd try the workaround of disabling reRequestOnStale in the effect, see if it doesn't break anything, and if it doesn't merge that now. But leave the issue open to look into in more detail later

@atarix83
Copy link
Contributor Author

atarix83 commented Oct 26, 2023

thanks @artlowel for your analysis. i can confirm your solution works.
I've also find out that if i change the request by including the item and collection embeds it works as well even with reRequestOnStale as true.
I've tried it becuase i notice that there are two requests done endlessly. the first one with just the submission id and the other one with also item and collection embed
immagine

Maybe it can help to better understand the bug.

In the end i agree to temporary fix the issue in one of the two way and then to try to find out the problem in this edge case

@tdonohue tdonohue added component: submission high priority and removed needs triage New issue needs triage and/or scheduling labels Oct 26, 2023
@tdonohue tdonohue added the performance / caching Related to performance, caching or embedded objects label Oct 26, 2023
@hutattedonmyarm
Copy link
Contributor

I'm positive, that this is related to #1924. I observed the same pattern of endlessly re-requesting on stale

@tdonohue tdonohue moved this from 📋 To Do to 🏗 In Progress in DSpace 8.x and 7.6.x Maintenance Nov 2, 2023
@tdonohue tdonohue added this to the 7.6.1 milestone Nov 9, 2023
@github-project-automation github-project-automation bot moved this from 🏗 In Progress to ✅ Done in DSpace 8.x and 7.6.x Maintenance Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug component: submission high priority performance / caching Related to performance, caching or embedded objects
Projects
Development

Successfully merging a pull request may close this issue.

4 participants