nginx & php-fpm [debug] 11: Resource temporarily unavailable

blackbic nginx-forum at nginx.us
Sat Dec 13 16:57:53 UTC 2014


I am having troubles with a wordpress plugin running a full batch of
imports. I get this error when I enable the nginx debug. The result is I get
an immediate 404 error afterwards and I am unable to fully import my data. 

I am pretty sure this is a bug, but I can't find the right answer to fix
it.

Please Help.

**What I have done so far:**

 - It looked like a nginx bug and my nginx version was old, so I upgraded.
No change.
 - It looked and still looks like it could be related to php-fpm. I've
upgraded. No change.
 - I've disabled all of my plugins. No Change.

**Server**
     
 - CentOS 6.0
 - nginx v 1.0.15
 - PHP-FPM v 5.3.3 (fpm-fcgi)
 - Webserver running 3 very low traffic sites
 - PHP-FPM is set to ondemmand


**PHP.ini config:**

 - pm = ondemand
 - pm.process_idle_timeout = 50s
 - pm.max_children = 20
 - pm.start_servers = 1
 - pm.min_spare_servers = 3
 - pm.max_spare_servers = 5
 - pm.max_requests = 1024
 - pm.status_path = /status



I am unable to post my logs, so please check out the comparison 

**Nginx Log:**

    [12-Dec-2014 06:35:49.398315] DEBUG: pid 13384,
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool www] currently 0
active children, 1 spare children
    [12-Dec-2014 06:35:50.399474] DEBUG: pid 13384,
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool www] currently 0
active children, 1 spare children
    [12-Dec-2014 06:35:51.400765] DEBUG: pid 13384,
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool www] currently 0
active children, 1 spare children
    [12-Dec-2014 06:35:52.402053] DEBUG: pid 13384,
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool www] currently 0
active children, 1 spare children
    [12-Dec-2014 06:35:53.403346] DEBUG: pid 13384,
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool www] currently 0
active children, 1 spare children
    [12-Dec-2014 06:35:53.417762] DEBUG: pid 13384, fpm_got_signal(), line
72: received SIGCHLD
    [12-Dec-2014 06:35:53.417836] DEBUG: pid 13384, fpm_children_bury(),
line 254: [pool www] child 18327 has been killed by the process managment
after 52.123053 seconds from start
    [12-Dec-2014 06:35:53.417863] DEBUG: pid 13384, fpm_event_loop(), line
411: event module triggered 1 events
    [12-Dec-2014 06:35:54.404978] DEBUG: pid 13384,
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool www] currently 0
active children, 0 spare children
    [12-Dec-2014 06:35:54.687559] DEBUG: pid 13384, fpm_children_make(),
line 421: [pool www] child 18397 started

 


    [12-Dec-2014 06:35:54.687593] DEBUG: pid 13384,
fpm_pctl_on_socket_accept(), line 536: [pool www] got accept without idle
child available .... I forked
    [12-Dec-2014 06:35:54.687602] DEBUG: pid 13384, fpm_event_loop(), line
411: event module triggered 1 events

 


    [12-Dec-2014 06:35:55.406455] DEBUG: pid 13384,
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool www] currently 0
active children, 1 spare children
    [12-Dec-2014 06:35:56.407633] DEBUG: pid 13384,
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool www] currently 0
active children, 1 spare children
    [12-Dec-2014 06:35:57.408949] DEBUG: pid 13384,
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool www] currently 0
active children, 1 spare children
    [12-Dec-2014 06:35:58.410111] DEBUG: pid 13384,
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool www] currently 0
active children, 1 spare children

 

**PHP log:**

    2014/12/12 06:35:02 [debug] 13350#0: *223 http header done
    2014/12/12 06:35:54 [debug] 13350#0: accept on 0.0.0.0:80, ready: 1
    2014/12/12 06:35:54 [debug] 13350#0: posix_memalign:
0000000002273A80:256 @16
    2014/12/12 06:35:54 [debug] 13350#0: *226 accept: 66.249.67.123 fd:3
    2014/12/12 06:35:54 [debug] 13350#0: *226 event timer add: 3:
