sto/ngx_http_auth_pam_module

Memory Leak

zonzamas opened this issue · 5 comments

It seems to me that this module is leaking both memory and file descriptors in nginx versions 1.10 and 1.9.14. Concretely it leaks file descriptors (and memory) when built as a dynamic module in 1.10. When built 'statically' it only leaks memory.

The leaked file descriptor points to /dev/urandom

I've tried Ubuntu PPA's and Nginx official packages. The first one has this module built statically, whereas I compiled myself dynamically for Nginx's official package.

stogh commented

Give concrete examples and configurations, I can't guess what is happening in your system with your description.

In any case keep in mind that the memory and file description problems can come from this module, but the problem is usually caused by the PAM modules configured, not the module (i.e. the libpam-ldap module has memory problems when loaded dynamically)

I've tried compiling the module with nginx versions 1.8.1, 1.10.0 and 1.9.14 on Ubuntu Trusty 14.04 + libpam-ldap 184-8.5.ubuntu
I've tried both ngx_http_auth_pam_module 1.5.1 and 1.4. Version 1.5.1 leaks both memory and filedescriptors and 1.4 just memory.

I'm doing static compilation now. I'm basically trying the example from the README + an ab run to throw 20-30k logins. The memory usage by nginx increases and it is never fully freed.

The ab I run is something like: ab -n 25000 -c 10 -A user:password https://foo.bar.com

Im not using pam_listfile.so nor pam_exec, just pam_ldap

I will try libpam-ldapd to see whether this problem reproduces there or not

stogh commented

As I've already said, that is known bug from libpam-ldap, see:

https://bugs.launchpad.net/ubuntu/+source/libpam-ldap/+bug/1418265

👍 , thank you!