Uploaded image for project: 'Crucible'
  1. Crucible
  2. CRUC-6708

Triggering certain API calls from within event handlers might cause a db deadlock

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Medium
    • 3.5.0
    • 3.0.0, 3.1.0, 3.2.0, 3.3.0, 3.4.0
    • None
    • None

    Description

      HTR:

      1. Add an eventListener using reviewService.getReviewDetails() in the event handling thread
            @EventListener
            public void onReviewEvent(final ReviewStateChangedEvent event) {
                impersonationService.doPrivilegedAction(null, new Operation<Object, RuntimeException>() {
                    @Override
                    public Object perform() throws RuntimeException {
                        return reviewService.getReviewDetails(event.getReviewId());
                    }
                });
            }
        
      2. Create a review through the REST API (POST /rest-service/reviews-v1.json)
      3. Try to transition the review through the REST API (POST /rest-service/reviews-v1/CR-7/transition?action=action:submitReview)
      4. The second call never returns

      What's happening is that the original transaction is not closed when publishing the event, and requesting revision details for the first time triggers a separate transaction in the retriable thread pool. The two transactions deadlock in the db (tested with postgres) and never return.

      Attachments

        Issue Links

          Activity

            People

              lpater Lukasz Pater
              lpater Lukasz Pater
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: