Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-2393

Missing executor service shutdown

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 4.4.1.Final
    • 4.4.0.Final
    • None
    • None

      I see this kind of thread hanging around + my "app" doesn't exit:

      It's due to "this.cleanupExecutor = cleanupExecutor;" being set to false ...
      See see org.jboss.resteasy.microprofile.client.RestClientBuilderImpl#238

      public ResteasyClientBuilder executorService(ExecutorService executorService)
      {
      return asyncExecutor(executorService, false);
      
      //...
      
      // this is rest easy default
          ExecutorService executorService = this.executorService != null ? this.executorService : Executors.newFixedThreadPool(10);
      
          ExecutorService executor = AsyncInvocationInterceptorHandler.wrapExecutorService(executorService);
          resteasyClientBuilder.executorService(executor);
      

      As we can see new executorService is created, added as asyncExecutor, but with cleanupExecutor==false.
      Hence the executor is never shutdown in client's close().

      If I use and control own executor, it all works (exists) as expected.

      I use some CompletionStage as return type in my app's REST API, which uses this executor – hence "leaking" the thread.
      If no async REST API is actually used, it's all fine – probably why this didn't show-up before.

            rhn-support-asoldano Alessio Soldano
            ajustin@redhat.com Ales Justin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: