Description
As long as there is not yet a live, preview and draft variant, there seems to be room that two variants of the same state are created.
Reproductions paths:
Reproduction 2 live variants
0) Login with admin
1) Create a draft document and save it. You now have a preview and draft variant
2) Set a breakpoint at org.onehippo.repository.documentworkflow.DocumentWorkflowImpl#publish()
3) Login with editor in a different browser
4) In both browsers, publish the document. Make sure both calls hang on the breakpoint
5) Stop the debugger (both threads continue)
6) Result : 2 live variants
Reproduction 2 draft variants
0) Login with admin
1) Go to a bootstrapped live document that does not yet have a draft
2) Set a breakpoint at org.onehippo.repository.documentworkflow.DocumentWorkflowImpl#obtainEditableInstance
3) Login with editor in a different browser
4) In both browsers, click edit the document. Make sure both calls hang on the breakpoint
5) Stop the debugger (both threads continue)
6) Result : 2 draft variants
Once there are three variants, the issue does not seem to occur any more. When there are 3 variants, one of the action just fails (something like [SCXMLWorkflowExecutor.handleException:191] org.apache.jackrabbit.core.state.NoSuchItemStateException: fa8a52a1-3c7b-4ec3-bf75-53f2c65af939). Most likely this is because once there are 3 variants, one of the calls gets a already modified from JCR.
Customers that have large document structures are more likely to hit this bug.
Potential solution: On a workflow action, also always touch the handle. This way, the second call is likely to fail because it gets a already modified on the handle node.
We need to carefully test the solution also in clustered environments.
Attachments
Issue Links
- is backported by
-
REPO-1389 [7.9]: Multiple variants of the same state can be created
- Closed
-
REPO-1391 [10.1]: Multiple variants of the same state can be created
- Closed
-
REPO-1392 [10.0]: Multiple variants of the same state can be created
- Closed
- relates to
-
REPO-1409 [10.1] Code to prevent multiple same-state variants from being created can cause database inconsistencies
- Closed
-
REPO-1410 [7.9] Code to prevent multiple same-state variants from being created can cause database inconsistencies
- Closed
-
REPO-1411 [10.0] Code to prevent multiple same-state variants from being created can cause database inconsistencies
- Closed