We are observing a steady build up of I/O dispatcher threads when firing queries from a Tomcat webapp we've developed. One thing to note... we are using the low-level Java REST client, and we only call close() on the RestClient when the webapp is stopped during Tomcat shutdown (i.e. ServletContextListener)... does this mean that the I/O dispatcher threads are only released then? Is there another way to release these threads? The problem is that they end up consuming a lot of memory and eventually the Tomcat instance goes OutOfMemory. Is there some basic step we could be missing here to ensure proper cleanup?
Also want to point out that our requests are returning with HTTP code 200, so we don't think it has anything to do with connections not getting cleaned up on failure.
The current expected behavior is that the client will create a thread per CPU core. If you find yourself seeing a lot more, then either you are creating extra clients or something is wrong. In those cases, please open an issue on GitHub.