Uploaded image for project: 'Jira Service Management Server and Data Center'
  1. Jira Service Management Server and Data Center
  2. JSDSERVER-3533

Comment entities not set before COMMENT_CREATED fired, causes Race Condition for addons and event listeners

    XMLWordPrintable

    Details

      Description

      There seem to be two symptoms with a common cause:

      Converting a Private comment to Public

      As an Agent, I hit the Share With Customer button to convert a Private comment to a Public comment. The Comment_Edited event is fired, which is correct, however, it seems that the Event Declaring this change fires before JSD sets the entity properties of the comment that indicate the comments public nature. This means that Event Listeners would be unable to differentiate between a JSD Private comment and a JSD Private comment that was just Shared, meaning end-users will not be notified about such public features.

      Adding a Private comment

      We've found that with no other changes, as an Event Listener we receive comments that (a) have no entity properties defined (we see the entity property showing none()) , or (b) have entity properties defined. One possible explanation is that JSD is updating entity properties in an Event Listener callback, and the Set of Event Listeners notified is not a repeatable sequence:

      • If the JSD Event Listener is registered before ours, then the comment entity properties are set and treated as private (b)
      • If our Event Listener is registered first, then no properties are found and the comment is treated as public (a)

      It would be a race condition driven by the use of Event Listeners to set entity properties. With no deterministic way to detect JSD private comments in addons, addons will leak private information.

      The entity property identifying the comment as public must be set before the event is fired to ANY Event Listener. JSD should create the comment, without firing an event, setup its properties, then fire the event.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              cd3cc7134331 Andy Brook
              Votes:
              23 Vote for this issue
              Watchers:
              25 Start watching this issue

                Dates

                Created:
                Updated:

                  Backbone Issue Sync