Viewless timeseries tests and their use of timeseries "explain" frequently wrap feature flag checks in areViewlessTimeseriesEnabled(). What gets hidden under that check is that the call eventually goes to the feature flags util, where a new direct connection to the CSRS is opened to check the feature flag. The shell is slow to close and release the connection, eventually piling up several thousand of open connections in the FSM tests.
I can think of two fixes here:
- Change the feature flag util to not open a new connection each time. This way, anyone building on top of a feature flag util check will be saved from connection pile-up.
- Since this happens only in timeseries tests, and recently, work with the team to figure out what the latest changes might be triggering this behavior, and if possible, cache the result from routines like areViewlessTimeseriesEnabled() locally in the test rather than going to the config server each time.