httpClient Selector Manager Threads

Hey all,
We've currently got a system running. This isn't a huge system, allocated only around 3/4GB of memory.

This server sends out data to a backend server fairly often using HTTP post/get requests.

Something we've noticed is a large number of threads in the system using the name:

HttpClient-xxxx-SelectorManager, id= xyz

They use 0.0 CPU but with the number of them we have open (around 300 threads in total, a lot of them this thread type) I worry we have some kind of memory leak.

To do these calls we use, we have a few instances of these set up for various scripting modules. But only around 4 to 5 across all project scripts.

Make sure you are calling the httpClient outside of your functions and use them globally. You only need to make one client per port you are using. If you are calling in a function, it's going to grab a socket from your pool every time it is called. Current version of java in ignition does not close these automatically, so they stay open indefinitely or until the timeout occurs (if you set one).

1 Like