Comments (10)
@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.
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.
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.
Thanks @tdonohue We will try to apply the fix!
from dspace-angular.
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.
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.
- Start a new Submisssion
- Fill out an Author and Title
- In "Date of Issue" field, use the up/down arrows to set year, then month, then day.
- Fill out other required fields in first section (namely "Type")
- 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.
@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.
@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.
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.
Fixed in 7.6.2 and 8.0 via #3139 and #3138 respectively.
from dspace-angular.
Related Issues (20)
- (Discussion) High CPU usage in DSpace frontend related to Angular Server Side Rendering (SSR) HOT 15
- Rendering markdown before mathjax can lead to wrong outcome HOT 1
- Remove Bitstreams on edit-item-page doesn't work HOT 5
- ngVars cause duplicate thumbnail bitstream requests HOT 3
- Submission edit page get stuck when providing a not existing workspaceitem id
- Discarding a submission without files generates an error
- Related publications should be listed/displayed on the Journal item entity
- Can't save cookie preferences when declining Google ReCaptcha cookies HOT 1
- Understanding getInitValueFromModel with values that do not have authority keys HOT 3
- [Deque Analysis] Reorder buttons in Edit Item / Bitstreams forms are not keyboard accessible (Critical Issue)
- User Permissions should be obtained in fewer REST requests HOT 2
- Submission Form should be loaded using fewer REST requests HOT 3
- Search Results should be loaded using fewer REST requests HOT 3
- View CC license in DSpace 8.0 Publication EntityType
- Default DSpace considering Publications or Untyped Items as default entities for Homepage Recent and every Browse by filters
- Missing edit bitstream's metadata feature
- ItemPageCcLicenseFieldComponent wrongly assumes that any license in `dc.rights` is a CC license
- Grant document copy request is not working in dspace cris 7 HOT 1
- (Discussion) Static Site Generation in DSpace HOT 2
- (Discussion) Easier Installation Process for DSpace HOT 15
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dspace-angular.