60000:1418387814684
    2014/12/12 06:35:54 [debug] 13350#0: *226 epoll add event: fd:3 op:1
ev:80000001
    2014/12/12 06:35:54 [debug] 13350#0: accept() not ready (11: Resource
temporarily unavailable)
    2014/12/12 06:35:54 [debug] 13350#0: *226 malloc: 0000000002274AF0:1296
    2014/12/12 06:35:54 [debug] 13350#0: *226 posix_memalign:
0000000002273BE0:256 @16
    2014/12/12 06:35:54 [debug] 13350#0: *226 malloc:
000000000232F4B0:131072
    2014/12/12 06:35:54 [debug] 13350#0: *226 posix_memalign:
00000000021F7590:4096 @16
    2014/12/12 06:35:54 [debug] 13350#0: *226 http process request line
    2014/12/12 06:35:54 [debug] 13350#0: *226 recv: fd:3 315 of 131072
    2014/12/12 06:35:54 [debug] 13350#0: *226 http request line: "GET
/stores/giltcity/page/78/ HTTP/1.1"
    2014/12/12 06:35:54 [debug] 13350#0: *226 http uri:
"/stores/giltcity/page/78/"
    2014/12/12 06:35:54 [debug] 13350#0: *226 http args: ""
    2014/12/12 06:35:54 [debug] 13350#0: *226 http exten: ""
    2014/12/12 06:35:54 [debug] 13350#0: *226 http process request header
line
    2014/12/12 06:35:54 [debug] 13350#0: *226 http header: "Host:
mydiscountman.com"
    2014/12/12 06:35:54 [debug] 13350#0: *226 http header: "Connection:
Keep-alive"
    2014/12/12 06:35:54 [debug] 13350#0: *226 http header: "Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
    2014/12/12 06:35:54 [debug] 13350#0: *226 http header: "From:
googlebot(at)googlebot.com"
    2014/12/12 06:35:54 [debug] 13350#0: *226 http header: "Accept-Encoding:
gzip,deflate"
    2014/12/12 06:35:54 [debug] 13350#0: *226 http header: "User-Agent:
Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
    2014/12/12 06:35:54 [debug] 13350#0: *226 http header done
    2014/12/12 06:37:11 [debug] 13350#0: accept on 0.0.0.0:80, ready: 1


**Nginx Global Config /etc/nginx/nginx.conf :**

    user apache;
    worker_processes 1;
    pid /var/run/nginx.pid;


    events {
    worker_connections 768;
    multi_accept on;
    use epoll;
    }

    http {

    # Let NGINX get the real client IP for its access logs
    set_real_ip_from 127.0.0.1;
    real_ip_header X-Forwarded-For;

    # Basic Settings
    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 20;
    client_max_body_size 15m;
    client_body_timeout 60;
    client_header_timeout 60;
    client_body_buffer_size  128k;
    client_header_buffer_size 128k;
    large_client_header_buffers 4 16k;
    send_timeout 60;
    reset_timedout_connection on;
    types_hash_max_size 8192;
    server_tokens off;
    
    # server_names_hash_bucket_size 64;
    # server_name_in_redirect off;
 
    include /etc/nginx/mime.types;
    default_type application/octet-stream;
 
    # Logging Settings
    # access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log debug;

    # Log Format
    log_format main '$remote_addr - $remote_user [$time_local] '
    '"$request" $status $body_bytes_sent "$http_referer" '
    '"$http_user_agent" "$http_x_forwarded_for"';

    # Gzip Settings
    gzip on;
    gzip_static on;
    gzip_disable "msie6";
    gzip_vary on;
    gzip_proxied any;
    gzip_comp_level 6;
    gzip_min_length 512;
    gzip_buffers 16 8k;
    gzip_http_version 1.1;
    gzip_types text/css text/javascript text/xml text/plain text/x-component

    application/javascript application/x-javascript application/json 
    application/xml  application/rss+xml font/truetype
application/x-font-ttf 
    font/opentype application/vnd.ms-fontobject image/svg+xml;

    # Virtual Host Configs
    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
    }




**Nginx Site Config /etc/nginx/sites-available/testme  :**

    server {
    listen       80;
    server_name  testme.XXXXXXX.com;

    port_in_redirect off;
    server_tokens off;
    autoindex off;

    client_max_body_size 15m;
    client_body_buffer_size 128k;

    access_log  /var/log/nginx/testme/access_log  main;
    error_log   /var/log/nginx/testme/error_log;

    root /var/www/testme;
    index index.php  index.html index.htm;
    try_files $uri $uri/ /index.php;

    error_page  404              /404error.html;
    location = /var/www/testme/404error.html {
        internal;
    }

    error_page  500              /500error.html;
    location = /var/www/testme/500error.html {
        internal;
    }

    # Define default caching of 24h
    expires 8s;
    add_header Pragma public;
    add_header Cache-Control "max-age=86400, public, must-revalidate,
proxy-revalidate";

    # Redirect server error pages to static 50x.html
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    # Don't log robots.txt requests
    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }

    location /phpmyadmin {
	auth_basic            "Restricted";
	auth_basic_user_file  /var/www/testme/phpmyadmin/.htpasswd;
	try_files $uri $uri/ index.html index.php;
	index index.html index.htm index.php;
	location ~ /\.ht {
	    deny  all;
	}
	location ~* ^.+\.(css|js)$ {
	    #try_files $uri $uri/;
	    #root /var/www/testme/phpmyadmin;
	    access_log off;
	}
	location ~ ^.+\.php {
	    try_files $uri $uri/ *.php;
	    fastcgi_split_path_info ^(.+.php)(.*)$;
	    fastcgi_pass unix:/var/run/php-fpm.socket;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME
/var/www/testme$fastcgi_script_name;
            fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
            include /etc/nginx/fastcgi_params;
            fastcgi_intercept_errors on;
            fastcgi_ignore_client_abort off;
            fastcgi_connect_timeout 60;
            fastcgi_send_timeout 180;
            fastcgi_read_timeout 180;
            fastcgi_buffer_size 128k;
            fastcgi_buffers 4 256k;
            fastcgi_busy_buffers_size 256k;
            fastcgi_temp_file_write_size 256k;

	}
    }

    # Rewrite for versioned CSS+JS via filemtime
    #    location ~* ^.+\.(css|js) {
    #        rewrite ^(.+)\.(\d+)\.(css|js)$ $1.$3 last;
    #        expires 31536000s;
    #        access_log on;
    #        log_not_found on;
    #        add_header Pragma public;
    #        add_header Cache-Control "max-age=31536000, public";
    #    }

    # Aggressive caching for static files
    # If you alter static files often, please use 
    # add_header Cache-Control "max-age=31536000, public, must-revalidate,
proxy-revalidate";
    location ~* \.   
(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|odb|odc|odf|odg|odp|ods|odt|ogg|ogv|otf|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|t?gz|tif|tiff|ttf|wav|webm|wma|woff|wri|xla|xls|xlsx|xlt|xlw|zip)$
{
        expires 31536000s;
        access_log on;
        log_not_found on;
        add_header Pragma public;
        add_header Cache-Control "max-age=31536000, public";
    }
    

    location ~* (^(?!(?:(?!(php|inc)).)*/uploads/).*?(php)) {
	set $php_root   $document_root;
	    if ($request_uri ~* /phpmyadmin) {
		#set $php_root /usr/share;
	    }
    
        try_files $uri = 404;
        fastcgi_split_path_info ^(.+.php)(.*)$;
        fastcgi_pass unix:/var/run/php-fpm.socket;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $php_root$fastcgi_script_name;
        fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
        include /etc/nginx/fastcgi_params;
        fastcgi_intercept_errors on;
        fastcgi_ignore_client_abort off;
        fastcgi_connect_timeout 3600;
        fastcgi_send_timeout 3600;
        fastcgi_read_timeout 3600;
        fastcgi_buffer_size 128k;
        fastcgi_buffers 4 256k;
        fastcgi_busy_buffers_size 256k;
        fastcgi_temp_file_write_size 256k;
      }
    
    }

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,255476,255476#msg-255476



More information about the nginx mailing list