graphql-java-kickstart / graphql-java-servlet

Servlet endpoint for GraphQL Java
https://www.graphql-java-kickstart.com/servlet/
Other
223 stars 114 forks source link

New ThreadPool are constantly being created on every http request #537

Open tdraier opened 12 months ago

tdraier commented 12 months ago

Describe the bug When using OsgiGraphQLHttpServlet, a new thread pool (of 1 thread) is created on every request, and never shut down. The thread pool is created when creating a GraphQLConfiguration - if no asyncExecutor was provided (which is not possible when using OsgiGraphQLHttpServlet), a new ThreadPoolExecutor is created, without keeping any reference on it, and so never shutting it down. Creating a thread pool transparently without shutting it down is already an issue, but moreover OsgiGraphQLHttpServlet.getConfiguration() is creating a new configuration on every call, which is actually happening in AbstractGraphQLHttpServlet.doRequest() .

To Reproduce Steps to reproduce the behavior:

  1. Create an OsgiGraphQLHttpServlet
  2. Make http requests
  3. Check the total number of threads

Expected behavior

I will try to provide a PR soon

tdraier commented 10 months ago

Hi,

Any news on this ? Did anybody have a chance to look at the PR ?

federicorispo commented 8 months ago

@tdraier Thanks for your PR. I will look into it in the next few days :pray: