Publish Dataset locks forever if working with a dataset in two tabs at the same time
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 564
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 29
Description
What steps does it take to reproduce the issue?
- Create a dataset in one tab (Tab1)
- Open the same dataset in another tab (Tab2)
- In Tab1 add a "Subtitle" value via Metadata > Add + Edit Metadata > Add a subtitle and Save changes
- Switch to Tab2 and press "Publish Dataset"
Publishing will fail with this error:
Error – Command edu.harvard.iq.dataverse.engine.command.impl.PublishDatasetCommand@ae7d829 failed: Exception [EclipseLink-5010] (Eclipse Persistence Services - 4.0.1.payara-p1.v202304041433): org.eclipse.persistence.exceptions.OptimisticLockException Exception Description: The object [[DatasetVersion id:9]] cannot be merged because it has changed or been deleted since it was last read. Class> edu.harvard.iq.dataverse.DatasetVersion If you believe this is an error, please contact Root Support for assistance.
And the
Publish in Progress – The dataset is locked while the persistent identifiers are being registered or updated, and/or the physical files are being validated.
message will be displayed indefinitely because the dataset will remain in a locked state forever because of the previous error
- When does this issue occur?
When working with the same dataset in multiple browser tabs and doing editing in one tab and pubishing in another one.
- To whom does it occur (all users, curators, superusers)?
Any user.
- What did you expect to happen?
Publishing should not fail no matter how many tabs the dataset is edited in.
Which version of Dataverse are you using?
6.0
Screenshots:
Possible solution
The cause of the problem seems to be that the UI state is stored in a DataversePage object and it has an instance of the Dataset, which have already changed in the database:
Here at line 2756 doing something like this before submitting the PublishDatasetCommandwould resolve this issue:
dataset = datasetService.find(dataset.getId());
final PublishDatasetResult result = commandEngine.submit(
new PublishDatasetCommand(dataset, dvRequestService.getDataverseRequest(), minor)
);
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/main/java/edu/harvard/iq/dataverse/DatasetPage.java around lines 2753-2759, then follow the PublishDatasetCommand submission and dataset persistence flow. Reproduce the two-tab editing and publishing sequence from the issue. Done means publishing does not fail with an OptimisticLockException and the dataset does not remain locked indefinitely.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100