IQSS / IQSS/dataverse

Publish Dataset locks forever if working with a dataset in two tabs at the same time

Open
#10,120 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Type: Bug
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?

  1. Create a dataset in one tab (Tab1)
  2. Open the same dataset in another tab (Tab2)
  3. In Tab1 add a "Subtitle" value via Metadata > Add + Edit Metadata > Add a subtitle and Save changes
  4. 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:
Screenshot 2023-11-14 at 15 01 55

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:

https://github.com/IQSS/dataverse/blob/3305c4a41045d0bb2f261c5eb2aa93414a34f2c6/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java#L2753-L2759

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.