Hi,
We're seeing some strange memory leaks in a couple of production systems, I'm not 100% sure this is actually the cause of the problem but it's odd enough I thought I'd make a post anyway...
Essentially what I'm seeing is openresty/1.9.15.1 (and 1.11.2rc1) workers not releasing memory when connections are closed.
However equivalent versions of vanilla nginx don't exhibit the same behaviour, nor does Openresty 1.9.7.5
My test config is here: https://gist.github.com/hamishforbes/bb47787f723c149c7aca21e760970502
The idea is to make requests wait so there are many concurrent open requests.
Then hit this config with high concurrency: `wrk -c 9000 -t 100 http://localhost:80/ -d 30 --timeout 15`
What I see is worker memory usage climb as expected and `ss` show around 20k open connections.
With openresty >1.9.7.5 the memory usage never drops off again.
If I halt the test and wait for `ss` to show normal connections again there is no change in the worker memory usage.
Repeating the same test with vanilla nginx 1.11.2 (and the echo module compiled in) shows worker memory usage drop back to normal very quickly.
I've also tried using ngx_lua rather than echo_sleep, same behaviour.
And as a last resort I tried using proxy_pass to a separate openresty instance, in that case the openresty instance listening on 80 does not use any non-standard modules but still exhibits the same behaviour.
Test system is
Centos 6.8
Kernel 2.6.32-573.3.1.el6.x86_64
nginx version: openresty/1.9.15.1
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC)
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt=-O2 --add-module=../ngx_devel_kit-0.3.0 --add-module=../echo-nginx-module-0.59 --add-module=../xss-nginx-module-0.05 --add-module=../ngx_coolkit-0.2rc3 --add-module=../set-misc-nginx-module-0.30 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.05 --add-module=../srcache-nginx-module-0.31 --add-module=../ngx_lua-0.10.5 --add-module=../ngx_lua_upstream-0.05 --add-module=../headers-more-nginx-module-0.30 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.17 --add-module=../redis2-nginx-module-0.13 --add-module=../redis-nginx-module-0.3.7 --add-module=../rds-json-nginx-module-0.14 --add-module=../rds-csv-nginx-module-0.07 --with-ld-opt=-Wl,-rpath,/usr/local/openresty/luajit/lib --with-pcre=/root/pcre-8.38 --with-pcre-jit --with-http_geoip_module --with-http_realip_module --with-http_gunzip_module --with-http_ssl_module
Any ideas or pointers on where to go with debugging this would be much appreciated!
Thanks
Hamish