Giter Site home page Giter Site logo

Comments (10)

tdonohue avatar tdonohue commented on August 11, 2024 1

@nibou230 : the change in #3053 was to override the default getRequestInstance() method of JsonPatchOperations only for the SubmissionJsonPatchOperations service. This override ensures the embed=item is always included in every PATCH request sent by the submission form. See #2962 for more details on why this change is made.

(#2962 is the original PR that was created for 8.0 and #3053 is just a backport of that PR to 7.6.x)

from dspace-angular.

tdonohue avatar tdonohue commented on August 11, 2024

This may be difficult to debug if we cannot find a way to reliably reproduce it either locally or on our Demo (https://demo.dspace.org) or Sandbox (https://sandbox.dspace.org) site.

From the error stacktrace, it sounds like the Submission Form is attempting to replace a value in some metadata field with a new value. But, an error occurs because the old value (value to be replaced) no longer exists. The area of the code which throws the error appears to be here: https://github.com/DSpace/DSpace/blob/dspace-7_x/dspace-server-webapp/src/main/java/org/dspace/app/rest/submit/factory/impl/ItemMetadataValueReplacePatchOperation.java#L59
(Essentially, the check that the old value is "notEmpty" is failing.)

One possible solution might be to simply ignore that empty/missing value, since it's being replaced anyway. Instead, the code might be updated to add the new value even if the old one is missing.

As that might solve this issue, I'll add this to our bug board in search of a volunteer. However, the priority is uncertain until we can figure out how frequently this occurs. It's unclear to me how to get the Submission Form into this state where you are replacing a value that no longer exists. It's also possible that the core problem is that the Submission Form & underlying WorkspaceItem have gotten out-of-sync, which may mean this bug is potentially fixed by #2962 or #3016

from dspace-angular.

tdonohue avatar tdonohue commented on August 11, 2024

This might be solved by #3053 (a new backport of #2962 to 7.x), but would need further testing. My suspicion is this error may be a side effect of the Submission Form & WorkspaceItem going "out of sync". If that suspicion is correct, then #3053 should fix the bug.

from dspace-angular.

pilasou avatar pilasou commented on August 11, 2024

Thanks @tdonohue We will try to apply the fix!

from dspace-angular.

nibou230 avatar nibou230 commented on August 11, 2024

Hi @tdonohue, how adding the method "getRequestInstance" will fix the error? Was this method being used somewhere and was missing in the code?

from dspace-angular.

tdonohue avatar tdonohue commented on August 11, 2024

I've found this is still reproducible on main (not fixed by #3053). It's difficult to reproduce regularly...but, I've been able to get it to occur randomly when I set the "Issue Date" field using the up/down arrows.

  1. Start a new Submisssion
  2. Fill out an Author and Title
  3. In "Date of Issue" field, use the up/down arrows to set year, then month, then day.
  4. Fill out other required fields in first section (namely "Type")
  5. Click to next section. This triggers a Save. Sometimes it works, and sometimes you'll get a 500 error.
    • That said it is still very difficult to reproduce successfully. It seems almost like a race condition is occurring. I've tried this same process ~10 times today and only had it happen once. That said, I've captured the details below.

When the 500 error occurs, it's because the date field PATCH operation sends a "replace" action before the "add" action. For instance, this is an example PATCH request data that I had recently. Notice the third action is a "replace" on dc.date.issued even though nothing was added to that field yet.

[
  {"op":"add","path":"/sections/traditionalpageone/dc.title","value":[{"value":"Any Title","language":null,"authority":null,"display":"Any Title","confidence":-1,"place":0,"otherInformation":null}]}, 
  {"op":"add","path":"/sections/traditionalpageone/dc.contributor.author","value":[{"value":"Donohue, Tim","language":null,"authority":null,"display":"Donohue, Tim","confidence":-1,"place":0,"otherInformation":null}]}, 
  {"op":"replace","path":"/sections/traditionalpageone/dc.date.issued/0","value":{"value":"2023-06","language":null,"authority":null,"display":"2023-06","confidence":-1,"place":0,"otherInformation":null}}, 
  {"op":"add","path":"/sections/traditionalpageone/dc.date.issued","value":[{"value":"2023-06-12","language":null,"authority":null,"display":"2023-06-12","confidence":-1,"place":0,"otherInformation":null}]}, 
  {"op":"add","path":"/sections/traditionalpageone/dc.type","value":[{"value":"Article","language":null,"authority":null,"display":"Article","confidence":-1,"place":0,"otherInformation":null}]}, 
  {"op":"add","path":"/sections/traditionalpageone/dc.language.iso","value":[{"value":"en_US","language":null,"authority":null,"display":"en_US","confidence":-1,"place":0,"otherInformation":null}]}]

It's that "replace" action which causes the 500 error, as a "replace" REQUIRES that an "add" happened previously. On main, the error stacktrace is different and provides more details:

2024-06-12 11:40:51 2024-06-12 16:40:51,947 ERROR ec49885b-3617-4441-a022-20dcf8505f51 8f1ba5c2-21dc-4369-a1ff-57047af05d89 org.dspace.app.rest.submit.SubmissionService @ No metadata fields match dc.date.issued
2024-06-12 11:40:51 java.lang.IllegalArgumentException: No metadata fields match dc.date.issued
2024-06-12 11:40:51     at org.springframework.util.Assert.notEmpty(Assert.java:381) ~[spring-core-6.1.6.jar!/:6.1.6]
2024-06-12 11:40:51     at org.dspace.app.rest.submit.factory.impl.ItemMetadataValueReplacePatchOperation.replace(ItemMetadataValueReplacePatchOperation.java:59) ~[dspace-server-webapp-8.0-SNAPSHOT.jar!/:8.0-SNAPSHOT]
2024-06-12 11:40:51     at org.dspace.app.rest.submit.factory.impl.ReplacePatchOperation.perform(ReplacePatchOperation.java:26) ~[dspace-server-webapp-8.0-SNAPSHOT.jar!/:8.0-SNAPSHOT]
2024-06-12 11:40:51     at org.dspace.app.rest.submit.step.DescribeStep.doPatchProcessing(DescribeStep.java:172) ~[dspace-server-webapp-8.0-SNAPSHOT.jar!/:8.0-SNAPSHOT]
2024-06-12 11:40:51     at org.dspace.app.rest.submit.SubmissionService.evaluatePatchToInprogressSubmission(SubmissionService.java:504) ~[dspace-server-webapp-8.0-SNAPSHOT.jar!/:8.0-SNAPSHOT]
2024-06-12 11:40:51     at org.dspace.app.rest.repository.WorkspaceItemRestRepository.patch(WorkspaceItemRestRepository.java:213) ~[dspace-server-webapp-8.0-SNAPSHOT.jar!/:8.0-SNAPSHOT]

I'm going to bring this to this week's Dev Meeting, as this error blocks the ability to submit. It seems to be more reproducible than I originally thought.

from dspace-angular.

tdonohue avatar tdonohue commented on August 11, 2024

@artlowel and @atarix83 : Pinging you on this ticket as there seems to be a PATCH "order of operations" bug in the Submission form which can cause instability in the submission form. See my prior comment for details.

Also bringing this to tomorrow's DevMtg as this seems to be a serious bug, when it occurs.

Possible Solutions?

  • Obviously, the ideal solution is to figure out what is causing these out-of-order operations
  • Another option may be to switch all "replace" operations to "add" operations on the Submission Form, as "add" can also be used for replacement.
  • A third option is to change the behavior of "replace" on the backend and no longer throw a strict error (which fails all operations when a 500 error occurs). Instead, if no value exists to replace, log an error but ignore the "replace" operation.

from dspace-angular.

tdonohue avatar tdonohue commented on August 11, 2024

@atarix83 : I wanted to note that I had this same issue happen again today. It happened on the first new item that I tried to submit after booting up my local copy of DSpace today (running on main).

The cause is the same. Again, I used the arrow keys (clicked all the up arrow keys) on the date field to set the year, month, and day (one by one). The resulting PATCH data again had the invalid replace on the date field.

{"op":"add","path":"/sections/traditionalpageone/dc.contributor.author","value":[{"value":"Donohue, Timothy","language":null,"authority":null,"display":"Donohue, Timothy","confidence":-1,"place":0,"otherInformation":null}]},
{"op":"add","path":"/sections/traditionalpageone/dc.title","value":[{"value":"Test Dataset","language":null,"authority":null,"display":"Test Dataset","confidence":-1,"place":0,"otherInformation":null}]},
{"op":"replace","path":"/sections/traditionalpageone/dc.date.issued/0","value":{"value":"2024-06","language":null,"authority":null,"display":"2024-06","confidence":-1,"place":0,"otherInformation":null}},
{"op":"add","path":"/sections/traditionalpageone/dc.date.issued","value":[{"value":"2024-06-13","language":null,"authority":null,"display":"2024-06-13","confidence":-1,"place":0,"otherInformation":null}]}
...

After discarding that first submission & trying the same process again... I cannot reproduce the error again. I don't know if it's more likely to occur on the first submission after a reboot, or if this was by coincidence.

from dspace-angular.

atarix83 avatar atarix83 commented on August 11, 2024

@tdonohue

I found a way to reproduce the error systematically:

  • create a new submission
  • start to edit the date field following those steps:
    • add the year by clicking on the up arrow button
    • edit the year manually by entering a different year
    • add the month by clicking on the up arrow button
  • if you click on save you'll see the error
Video.del.19-06-2024.12.44.16.webm

I've found the cause and i'll open a PR asap

from dspace-angular.

tdonohue avatar tdonohue commented on August 11, 2024

Fixed in 7.6.2 and 8.0 via #3139 and #3138 respectively.

from dspace-angular.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.