Залипает скачивание больших файлов

Alex Vorona voron на amhost.net
Чт Апр 29 05:08:40 MSD 2010


Привет,

Как обычно, качаю по localhost, для получения длинных sendfile

Linux 2.6.33.1-grsec x86_64

nginx version: nginx/0.8.36
TLS SNI support enabled
configure arguments: --prefix=/usr --sbin-path=/usr/sbin/nginx 
--conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error_log 
--pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx 
--with-cc-opt=-I/usr/include --with-ld-opt=-L/usr/lib 
--http-log-path=/var/log/nginx/access_log 
--http-client-body-temp-path=/var/tmp/nginx/client 
--http-proxy-temp-path=/var/tmp/nginx/proxy 
--http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --with-pcre --with-file-aio 
--with-aio_module --with-debug --with-http_flv_module --with-http_stub_status_module 
--with-http_realip_module --with-http_ssl_module --without-mail_imap_module 
--without-mail_pop3_module --without-mail_smtp_module
...
checking for epoll ... found
checking for sendfile() ... found
checking for sendfile64() ... found
...

После длинного sendfile, например

sendfile(8, 9, [827358294], 2147480490)     = 2147479552

nginx перестаёт отдавать данные, соединение зависает. В debug log что-то такое
2010/04/29 03:23:54 [debug] 32260#0: *13 write old buf t:0 f:1 0000000000000000, pos 
0000000000000000, size: 0 file: 826800830, size: 6335388760
2010/04/29 03:23:54 [debug] 32260#0: *13 http write filter: l:1 f:0 s:6335388760 

2010/04/29 03:23:54 [debug] 32260#0: *13 http write filter limit 0 

2010/04/29 03:23:54 [debug] 32260#0: *13 sendfile: @826800830 2147480898 

2010/04/29 03:23:54 [debug] 32260#0: *13 sendfile: 2147479552, @826800830 
2147479552:2147480898
2010/04/29 03:23:54 [debug] 32260#0: *13 http write filter 00000000006CC868 

2010/04/29 03:23:54 [debug] 32260#0: *13 http copy filter: -2 
"/tshare/tt/hdclub/Duo.luo.tian.shi.(Fallen.Angels).1995.720p.BluRay.Rus.Chi.HDCLUB.mkv?" 

2010/04/29 03:23:54 [debug] 32260#0: *13 http writer output filter: -2, 
"/tshare/tt/hdclub/Duo.luo.tian.shi.(Fallen.Angels).1995.720p.BluRay.Rus.Chi.HDCLUB.mkv
2010/04/29 03:23:54 [debug] 32260#0: *13 event timer: 3, old: 1272501234546, new: 
1272501234567
2010/04/29 03:26:23 [debug] 32260#0: *13 http run request: 
"/tshare/tt/hdclub/Duo.luo.tian.shi.(Fallen.Angels).1995.720p.BluRay.Rus.Chi.HDCLUB.mkv?" 

2010/04/29 03:26:23 [debug] 32260#0: *13 http test reading 

2010/04/29 03:26:23 [info] 32260#0: *13 client closed prematurely connection while sending 
response to client,


Включение sendfile_max_chunk 1M устраняет проблему.



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