Listeners don't save the issue changes after work in queue

Aleksei Ulianov January 25, 2018

The problem appears on JIRA 7.2.7.

Situation:

  • Listener A is configured for project P to autoassign issue to another user after it is moved to project P;
  • Listener B is configured for project P to autotransition issue to another status after it is moved to project P (even if issue changes workflow within moving);
  • Both listeners exist within the same plugin.

The design of this listeners configured to do simple actions, which can be tested independently and fixed quickly.

 

Bug: when listener A processes before listener B, then issue assigner don't change. Otherwise (autoassign after autotransition), both listeners work correctly.

 

It was founded that listeners form queue of work randomly and process consistently. The order of queue can be changed through the plugin reinstalling, listener updating or server restarting. It seems that java-code “event.getIssue()” returns current local issue state, so the listener B has old issue assigner after listener A actions and saves issue state B in database with old value.

 

Please answer following questions:

  • Hot fix of bug is to use IssueManager - “issueManager.getIssueObject(event.getIssue().getId())” because it returns actual issue state. Can this way to provide code safety?
  • If no, theoretically, IssueEvent object can contains specific data only for this listener, which couldn't be used. What are this data?
  • Is this problem associated only with issue transitions and system fields? For example, it looks like custom field values updating has no errors.
  • Also, the problem listeners can be transformed to one big listener. What another ways can fix this bug? What is the best way?

0 answers

Suggest an answer

Log in or Sign up to answer