Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-13177

ManagedExecutorService: Wrong activeRequestCount at RequestController on RejectedExecutionException

    • Hide
      • Configure a ManagedExecutorService with a limited pool and queuesize
      • Let an application fill out the pool and queue with threads -> see the number of active requests stated by the RequestController is as expected
      • Submit/Execute one more thread to get a RejectedExecutionException as expected -> see the number of active request is erroneously incremented by each of such event.
      Show
      Configure a ManagedExecutorService with a limited pool and queuesize Let an application fill out the pool and queue with threads -> see the number of active requests stated by the RequestController is as expected Submit/Execute one more thread to get a RejectedExecutionException as expected -> see the number of active request is erroneously incremented by each of such event.

      On WF-13 and WF-16 we observe a serious bug of the RequestCount of the RequestController while using ManagedExecutorService.submit() or ...execute() in the edge case of a full queue. In this case, the caller gets a RejectedExecutionException, but in the RequestController, the number of active requests is erroneously incremented.

      This will lead to a false and monotonously increasing number of active requests. And in case of a limitation configured by the maxRequestCount feature, which is best practice for production environments, over the time this will lead to deadlock of the RequestController and herewith the complete activity of the Wildfly at all.

            [WFLY-13177] ManagedExecutorService: Wrong activeRequestCount at RequestController on RejectedExecutionException

            istudens@redhat.com emartins@redhat.com - on a CI run on GitHub Actions I have seen a test that was added for this issue fail: https://issues.redhat.com/browse/WFLY-16637

            Tom Jenkinson added a comment - istudens@redhat.com emartins@redhat.com - on a CI run on GitHub Actions I have seen a test that was added for this issue fail: https://issues.redhat.com/browse/WFLY-16637

            Proposing a fix for this. It catches RejectedExecutionException thrown by a submit method of an executor and decreases activeRequestCount by controlPoint.requestComplete(), but only if RequestController returns RunResult.RUN for that task. In case of RunResult.REJECTED no decrease is needed.

            Ivo Studensky added a comment - Proposing a fix for this. It catches RejectedExecutionException  thrown by a submit method of an executor and decreases activeRequestCount by controlPoint.requestComplete() , but only if RequestController returns RunResult.RUN for that task. In case of RunResult.REJECTED no decrease is needed.

              istudens@redhat.com Ivo Studensky
              gjaekel Guido Jäkel (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: