Проблемы с зависанием соединения при аплоаде и его рестартом

ilya на aniskovets.com ilya на aniskovets.com
Ср Дек 8 22:38:11 MSK 2010


Добрый день,

помогите пожалуйста разобраться.

При аплоаде файла, особенно большого, периодически происходит зависание
соединения, с последующим таймаутом.

В логах происходит что-то странное, сначала начинает загружаться
(уменьшается body rest) потом резко останавливается (появляется пауза секунд
на 20) и начинает лить заново. Все это происходит при одном и том же нажатии
на кнопку upload. Пробовал использовать fastcgi socket и fastcgi tcp
результат один:

2010/12/08 22:20:44 [debug] 30449#0: *3928 http client request body recv
1392
2010/12/08 22:20:44 [debug] 30449#0: *3928 http client request body rest
59245073
2010/12/08 22:20:44 [debug] 30449#0: *3928 event timer: 122, old:
1291836223839, new: 1291836224093
2010/12/08 22:20:44 [debug] 30449#0: *3928 post event 000000080179E8C0
2010/12/08 22:20:44 [debug] 30449#0: *3928 delete posted event
000000080179E8C0
2010/12/08 22:20:44 [debug] 30449#0: *3928 http run request:
"/posting.php?mode=edit&f=42&sid=85763714b494e5e6fe434f8cde16842b&t=547&p=2557"
2010/12/08 22:20:44 [debug] 30449#0: *3928 http read client request body
2010/12/08 22:20:44 [debug] 30449#0: *3928 recv: eof:0, avail:1360, err:0
2010/12/08 22:20:44 [debug] 30449#0: *3928 recv: fd:122 810 of 810
2010/12/08 22:20:44 [debug] 30449#0: *3928 http client request body recv 810
2010/12/08 22:20:44 [debug] 30449#0: *3928 write: 109, 000000080138A000,
8192, 20799488
2010/12/08 22:20:44 [debug] 30449#0: *3928 recv: eof:0, avail:550, err:0
2010/12/08 22:20:44 [debug] 30449#0: *3928 recv: fd:122 550 of 8192
2010/12/08 22:20:44 [debug] 30449#0: *3928 http client request body recv 550
2010/12/08 22:20:44 [debug] 30449#0: *3928 http client request body rest
59243713
2010/12/08 22:20:44 [debug] 30449#0: *3928 event timer: 122, old:
1291836223839, new: 1291836224094

тут появляется пауза и браузер начинает лить сначала (дергается строчка
статуса в строке браузера):

2010/12/08 22:21:03 [debug] 30449#0: *4009 event timer del: 102:
1291836243005
2010/12/08 22:21:03 [debug] 30449#0: *4009 generic phase: 0
2010/12/08 22:21:03 [debug] 30449#0: *4009 rewrite phase: 1
2010/12/08 22:21:03 [debug] 30449#0: *4009 test location: "/"
2010/12/08 22:21:03 [debug] 30449#0: *4009 test location: "store"
2010/12/08 22:21:03 [debug] 30449#0: *4009 test location: "cache"
2010/12/08 22:21:03 [debug] 30449#0: *4009 test location: ~ "/\.htaccess$"
2010/12/08 22:21:03 [debug] 30449#0: *4009 test location: ~ "\.php$"
2010/12/08 22:21:03 [debug] 30449#0: *4009 using configuration "\.php$"
2010/12/08 22:21:03 [debug] 30449#0: *4009 http cl:80051943 max:104857600
2010/12/08 22:21:03 [debug] 30449#0: *4009 rewrite phase: 3
2010/12/08 22:21:03 [debug] 30449#0: *4009 post rewrite phase: 4
2010/12/08 22:21:03 [debug] 30449#0: *4009 generic phase: 5
2010/12/08 22:21:03 [debug] 30449#0: *4009 generic phase: 6
2010/12/08 22:21:03 [debug] 30449#0: *4009 generic phase: 7
2010/12/08 22:21:03 [debug] 30449#0: *4009 access phase: 8
2010/12/08 22:21:03 [debug] 30449#0: *4009 access phase: 9
2010/12/08 22:21:03 [debug] 30449#0: *4009 post access phase: 10
2010/12/08 22:21:03 [debug] 30449#0: *4009 try files phase: 11
2010/12/08 22:21:03 [debug] 30449#0: *4009 http script var: "/posting.php"
2010/12/08 22:21:03 [debug] 30449#0: *4009 try to use file: "/posting.php"
"/www/e3forum/htdocs/posting.php"
2010/12/08 22:21:03 [debug] 30449#0: *4009 try file uri: "/posting.php"
2010/12/08 22:21:03 [debug] 30449#0: *4009 posix_memalign:
00000008014FE000:4096 @16
2010/12/08 22:21:03 [debug] 30449#0: *4009 malloc: 0000000801768000:8192
2010/12/08 22:21:03 [debug] 30449#0: *4009 http read client request body
2010/12/08 22:21:03 [debug] 30449#0: *4009 recv: eof:0, avail:0, err:0
2010/12/08 22:21:03 [debug] 30449#0: *4009 http client request body recv -2
2010/12/08 22:21:03 [debug] 30449#0: *4009 http client request body rest
80051943
2010/12/08 22:21:03 [debug] 30449#0: *4009 event timer add: 102:
180000:1291836243005
2010/12/08 22:21:03 [debug] 30449#0: *4009 http finalize request: -4,
"/posting.php?mode=edit&f=42&sid=85763714b494e5e6fe434f8cde16842b&t=547&p=2557"
a:1, c:2
2010/12/08 22:21:03 [debug] 30449#0: *4009 http request count:2 blk:0
2010/12/08 22:21:03 [debug] 30449#0: *4009 post event 000000080179E700
2010/12/08 22:21:03 [debug] 30449#0: *4009 delete posted event
000000080179E700
2010/12/08 22:21:03 [debug] 30449#0: *4009 http run request:
"/posting.php?mode=edit&f=42&sid=85763714b494e5e6fe434f8cde16842b&t=547&p=2557"
2010/12/08 22:21:03 [debug] 30449#0: *4009 http read client request body
2010/12/08 22:21:03 [debug] 30449#0: *4009 recv: eof:0, avail:1360, err:0
2010/12/08 22:21:03 [debug] 30449#0: *4009 recv: fd:102 1360 of 8192
2010/12/08 22:21:03 [debug] 30449#0: *4009 http client request body recv
1360
2010/12/08 22:21:03 [debug] 30449#0: *4009 http client request body rest
80050583
2010/12/08 22:21:03 [debug] 30449#0: *4009 event timer: 102, old:
1291836243005, new: 1291836243005
2010/12/08 22:21:03 [debug] 30449#0: *4009 post event 000000080179E700
2010/12/08 22:21:03 [debug] 30449#0: *4009 delete posted event
000000080179E700
2010/12/08 22:21:03 [debug] 30449#0: *4009 http run request:
"/posting.php?mode=edit&f=42&sid=85763714b494e5e6fe434f8cde16842b&t=547&p=2557"
2010/12/08 22:21:03 [debug] 30449#0: *4009 http read client request body
2010/12/08 22:21:03 [debug] 30449#0: *4009 recv: eof:0, avail:1360, err:0
2010/12/08 22:21:03 [debug] 30449#0: *4009 recv: fd:102 1360 of 6832
2010/12/08 22:21:03 [debug] 30449#0: *4009 http client request body recv
1360
2010/12/08 22:21:03 [debug] 30449#0: *4009 http client request body rest
80049223
2010/12/08 22:21:03 [debug] 30449#0: *4009 event timer: 102, old:
1291836243005, new:

тут браузер просто вылетает по таймауту.

lw# nginx -V
nginx version: nginx/0.8.53
TLS SNI support enabled
configure arguments: --prefix=/usr/local/etc/nginx --with-cc-opt='-I
/usr/local/include' --with-ld-opt='-L /usr/local/lib'
--conf-path=/usr/local/etc/nginx/nginx.conf
--sbin-path=/usr/local/sbin/nginx --pid-path=/var/run/nginx.pid
--error-log-path=/var/log/nginx-error.log --user=www --group=www
--with-debug --with-file-aio
--http-client-body-temp-path=/var/tmp/nginx/client_body_temp
--http-fastcgi-temp-path=/var/tmp/nginx/fastcgi_temp
--http-proxy-temp-path=/var/tmp/nginx/proxy_temp
--http-scgi-temp-path=/var/tmp/nginx/scgi_temp
--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi_temp
--http-log-path=/var/log/nginx-access.log --with-http_flv_module
--with-http_realip_module --with-http_secure_link_module
--with-http_ssl_module --with-http_stub_status_module --with-pcre

конфиг хоста:

    location ~ \.php$ {
        try_files       $uri    =404;
        include         "fastcgi_params";
#        fastcgi_pass    unix:/var/run/php-fpm/e3forum.socket;
        fastcgi_pass    127.0.0.1:9001;
        fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

user    www www;

worker_processes    2;

error_log   /var/log/nginx-error.log;

pid         /var/run/nginx.pid;

events {
  worker_connections    1024;

  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" "$host"';

  access_log    /var/log/nginx-access.log    main;

  client_body_temp_path      /var/tmp/nginx/client_body_temp 1 2;

  client_header_timeout  3m;
  client_body_timeout    3m;
  send_timeout           3m;

  client_header_buffer_size    1k;
  large_client_header_buffers  4 4k;

  gzip on;
  gzip_min_length  1100;
  gzip_buffers     4 8k;
  gzip_types       text/plain;

  output_buffers   1 32k;
  postpone_output  1460;

  sendfile         on;
  tcp_nopush       on;
  tcp_nodelay      on;
  send_lowat       12000;

  keepalive_timeout  75 20;

  #lingering_time     30;
  #lingering_timeout  10;
  #reset_timedout_connection  on;

  fastcgi_buffer_size   128k;
  fastcgi_busy_buffers_size 128k;
  fastcgi_buffers   8   32k;

  include  vhosts/*.conf;
}


конфиг php-fpm:

[e3forum]
;listen = /var/run/php-fpm/e3forum.socket
listen = 127.0.0.1:9001
listen.owner = www
listen.group = www
listen.mode = 0600
user = e3forum
group = e3forum
listen.backlog = -1
pm = dynamic
pm.max_children = 10
pm.start_servers = 2
pm.min_spare_servers = 2
pm.max_spare_servers = 3
pm.max_requests = 1000
request_terminate_timeout = 0
request_slowlog_timeout = 0
slowlog = /var/log/php-fpm.log.slow
env[PATH] = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
php_value[post_max_size] = 100M
php_value[upload_max_filesize] = 100M
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx-ru/attachments/20101208/841233e4/attachment.html>


Подробная информация о списке рассылки nginx-ru