Uploaded image for project: 'Release Notes Application'
  1. Release Notes Application
  2. RN-88

Two authors adding a change to the same release note at the same time are given the same entry page, and the second save overwrites the first

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 2.0
    • Application
    • None
    • Unknown

    Description

      Problem

      Code/EntryVelocityMacros #handleAddAction computes the next entry name from the pages that already exist, then redirects the author to that name in the inline editor:

      #set ($highest = $highestQuery.setLimit(1).execute())
      ... compute $nextUniqueNumber ...
      $response.sendRedirect($xwiki.getURL(<...>.Entry###, 'edit', ...))
      

      The new page only starts existing when the author saves. The window is therefore not milliseconds — it is the whole editing session.

      Consequence

      If two people click "Add ... Change" on the same release note before the first one saves, both compute the same Entry### name and both get an empty inline form for the same page. Last save wins, the other change is lost, and neither author gets a conflict warning.

      This is the workflow the application exists for (a release manager and a committer filling in the same release note).

      Possible fix

      Create the page immediately from the template (empty) before redirecting, or loop until an unused name is found.

      Secondary, same code

      The candidate query orders by doc.space desc, which is a string sort, so past Entry999 the highest space is Entry999 rather than Entry1000 and the number 1000 is handed out repeatedly. This needs ~1000 entries in one version space, so it is much less likely to be hit than the concurrency case.

      Attachments

        Activity

          People

            Unassigned Unassigned
            vmassol Vincent Massol
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: