nginx makes mysqld die all the time

oscaretu . oscaretu at gmail.com
Wed Aug 19 07:01:13 UTC 2015


Hello.

Perhaphs this can help you about the out of memory: OOM Killer:

https://www.google.com/search?client=ubuntu&channel=fs&q=OOM+Kiler&ie=utf-8&oe=utf-8

Kind regards,

Oscar


On Wed, Aug 19, 2015 at 8:02 AM, M. Fioretti <mfioretti at nexaima.net> wrote:

> On 2015-08-18 14:36, Steve Wilson wrote:
>
>> Hi,
>>
>> When I migrated from apache+mod_php to nginx+php-fpm I found I had a
>> few websites using persistent mysql connections which never closed.
>>
>
> Steve, thanks for this tip. This surely was part of the problem, but
> not all of it.
>
> Sure enough, when I first noticed this problem, I also found in dmesg
> messages like this:
>
> Out of memory: kill process 31066 (mysqld) score 30155 or a child
> Killed process 31066 (mysqld)
>
> yesterday, as soon as I was able to ssh again, I turned
>
> mysql.allow_persistent = Off in php.ini (it was On)
>
> and restarted everything. Page load time decreased noticeably AND there
> where no more mysql crashes for the rest of the day.
> This morning, however, I found mysql died again with the same symptom
> (dead but subsystem locked) and a DIFFERENT message in dmesg, that I
> had never seen before:
>
> Out of memory: kill process 13812 (php-fpm) score 18223 or a child
> Killed process 13812 (php-fpm)
>
> the nginx and php-fpm configuration files are pasted below (I have several
> virtual
> hosts all configured that way for wordpress, plus one drupal and one
> semantic scuttle
> site, if it matters). What next? Any help is welcome!
>
> Marco
>
> [root at fima ~]# more /etc/nginx/nginx.conf
>
> user              nginx;
> worker_processes  1;
>
> error_log  /var/log/nginx/error.log;
> #error_log  /var/log/nginx/error.log  notice;
> #error_log  /var/log/nginx/error.log  info;
>
> pid        /var/run/nginx.pid;
>
>
> events {
>     worker_connections  1024;
> }
>
> http {
>     include       /etc/nginx/mime.types;
>     default_type  application/octet-stream;
>
>     server_names_hash_bucket_size  64;
>     server_tokens off;
>     access_log  /var/log/nginx/access.log combined  buffer=32k;
>     log_format    '$remote_addr - $remote_user [$time_local] $status '
>                       '"$request" $body_bytes_sent "$http_referer" '
>                       '"$http_user_agent" "$http_x_forwarded_for"';
>
>     sendfile        on;
>     #tcp_nopush     on;
>
>     #keepalive_timeout  0;
>     keepalive_timeout  65;
>
>     #gzip  on;
>
>     # Load config files from the /etc/nginx/conf.d directory
>     # The default server is in conf.d/default.conf
>     include /etc/nginx/conf.d/*.conf;
>
> }
>
> and this is configuration for one of the wordpress sites, I only changed
> the domain name. The configuration is due to the fact that, for several
> reasons out of my control, I **must** run two fully independent wordpress
> installations, but "nested" into each other, that is:
>
> myblog.example.com/   (english blog, by wordpress installed in
> $documentroot/myblog)
> myblog.example.com/it (italian version, by separate wordpress installed
> in $documentroot/myblog_it)
>
> the above worked fine with apache. Can the equivalent config for
> nginx be related to the problem I'm seeing? If yes, how, and how to
> fix it? And while we are at this: advice on anything else I could optimize
> is
> also very welcome of course, even if not related to the main problem.
>
>
> [root at fima ~]# more /etc/nginx/conf.d/stop.conf
>
> server {
>        listen       80;
>        server_name  myblog.example.com;
>        root         /var/www/html/wordpress/;
>        include      /etc/nginx/default.d/*.conf;
>
>        # configuration for the italian version, installed
>        # in root/myblog_it, but having as url example.com/stop/it
>
>        location ^~ /it/ {
>                 rewrite ^/it/(.+) /myblog_it/$1 ;
>                 index             /myblog_it/index.php;
>        }
>
>        location /myblog_it/ {
>                 try_files $uri $uri/ /myblog_it/index.php?args;
>                 index index.php;
>                 location ~ \.php$ {
>                          fastcgi_pass unix:/tmp/phpfpm.sock;
>                          fastcgi_index  index.php;
>                          fastcgi_param  SCRIPT_FILENAME
> $document_root$fastcgi_script_name;
>                          include        fastcgi_params;
>                          }
>                 }
>
> ##################################################################
> # main blog
>
>         location ^~ / {
>                  rewrite ^/(.+) /myblog/$1 ;
>                  index          /myblog/index.php;
>                  }
>
>         location /myblog/ {
>                  try_files /$uri /$uri/ /myblog/index.php?args;
>                  index                        index.php;
>                  }
>
>         location ~ \.php$ {
>                  fastcgi_pass unix:/tmp/phpfpm.sock;
>                  fastcgi_index  index.php;
>                  fastcgi_param  SCRIPT_FILENAME
> $document_root/$fastcgi_script_name;
>                  include        fastcgi_params;
>                 }
> }
>
>
> php-fpm configuration:
>
> [root ~]# grep -v '^;' /etc/php-fpm.conf | uniq
>
> include=/etc/php-fpm.d/*.conf
>
> [global]
> pid = /var/run/php-fpm/php-fpm.pid
>
> error_log = /var/log/php-fpm/error.log
>
> daemonize = no
>
> emergency_restart_threshold = 10
> emergency_restart_interval = 1m
> process_control_timeout = 10s
>
> AND ALSO:
>
> [root ~]# grep -v '^;' /etc/php-fpm.d/www.conf | uniq
> [www]
>
>
> listen.allowed_clients = 127.0.0.1
>
> listen = /tmp/phpfpm.sock
> listen.owner = nginx
> listen.group = nginx
> user = nginx
> group = nginx
>
> pm = dynamic
>
> pm.max_children = 50
>
> pm.start_servers = 5
>
> pm.min_spare_servers = 5
>
> pm.max_spare_servers = 35
>
>
>
>
>
> slowlog = /var/log/php-fpm/www-slow.log
>
>
> php_admin_value[error_log] = /var/log/php-fpm/www-error.log
> php_admin_flag[log_errors] = on
>
> php_value[session.save_handler] = files
> php_value[session.save_path] = /var/lib/php/session
>
>
>
>
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>



-- 
Oscar Fernandez Sierra
oscaretu at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20150819/b482d424/attachment.html>


More information about the nginx mailing list