# Leaking memory nginx 1.8.0

**URL:** <https://www.ruby-forum.com/t/leaking-memory-nginx-1-8-0/242614>\
**Category:** NGINX\
**Created:** [July 7, 2015, 8:26am UTC](https://www.ruby-forum.com/t/leaking-memory-nginx-1-8-0/242614 "2015-07-07T08:26:25Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [July 7, 2015, 8:26am UTC](https://www.ruby-forum.com/t/leaking-memory-nginx-1-8-0/242614/1 "2015-07-07T08:26:25Z")

</div>

Hello, need help with leaking memory  
i installed fresh system , centos7.1 +directadmin + nginx1.8.0 +  
mariadb5.5.41 + php54 & php56 both with php\_fpm  
the server it for webhosting and i have there 32gb for now have only 4  
website on it, and after 1-2hours nginx take all memory when it come to  
96%  
it stop there and then all websites fall but nginx not, only after i  
reset  
nginx all back to normal for 1-2hours again.

how can i debug where the problem? or try find the problem? seems in  
logs i  
not see anything

Posted at Nginx Forum:

> **[leaking memory nginx 1.8.0](https://forum.nginx.org/read.php?2,260106,260106#msg-260106)**
>
> Hello, need help with leaking memory i installed fresh system , centos7.1 +directadmin + nginx1.8.0 + mariadb5.5.41 + php54 & php56 both with php\_fpm the server it for webhosting and i have there 32gb for now have only 4 website on it, and after...

---

<div class="post-metadata">

**Author:** ![evgeni22](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7cd45c/32.png) [@evgeni22](https://www.ruby-forum.com/u/evgeni22)\
**Post date:** [July 7, 2015, 8:51am UTC](https://www.ruby-forum.com/t/leaking-memory-nginx-1-8-0/242614/2 "2015-07-07T08:51:32Z")

</div>

2015-07-07 14:25 GMT+08:00 evgeni22 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> 

check your file descriptors’ limit, try increasing it

# ulimit -n

---

<div class="post-metadata">

**Author:** ![evgeni22](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7cd45c/32.png) [@evgeni22](https://www.ruby-forum.com/u/evgeni22)\
**Post date:** [July 7, 2015, 10:02am UTC](https://www.ruby-forum.com/t/leaking-memory-nginx-1-8-0/242614/3 "2015-07-07T10:02:48Z")

</div>

do you sure to increase? does not it will eat faster the memory?

Posted at Nginx Forum:

> **[Re: leaking memory nginx 1.8.0](https://forum.nginx.org/read.php?2,260106,260109#msg-260109)**
>
> Hello, need help with leaking memory i installed fresh system , centos7.1 +directadmin + nginx1.8.0 + mariadb5.5.41 + php54 & php56 both with php\_fpm the server it for webhosting and i have there 32gb for now have only 4 website on it, and after...

---

<div class="post-metadata">

**Author:** ![evgeni22](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7cd45c/32.png) [@evgeni22](https://www.ruby-forum.com/u/evgeni22)\
**Post date:** [July 7, 2015, 3:04pm UTC](https://www.ruby-forum.com/t/leaking-memory-nginx-1-8-0/242614/4 "2015-07-07T15:04:15Z")

</div>

$ su nginx --shell /bin/bash --command “ulimit -n”  
4096

it not fix the problem

nginx 10062 0.0 44.5 14763332 14639972 ? S 14:56 0:00 nginx:  
worker process  
nginx 10063 0.0 44.5 14763332 14639964 ? S 14:56 0:00 nginx:  
worker process  
nginx 10064 0.1 44.5 14763332 14639984 ? S 14:56 0:00 nginx:  
worker process  
nginx 10065 0.1 44.5 14763332 14640880 ? S 14:56 0:00 nginx:  
worker process

have you more advice?

Posted at Nginx Forum:

> **[Re: leaking memory nginx 1.8.0](https://forum.nginx.org/read.php?2,260106,260114#msg-260114)**
>
> Hello, need help with leaking memory i installed fresh system , centos7.1 +directadmin + nginx1.8.0 + mariadb5.5.41 + php54 & php56 both with php\_fpm the server it for webhosting and i have there 32gb for now have only 4 website on it, and after...

---

<div class="post-metadata">

**Author:** ![evgeni22](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7cd45c/32.png) [@evgeni22](https://www.ruby-forum.com/u/evgeni22)\
**Post date:** [July 7, 2015, 7:13pm UTC](https://www.ruby-forum.com/t/leaking-memory-nginx-1-8-0/242614/5 "2015-07-07T19:13:07Z")

</div>

$ nginx -V  
nginx version: nginx/1.8.0  
built by gcc 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC)  
built with OpenSSL 1.0.1e-fips 11 Feb 2013  
TLS SNI support enabled  
configure arguments:  
–add-module=…/modsecurity\_nginx-2.8.0/nginx/modsecurity --user=nginx  
–group=nginx --prefix=/usr --sbin-path=/usr/sbin  
–conf-path=/etc/nginx/nginx.conf --pid-path=/var/run/nginx.pid  
–http-log-path=/var/log/nginx/access\_log  
–error-log-path=/var/log/nginx/error\_log --with-ipv6  
–without-mail\_imap\_module --without-mail\_smtp\_module  
–with-http\_ssl\_module  
–with-http\_realip\_module --with-http\_stub\_status\_module  
–with-http\_gzip\_static\_module --with-http\_dav\_module --with-cc-opt=‘’-D  
FD\_SETSIZE=32768’’

i not sure yet but 4 last hours seems leak stoped after i stop  
security\_mod, can be the security\_mod doing this leaking in nginx ?

Posted at Nginx Forum:

> **[Re: leaking memory nginx 1.8.0](https://forum.nginx.org/read.php?2,260106,260118#msg-260118)**
>
> Hello, need help with leaking memory i installed fresh system , centos7.1 +directadmin + nginx1.8.0 + mariadb5.5.41 + php54 & php56 both with php\_fpm the server it for webhosting and i have there 32gb for now have only 4 website on it, and after...

---

<div class="post-metadata">

**Author:** ![evgeni22](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7cd45c/32.png) [@evgeni22](https://www.ruby-forum.com/u/evgeni22)\
**Post date:** [July 7, 2015, 7:04pm UTC](https://www.ruby-forum.com/t/leaking-memory-nginx-1-8-0/242614/6 "2015-07-07T19:04:56Z")

</div>

On Tuesday 07 July 2015 02:25:41 evgeni22 wrote:

> 

Could you provide “nginx -V” output?

wbr, Valentin V. Bartenev

---

<div class="post-metadata">

**Author:** ![evgeni22](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7cd45c/32.png) [@evgeni22](https://www.ruby-forum.com/u/evgeni22)\
**Post date:** [July 7, 2015, 7:19pm UTC](https://www.ruby-forum.com/t/leaking-memory-nginx-1-8-0/242614/7 "2015-07-07T19:19:32Z")

</div>

On Tuesday 07 July 2015 13:12:42 evgeni22 wrote:

> –error-log-path=/var/log/nginx/error\_log --with-ipv6  
> –without-mail\_imap\_module --without-mail\_smtp\_module --with-http\_ssl\_module  
> –with-http\_realip\_module --with-http\_stub\_status\_module  
> –with-http\_gzip\_static\_module --with-http\_dav\_module --with-cc-opt=‘’-D  
> FD\_SETSIZE=32768’’
> 
> i not sure yet but 4 last hours seems leak stoped after i stop  
> security\_mod, can be the security\_mod doing this leaking in nginx ?

[..]

I’m sure it can.

wbr, Valentin V. Bartenev

---

<div class="post-metadata">

**Author:** ![evgeni22](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7cd45c/32.png) [@evgeni22](https://www.ruby-forum.com/u/evgeni22)\
**Post date:** [July 7, 2015, 9:48pm UTC](https://www.ruby-forum.com/t/leaking-memory-nginx-1-8-0/242614/8 "2015-07-07T21:48:30Z")

</div>

Show us the nginx.conf, maybe you’re using some weird large value  
somewhere.

Posted at Nginx Forum:

> **[Re: leaking memory nginx 1.8.0](https://forum.nginx.org/read.php?2,260106,260123#msg-260123)**
>
> Hello, need help with leaking memory i installed fresh system , centos7.1 +directadmin + nginx1.8.0 + mariadb5.5.41 + php54 & php56 both with php\_fpm the server it for webhosting and i have there 32gb for now have only 4 website on it, and after...

---

<div class="post-metadata">

**Author:** ![evgeni22](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7cd45c/32.png) [@evgeni22](https://www.ruby-forum.com/u/evgeni22)\
**Post date:** [July 7, 2015, 9:37pm UTC](https://www.ruby-forum.com/t/leaking-memory-nginx-1-8-0/242614/9 "2015-07-07T21:37:59Z")

</div>

ok need help, it not security\_mod, it begin grow again.  
when server begin activate, i mean users begin upload files or replace  
files  
the memory increase immediately and not going down after they finish.  
now the server ate 12gb of ram, if i do reset to nginx it going down to  
4.5gb ram.

Posted at Nginx Forum:

> **[Re: leaking memory nginx 1.8.0](https://forum.nginx.org/read.php?2,260106,260122#msg-260122)**
>
> Hello, need help with leaking memory i installed fresh system , centos7.1 +directadmin + nginx1.8.0 + mariadb5.5.41 + php54 & php56 both with php\_fpm the server it for webhosting and i have there 32gb for now have only 4 website on it, and after...

---

<div class="post-metadata">

**Author:** ![evgeni22](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7cd45c/32.png) [@evgeni22](https://www.ruby-forum.com/u/evgeni22)\
**Post date:** [July 7, 2015, 11:12pm UTC](https://www.ruby-forum.com/t/leaking-memory-nginx-1-8-0/242614/10 "2015-07-07T23:12:38Z")

</div>

> security\_mod disabled now. but the config is  
> nginx-modsecurity-enable.conf:
> 
> ModSecurityEnabled on;  
> ModSecurityConfig /etc/nginx/nginx-modsecurity.conf;

Did you disable the module just via configuration or did a full vanilla  
nginx recompile, because the module could be still hooking in requests.

Also 2.8.0 seems a bit “oldish” since it’s been released more than a  
year  
ago [Releases · owasp-modsecurity/ModSecurity · GitHub](https://github.com/SpiderLabs/ModSecurity/releases)

Besides there are existing / confirmed memory leaks:

[https://github.com/SpiderLabs/ModSecurity/issues/895](https://github.com/SpiderLabs/ModSecurity/issues/895)

.. and this discussion also might be related:  
[https://github.com/SpiderLabs/ModSecurity/issues/785](https://github.com/SpiderLabs/ModSecurity/issues/785)

rr

---

<div class="post-metadata">

**Author:** ![evgeni22](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7cd45c/32.png) [@evgeni22](https://www.ruby-forum.com/u/evgeni22)\
**Post date:** [July 7, 2015, 10:03pm UTC](https://www.ruby-forum.com/t/leaking-memory-nginx-1-8-0/242614/11 "2015-07-07T22:03:07Z")

</div>

This my hardware server:  
Processor Intel Xeon E3 1225v2  
Cores/Threads 4 cores/ 4 threads  
Frequency 3.2 GHz+  
RAM 32GB DDR3  
Disks 3 x 120 GB SSD

=========================================  
the config is nginx.conf:

#user nginx;

# The number of worker processes is changed automatically by

CustomBuild,  
according to the number of CPU core$  
worker\_processes 4;  
pid /var/run/nginx.pid;  
error\_log /var/logs//nginx/error.log;

#error\_log logs/error.log notice;  
#error\_log logs/error.log info;

events {  
include /etc/nginx/nginx-events.conf;  
}

http {  
include /etc/nginx/mime.types;

# access\_log /var/log/nginx/access.log main;

```
# For user configurations not maintained by DirectAdmin. Empty by

```

default.  
include /etc/nginx/nginx-includes.conf;

```
# Supplemental configuration
include /etc/nginx/nginx-modsecurity-enable.conf;
include /etc/nginx/nginx-defaults.conf;
include /etc/nginx/nginx-gzip.conf;
include /etc/nginx/directadmin-ips.conf;
include /etc/nginx/directadmin-settings.conf;
include /etc/nginx/nginx-vhosts.conf;
include /etc/nginx/directadmin-vhosts.conf;

```

# }

config for nginx-defaults.conf:

default\_type application/octet-stream;  
tcp\_nopush on;  
tcp\_nodelay on;  
sendfile on;

log\_format bytes ‘$bytes\_sent $request\_length’;

keepalive\_timeout 2;  
types\_hash\_max\_size 2048;

disable\_symlinks if\_not\_owner from=$document\_root;

server\_tokens off;

client\_max\_body\_size 1024m;  
client\_body\_timeout 3m;  
client\_body\_buffer\_size 128k;  
client\_header\_timeout 20;  
client\_header\_buffer\_size 3m;  
large\_client\_header\_buffers 4 256k;  
send\_timeout 20;

proxy\_connect\_timeout 600s;  
proxy\_send\_timeout 600s;  
proxy\_read\_timeout 600s;  
proxy\_buffer\_size 128k;  
proxy\_buffers 4 256k;  
proxy\_busy\_buffers\_size 256k;

fastcgi\_send\_timeout 600s;  
fastcgi\_read\_timeout 600s;

server\_names\_hash\_bucket\_size 128;  
server\_names\_hash\_max\_size 10240;

ssl\_dhparam /etc/nginx/ssl.crt/dhparams.pem;

## Anti ddos

limit\_conn\_zone $binary\_remote\_addr zone=conn\_limit\_per\_ip:10m;  
limit\_req\_zone $binary\_remote\_addr zone=req\_limit\_per\_ip:10m rate=5r/s;

================================  
config for nginx-gzip.conf

gzip on;  
gzip\_static on;  
gzip\_disable “msie6”;  
gzip\_http\_version 1.1;  
gzip\_vary on;  
gzip\_comp\_level 6;  
gzip\_proxied any;  
gzip\_types text/plain text/css application/json application/x-javascript  
text/xml application/xml application$  
gzip\_buffers 16 8k;  
gzip\_min\_length 10;  
gzip\_disable “MSIE [1-6].(?!.\*SV1)”;

===================================  
config for nginx/directadmin-ips.conf:

server {  
listen xx.xx.xx.xx:80 default\_server; // i hide the ip  
server\_name \_;  
root /home/admin/domains/sharedip;  
index index.html index.htm index.php;

```
    include /usr/local/directadmin/data/users/admin/nginx_php.conf;

    # deny access to apache .htaccess files
    location ~ /\.ht
    {
            deny all;
    }

    include /etc/nginx/webapps.conf;

```

}

server {  
listen xx.xx.xx.xx:443 default\_server; // i hide the ip  
server\_name \_;

```
    ssl on;
    ssl_certificate /etc/nginx/ssl.crt/server.crt.combined;
    ssl_certificate_key /etc/nginx/ssl.key/server.key;

    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 5m;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers on;

    root /home/admin/domains/sharedip;
    index index.html index.htm index.php;

    include /usr/local/directadmin/data/users/admin/nginx_php.conf;

    # deny access to apache .htaccess files
    location ~ /\.ht
    {
            deny all;
    }

    include /etc/nginx/webapps.conf;

```

}

===========================  
config for directadmin-settings.conf:

empty

===========================  
config for nginx-vhosts.conf

```
server {
    listen xx.xx.xx.x:80; // i hide the ip
    listen 127.0.0.1:80;
    #listen [::1]:80;
    server_name $hostname xx.xx.xx.xx; / i hide the ip

    root /var/www/html;
    index index.html index.htm index.php;

    #Support UserDir (~/user/)
    location ~^/~(?<userdir_user>.+?)(?<userdir_uri>/.*)?$ {
            alias /home/$userdir_user/public_html$userdir_uri;
            index index.html index.htm index.php;
            autoindex on;

            location ~ \.php$ {
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                include /etc/nginx/fastcgi_params;
                fastcgi_index index.php;

                #try_files does not work after alias directive
                if (!-f $request_filename) {
                    return 404;
                }

                fastcgi_param DOCUMENT_ROOT

```

/home/$userdir\_user/public\_html;  
fastcgi\_param SCRIPT\_FILENAME $request\_filename;  
fastcgi\_pass  
unix:/usr/local/php54/sockets/$userdir\_user.sock;  
}  
}

```
    # Pass all .php files onto a php-fpm/php-fcgi server.
    location ~ \.php$ {
            try_files $uri =404;

            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            include /etc/nginx/fastcgi_params;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME

```

$document\_root$fastcgi\_script\_name;  
fastcgi\_pass unix:/usr/local/php54/sockets/webapps.sock;  
}

```
    include /etc/nginx/nginx-info.conf;
    include /etc/nginx/webapps.conf;
}

```

# HTTPS server

```
#
server {
    listen xx.xx.xx.xx:443 ssl; / i hide the ip
    listen 127.0.0.1:443 ssl;
    #listen [::1]:443 ssl;
    server_name $hostname xx.xx.xx.xx; / i hide the ip

    ssl on;
    ssl_certificate /etc/nginx/ssl.crt/server.crt.combined;
    ssl_certificate_key /etc/nginx/ssl.key/server.key;

    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 10m;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers on;

    root /var/www/html;
    index index.html index.htm index.php;

    #Support UserDir (~/user/)
    location ~^/~(?<userdir_user>.+?)(?<userdir_uri>/.*)?$ {
            alias /home/$userdir_user/private_html$userdir_uri;
            index index.html index.htm index.php;
            autoindex on;

            location ~ \.php$ {
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                include /etc/nginx/fastcgi_params;
                fastcgi_index index.php;

                #try_files does not work after alias directive
                if (!-f $request_filename) {
                    return 404;
                }

                fastcgi_param DOCUMENT_ROOT

```

/home/$userdir\_user/private\_html;  
fastcgi\_param SCRIPT\_FILENAME $request\_filename;  
fastcgi\_pass  
unix:/usr/local/php54/sockets/$userdir\_user.sock;  
}  
}

```
    # Pass all .php files onto a php-fpm/php-fcgi server.
    location ~ \.php$ {
            try_files $uri =404;

            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            include /etc/nginx/fastcgi_params;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME

```

$document\_root$fastcgi\_script\_name;  
fastcgi\_pass unix:/usr/local/php54/sockets/webapps.sock;  
}

```
    include /etc/nginx/nginx-info.conf;
    include /etc/nginx/webapps.ssl.conf;
}

```

====================================  
config for directadmin-vhosts.conf:

for individual clients i think not matter it empty there.

=================================  
config for: nginx/nginx-info.conf

location /nginx\_status {  
# Enable nginx status page  
stub\_status on;

```
# Disable status page logging in access_log
access_log off;

# Allow access from 127.0.0.1
allow 127.0.0.1;

# Deny all the other connections
deny all;

```

# }

security\_mod disabled now. but the config is  
nginx-modsecurity-enable.conf:

ModSecurityEnabled on;  
ModSecurityConfig /etc/nginx/nginx-modsecurity.conf;

============================

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,260106,260124#msg-260124](http://forum.nginx.org/read.php?2,260106,260124#msg-260124)

---

<div class="post-metadata">

**Author:** ![evgeni22](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7cd45c/32.png) [@evgeni22](https://www.ruby-forum.com/u/evgeni22)\
**Post date:** [July 7, 2015, 11:21pm UTC](https://www.ruby-forum.com/t/leaking-memory-nginx-1-8-0/242614/12 "2015-07-07T23:21:24Z")

</div>

> nginx recompile, because the module could be still hooking in requests.

Did read a bit further in the thread and could even confirm this:

“ModSecurity using resources even if it is disabled”  
[https://github.com/SpiderLabs/ModSecurity/issues/644](https://github.com/SpiderLabs/ModSecurity/issues/644)

which leads to “nginx: Returning 500 if SecRuleEngine is set to Off”  
[https://github.com/SpiderLabs/ModSecurity/issues/645](https://github.com/SpiderLabs/ModSecurity/issues/645)

which is kind of fixed in

> <https://github.com/owasp-modsecurity/ModSecurity/commit/fe14d9df4d590e348a8ee232e4b318fc5e5a87f8>
>
> For some reason the state of modsec (enable, disable or detecting only) was not
> …being checked under certain circumstances. For instance, while reading the
> body. This was leading ModSecurity to fail and consequently nginx. This patch
> added the to standalone implementation mechanism to verify the state that is now
> verified under the nginx module.

tagged as 2.9.0-rc2 so way after the version you use.

rr

---

<div class="post-metadata">

**Author:** ![evgeni22](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7cd45c/32.png) [@evgeni22](https://www.ruby-forum.com/u/evgeni22)\
**Post date:** [July 8, 2015, 8:22am UTC](https://www.ruby-forum.com/t/leaking-memory-nginx-1-8-0/242614/13 "2015-07-08T08:22:56Z")

</div>

“nginx recompile, because the module could be still hooking in  
requests.”

security\_mod disabled it not tracker after any domains on the server it  
cant  
hooking requersts if it not tracking after domains  
becuse memory leaking only when clients do traffic with domains.

i for sure now it not security\_mod problem and about version i use  
mod\_security it last one  
Current rules version 1.11 (Latest version)  
CWAF plugin version 2.11 (Latest version)

i thinking of php-fpm problems with nginx, i google a little and saw  
people  
complain about leaking in nginx who have php-fpm

Posted at Nginx Forum:

> **[Re: leaking memory nginx 1.8.0](https://forum.nginx.org/read.php?2,260106,260130#msg-260130)**
>
> Hello, need help with leaking memory i installed fresh system , centos7.1 +directadmin + nginx1.8.0 + mariadb5.5.41 + php54 & php56 both with php\_fpm the server it for webhosting and i have there 32gb for now have only 4 website on it, and after...

---

<div class="post-metadata">

**Author:** ![evgeni22](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7cd45c/32.png) [@evgeni22](https://www.ruby-forum.com/u/evgeni22)\
**Post date:** [July 8, 2015, 8:57am UTC](https://www.ruby-forum.com/t/leaking-memory-nginx-1-8-0/242614/14 "2015-07-08T08:57:59Z")

</div>

wondering if it good config in php-fpm

pm = ondemand  
pm.max\_children = 10  
pm.process\_idle\_timeout = 60  
pm.max\_requests = 1000

?

Posted at Nginx Forum:

> **[Re: leaking memory nginx 1.8.0](https://forum.nginx.org/read.php?2,260106,260131#msg-260131)**
>
> Hello, need help with leaking memory i installed fresh system , centos7.1 +directadmin + nginx1.8.0 + mariadb5.5.41 + php54 & php56 both with php\_fpm the server it for webhosting and i have there 32gb for now have only 4 website on it, and after...

---

<div class="post-metadata">

**Author:** ![evgeni22](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7cd45c/32.png) [@evgeni22](https://www.ruby-forum.com/u/evgeni22)\
**Post date:** [July 8, 2015, 2:47pm UTC](https://www.ruby-forum.com/t/leaking-memory-nginx-1-8-0/242614/15 "2015-07-08T14:47:19Z")

</div>

> i only not understand why pm = ondemand doing the leaking, does algorithem  
> in nginx not stable or it php issue ?

It contradicts your previous mails about nginx processes being the leak  
point.

php(-fpm) and nginx are separate pieces of software (just communicating  
via  
fastcgi protocol) so if the php leaks memory it’s a problem on php side  
(is  
also very valid considering that not all of the (third-party) php  
extensions  
are memory-friendly).

rr

---

<div class="post-metadata">

**Author:** ![evgeni22](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7cd45c/32.png) [@evgeni22](https://www.ruby-forum.com/u/evgeni22)\
**Post date:** [July 8, 2015, 9:45am UTC](https://www.ruby-forum.com/t/leaking-memory-nginx-1-8-0/242614/16 "2015-07-08T09:45:18Z")

</div>

ok the leaking fixed , i will past here for database for other users:

that was in my php-fpm.conf

pm = ondemand  
pm.max\_children = 10  
pm.process\_idle\_timeout = 60  
pm.max\_requests = 1000

=============================  
after i change it to this conf the leaking stoped.

pm = dynamic  
pm.max\_children = 10  
pm.start\_servers = 5  
pm.min\_spare\_servers = 5  
pm.max\_spare\_servers = 10  
pm.max\_requests = 500

i only not understand why pm = ondemand doing the leaking, does  
algorithem  
in nginx not stable or it php issue ?

Posted at Nginx Forum:

> **[Re: leaking memory nginx 1.8.0](https://forum.nginx.org/read.php?2,260106,260132#msg-260132)**
>
> Hello, need help with leaking memory i installed fresh system , centos7.1 +directadmin + nginx1.8.0 + mariadb5.5.41 + php54 & php56 both with php\_fpm the server it for webhosting and i have there 32gb for now have only 4 website on it, and after...

---

<div class="post-metadata">

**Author:** ![evgeni22](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7cd45c/32.png) [@evgeni22](https://www.ruby-forum.com/u/evgeni22)\
**Post date:** [July 8, 2015, 4:34pm UTC](https://www.ruby-forum.com/t/leaking-memory-nginx-1-8-0/242614/17 "2015-07-08T16:34:14Z")

</div>

Hi,  
On 07/08/2015 09:44 AM, evgeni22 wrote:

> after i change it to this conf the leaking stoped.
> 
> pm = dynamic  
> pm.max\_children = 10  
> pm.start\_servers = 5  
> pm.min\_spare\_servers = 5  
> pm.max\_spare\_servers = 10  
> pm.max\_requests = 500  
> Very probably that last setting helped you, from the documentation:

pm.max\_requests int  
The number of requests each child process should execute before  
respawning. This can be useful to work around memory leaks in 3rd party  
libraries. For endless request processing specify ‘0’. Equivalent to  
PHP\_FCGI\_MAX\_REQUESTS. Default value: 0.

IMHO It’s a bandaid, but works.
