Memory leaks nginx with lua memc upstream_keepalive modules/

[root@VKRT083 /home/fish]# uname -a
FreeBSD VKRT083.local 8.2-RELEASE-p3 FreeBSD 8.2-RELEASE-p3 #0: Tue Sep
27 18:45:57 UTC 2011
[email protected]:/usr/obj/usr/src/sys/GENERIC amd64
[root@VKRT083 /home/fish]# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.0.12
built by gcc 4.2.1 20070719 [FreeBSD]
configure arguments:
–add-module=…/chaoslawful-lua-nginx-module-7cb4e09/
–add-module=…/ngx_http_upstream_keepalive-d9ac9ad67f45
–add-module=…/simpl-ngx_devel_kit-24202b4/
–add-module=…/agentzh-memc-nginx-module-4007350/

[root@VKRT083 /home/fish]# ps axuww|grep ngi
– skip some strings –
root 14076 0.0 0.0 13488 2620 ?? Is 12:45PM 0:00.02 nginx:
master process /usr/local/nginx/sbin/nginx -c
/usr/local/nginx/conf/new.conf (nginx)
fish 14077 0.0 0.0 29872 7624 ?? S 12:45PM 1:31.10 nginx:
worker process (nginx)
fish 14078 0.0 9.1 2702512 2287312 ?? S 12:45PM 1:56.73 nginx:
worker process (nginx)
fish 14080 0.0 0.0 29872 7772 ?? S 12:45PM 1:30.19 nginx:
worker process (nginx)
fish 14081 0.0 8.6 2622640 2173000 ?? S 12:45PM 1:52.28 nginx:
worker process (nginx)
fish 14082 0.0 0.0 31920 9888 ?? S 12:45PM 1:40.60 nginx:
worker process (nginx)
fish 14083 0.0 0.0 31920 9948 ?? S 12:45PM 1:38.71 nginx:
worker process (nginx)
fish 14085 0.0 0.0 29872 7640 ?? S 12:45PM 1:48.66 nginx:
worker process (nginx)
fish 14086 0.0 5.9 1520816 1480176 ?? S 12:45PM 1:55.11 nginx:
worker process (nginx)
fish 14087 0.0 0.0 31920 9864 ?? S 12:45PM 1:36.69 nginx:
worker process (nginx)
fish 14089 0.0 0.0 29872 7752 ?? S 12:45PM 1:44.56 nginx:
worker process (nginx)
fish 14091 0.0 0.0 29872 6148 ?? S 12:45PM 1:47.95 nginx:
worker process (nginx)
fish 14094 0.0 0.0 29872 7200 ?? S 12:45PM 1:44.58 nginx:
worker process (nginx)
fish 14099 0.0 14.4 4895920 3620924 ?? S 12:45PM 1:50.18 nginx:
worker process (nginx)
fish 14103 0.0 0.0 31920 8576 ?? S 12:45PM 1:40.24 nginx:
worker process (nginx)
fish 14104 0.0 0.0 29872 7864 ?? S 12:45PM 1:45.71 nginx:
worker process (nginx)
fish 14106 0.0 0.0 29872 7824 ?? S 12:45PM 1:36.71 nginx:
worker process (nginx)
fish 14107 0.0 0.0 29872 6752 ?? S 12:45PM 1:46.78 nginx:
worker process (nginx)

Posted at Nginx Forum:

head of nginx.conf

[root@VKRT083 /home/fish]# cat /usr/local/nginx/conf/new.conf
user fish;
worker_processes 32;

pid logs/nginxnew.pid;

#worker_priority -5;

worker_rlimit_nofile 32000;

events
{
worker_connections 32000;
use kqueue;
}

http
{
include mime.types;
default_type application/octet-stream;

log_format  main    '$remote_addr - $remote_user [$time_local]

$request ’
'“$status” $body_bytes_sent “$http_referer” ’
‘“$http_user_agent” “$http_x_forwarded_for”’;

server_names_hash_bucket_size       512;
sendfile    on;
tcp_nopush  on;
tcp_nodelay on;

gzip on;
gzip_comp_level 1;
gzip_min_length 1000;
gzip_proxied any;
gzip_disable "MSIE [1-6]\.";
gzip_types application/x-javascript text/plain application/xml;

server_tokens   off;
keepalive_timeout   15;
ignore_invalid_headers     on;
reset_timedout_connection   on;

upstream backend {server 192.168.10.5:11211; keepalive 512 single;}

upstream tycoon0 {server 192.168.10.6:11111; keepalive 512 single;}

upstream tycoon1 {server 192.168.10.7:11111; keepalive 256 single;}

Posted at Nginx Forum:

On Fri, Feb 17, 2012 at 12:52 AM, fish_ka_praha [email protected]
wrote:

–add-module=…/simpl-ngx_devel_kit-24202b4/
–add-module=…/agentzh-memc-nginx-module-4007350/

Thank you for the report. But could you show me your Lua code? Or
could you prepare a minimized example that can reproduce this leak?

Without knowing how you actually use ngx_lua, I’m afraid we cannot
find the real cause here :slight_smile:

Thanks!
-agentzh