Opened 7 years ago

Closed 7 years ago

#1258 closed defect (invalid)

Network error when download file by using HTTP/2

Reported by: cangmingh@… Owned by:
Priority: minor Milestone:
Component: nginx-core Version: 1.10.x
Keywords: HTTP/2 Cc:
uname -a: Linux WebBenchmark 4.7.2-1-ARCH #1 SMP PREEMPT Sat Aug 20 23:02:56 CEST 2016 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.10.1
built with OpenSSL 1.0.2h 3 May 2016
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --sbin-path=/usr/bin/nginx --pid-path=/run/ --lock-path=/run/lock/nginx.lock --user=http --group=http --http-log-path=/var/log/nginx/access.log --error-log-path=stderr --http-client-body-temp-path=/var/lib/nginx/client-body --http-proxy-temp-path=/var/lib/nginx/proxy --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-ipv6 --with-pcre-jit --with-file-aio --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_degradation_module --with-http_flv_module --with-http_geoip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_realip_module --with-http_secure_link_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_ssl_module --with-threads


Download file with slow speed by using HTTP/2. The network error will occur after 5~10 minutes of the start of the download.

I also use H2O for test. No network error happens.

This issue can be reproduced by the following steps:

  1. Create a big file under nginx document root. Maybe 1GB. And let nginx run with HTTP/2
  2. Open google-chrome browser and enable browser develop tool. Chose network tab and set throttling as GPRS. (My google-chrome version is 55.0.2883.75 (64-bit))
  3. Request the file created in step 1 with HTTPS.

Change History (3)

comment:1 by Ilyas Bakirov, 7 years ago

Could you please share nginx configuration file?

comment:2 by cangmingh@…, 7 years ago

There is my nginx config.

comment:3 by Maxim Dounin, 7 years ago

Resolution: invalid
Status: newclosed

The problem is that throttling implementation in Chrome introduces large enough buffering somewhere along the path, and this results in send_timeout being eventually triggered due to a delay between network operations on nginx side. Here is tcpdump when timeout happens:

16:43:46.940623 IP > Flags [P.], seq 11774023:11774508, ack 1427, win 1040, options [nop,nop,TS val 387266307 ecr 619918476], length 485
16:43:46.940740 IP > Flags [P.], seq 11774508:11774609, ack 1427, win 1040, options [nop,nop,TS val 387266307 ecr 619918476], length 101
16:43:46.940791 IP > Flags [.], ack 11774508, win 9329, options [nop,nop,TS val 619918477 ecr 387266307], length 0
16:43:46.940810 IP > Flags [.], ack 11774609, win 9387, options [nop,nop,TS val 619918477 ecr 387266307], length 0
16:44:32.070405 IP > Flags [.], ack 11774609, win 9390, length 0
16:44:32.070496 IP > Flags [.], ack 1427, win 1040, options [nop,nop,TS val 387311438 ecr 619918477], length 0
16:44:46.176462 IP > Flags [P.], seq 11774609:11774651, ack 1427, win 1040, options [nop,nop,TS val 387325544 ecr 619918477], length 42
16:44:46.176734 IP > Flags [.], ack 11774651, win 9388, options [nop,nop,TS val 619977535 ecr 387325544], length 0

Last bytes of the response are sent at 16:43:46.940740, and at 16:44:46.176462 nginx closes the request due to timeout. Error log and access log:

2017/04/26 13:44:46 [info] 12234#100130: *3 client timed out (60: Operation timed out) while sending response to client, client:, server: , request: "GET /t/256m HTTP/2.0", host: "vm-bsd:8443" - - [26/Apr/2017:13:44:46 +0000] "GET /t/256m HTTP/2.0" 200 6291456 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36"

If you want this to be fixed, consider reporting this to Chrome team, they may want to improve their throttling logic to avoid buffering large amounts of data and thus introducing long delays.

Note: See TracTickets for help on using tickets.