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

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Medium
    • 3.5.0
    • Affects Version/s: 3.0.0, 3.1.0, 3.2.0, 3.3.0, 3.4.0
    • Component/s: None
    • None

      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.

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

                Created:
                Updated:
                Resolved: