Labels should not be updated because they are added to a page, because this could potentially lead to a deadlock

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Medium
    • 2.9
    • Affects Version/s: 2.8.2
    • Component/s: None

      In DefaultLabelManager.java you have

        public int addLabel(ContentEntityObject content, Label label)
          {
      ...
      ...
              label.setLastModificationDate(now());
              labelling.setCreationDate(now());
              labelling.setLastModificationDate(now());
      ...
      ...
      }
      

      There is no need to have label.setLastModificationDate(now()); as this will trigger an update in the labels table to update the modification date. However this information is not used anywhere. Further more it could lead to a deadlock if

      two pages are created via templates

      Page A, has labelA, labelB and
      Page B, has labelB, labelA

      If they are created in such a way that the thread A locks labelA and then tries to lock labelB to update however thread B has locked labelB and is waiting to lock LabelA.

      This was created from case https://support.atlassian.com/browse/CSP-20472 where I sent them a patch to comment out the line label.setLastModificationDate(now());

      Please talk to Matt Ryall about this case, if you need to.

              Assignee:
              Matt Ryall
              Reporter:
              Partha
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: