Uploaded image for project: 'Jira Software Data Center'
  1. Jira Software Data Center
  2. JSWSERVER-16501

Getting DB lock for lexorank may take more than 4 seconds

    XMLWordPrintable

Details

    Description

      Summary

      In some rare cases, getting of lexorank row through DB may take more than 4 seconds.

      Environment

      • Any plugin to create on subtasks on transition
      • Some other long-running transition postfunction

      Steps to Reproduce

      1. Perform long-running transition
      2. Simultaneously try to create issue.

      Expected Results

      rankInitially fails with 4sec timeout

      Actual Results

      rankInitially waits for transition to finish.

      Explanation

      LexorankDao#acquireLock is supposed to finish to either succeed or fail immediately. And then there's a lot of error handling about this.
      But in case in some other transaction holds an SQL update lock, acquireLock query will wait for that transition to finish.

      Proposed solution

      The best way would be to use SELECT FOR UPDATE NOWAIT. It will properly represent tryLock nature of acquireLock. Unfortunately, it is not supported by mysql. (https://dev.mysql.com/worklog/task/?id=3597)
      A bit worse option: use Statement#setQueryTimeout(int) from JDBC. It won't exit immideately, but at least it will fail after some time instead of waiting infinitely.
      We are going with the second option

      Workaround

      • None

      Attachments

        Issue Links

          Activity

            People

              izinoviev Ilya Zinoviev (Inactive)
              izinoviev Ilya Zinoviev (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: