Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-12129

Simultaneous requests to add the same merge check can lead to duplicate data in the database

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Medium Medium
    • None
    • 5.2.0
    • Repository - Hooks

      Issue Summary

      Simultaneous requests to add the same merge check can lead to duplicate data in the database

      Steps to Reproduce

      1. Two simultaneous requests to enable a merge check on a repository or a project can, under certain circumstances, lead to duplicate data being inserted to the database for the merge check

      Expected Results

      1. Uniqueness should be enforced such that it is not possible to insert the exact same merge check more than once

      Actual Results

      1. Under certain circumstances duplicate data can be inserted to the database for the exact same merge check for a particular project or repository.
      2. When this happens if the user tries to access pull request settings for the repository they will get an error message "A database has occurred" and the application logs show an exception along the following lines:
      Caused by: org.hibernate.NonUniqueResultException: query did not return a unique result: 2
              at org.hibernate.query.internal.AbstractProducedQuery.uniqueElement(AbstractProducedQuery.java:1601)
              at org.hibernate.query.internal.AbstractProducedQuery.uniqueResult(AbstractProducedQuery.java:1571)
              at org.hibernate.query.criteria.internal.compile.CriteriaQueryTypeQueryAdapter.uniqueResult(CriteriaQueryTypeQueryAdapter.java:81)
              at com.atlassian.stash.internal.repository.HibernateRepositoryHookDao.findByKey(HibernateRepositoryHookDao.java:72)
              at com.atlassian.stash.internal.hook.repository.DefaultRepositoryHookService.getEffectiveRepositoryHook(DefaultRepositoryHookService.java:593)
              at com.atlassian.stash.internal.hook.repository.DefaultRepositoryHookService.getByKey(DefaultRepositoryHookService.java:268)
              ... 49 common frames omitted
      

      Workaround

      Currently there is no known workaround for this behavior. A workaround will be added here when available

              Unassigned Unassigned
              fdoherty@atlassian.com Frank Doherty
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated: