# Partial downloads

**URL:** <https://www.ruby-forum.com/t/partial-downloads/216997>\
**Category:** NGINX\
**Created:** [February 18, 2012, 9:44pm UTC](https://www.ruby-forum.com/t/partial-downloads/216997 "2012-02-18T21:44:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [February 18, 2012, 9:44pm UTC](https://www.ruby-forum.com/t/partial-downloads/216997/1 "2012-02-18T21:44:36Z")

</div>

Hello, guys,

Recently, I’ve started seeing a strange problem - sometimes it happens  
that nginx only transfers only a small part of the file and the download  
gets interrupted. When I debug it, the issue narrows down to “client  
timed out (110: Connection timed out) while sending response to client”,  
but this is certainly not the case, as it happens very quickly (almost  
immediately after starting the download, in a less than a second). I  
don’t see anything unusual with tcpdump. I was wondering whether some of  
you has an idea what can be the root cause for this strange behaviour?  
Thanks in advance.

nginx version: nginx/1.1.15  
built by gcc 4.1.2 20080704 (Red Hat 4.1.2-51)  
TLS SNI support disabled  
configure arguments: --user=nginx --group=nginx  
–prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx  
–conf-path=/etc/nginx/nginx.conf  
–error-log-path=/var/log/nginx/nginx.log  
–http-log-path=/var/log/nginx/access.log  
–http-client-body-temp-path=/var/lib/nginx/tmp/client\_body  
–http-proxy-temp-path=/var/lib/nginx/tmp/proxy  
–http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi  
–http-scgi-temp-path=/var/lib/nginx/tmp/scgi  
–pid-path=/var/run/nginx.pid --lock-path=/var/lock/subsys/nginx  
–with-debug --with-http\_ssl\_module --with-http\_geoip\_module  
–with-http\_sub\_module --with-http\_realip\_module  
–with-http\_gzip\_static\_module --with-http\_random\_index\_module  
–with-http\_secure\_link\_module --with-http\_degradation\_module  
–with-http\_stub\_status\_module --with-http\_dav\_module  
–without-mail\_pop3\_module --without-mail\_imap\_module  
–without-mail\_smtp\_module --without-http\_uwsgi\_module --with-file-aio  
–with-cc-opt=‘-O2 -g -m32 -march=i686 -mtune=generic  
-fasynchronous-unwind-tables’

2.6.18-274.7.1.el5PAE i686

aio on  
sendfile on  
directio on  
tcp\_nodelay off  
tcp\_nopush off  
open\_file\_cache on  
client\_body\_timeout 10  
client\_header\_timeout 10  
send\_timeout 10  
keepalive\_timeout 30  
max\_ranges 5

Posted at Nginx Forum:

> **[Partial downloads](https://forum.nginx.org/read.php?2,222614,222614#msg-222614)**
>
> Hello, guys, Recently, I've started seeing a strange problem - sometimes it happens that nginx only transfers only a small part of the file and the download gets interrupted. When I debug it, the issue narrows down to "client timed out (110:...

---

<div class="post-metadata">

**Author:** ![Samael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b5ac83/32.png) [@Samael](https://www.ruby-forum.com/u/Samael)\
**Post date:** [February 18, 2012, 10:49pm UTC](https://www.ruby-forum.com/t/partial-downloads/216997/2 "2012-02-18T22:49:42Z")

</div>

Hello!

On Sat, Feb 18, 2012 at 03:43:59PM -0500, Samael wrote:

> Thanks in advance.  
> Could you please provide debug log? See  
> [GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com · GitHub](http://wiki.nginx.org/Debugging) for details.

Maxim D.

---

<div class="post-metadata">

**Author:** ![Samael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b5ac83/32.png) [@Samael](https://www.ruby-forum.com/u/Samael)\
**Post date:** [February 18, 2012, 11:13pm UTC](https://www.ruby-forum.com/t/partial-downloads/216997/3 "2012-02-18T23:13:52Z")

</div>

Of course - [http://pastebin.com/raw.php?i=RnZv58Zq](http://pastebin.com/raw.php?i=RnZv58Zq)

Posted at Nginx Forum:

> **[Re: Partial downloads](https://forum.nginx.org/read.php?2,222614,222619#msg-222619)**
>
> Hello, guys, Recently, I've started seeing a strange problem - sometimes it happens that nginx only transfers only a small part of the file and the download gets interrupted. When I debug it, the issue narrows down to "client timed out (110:...

---

<div class="post-metadata">

**Author:** ![Samael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b5ac83/32.png) [@Samael](https://www.ruby-forum.com/u/Samael)\
**Post date:** [February 18, 2012, 11:38pm UTC](https://www.ruby-forum.com/t/partial-downloads/216997/4 "2012-02-18T23:38:03Z")

</div>

Hello!

On Sat, Feb 18, 2012 at 05:13:37PM -0500, Samael wrote:

> Of course - [http://pastebin.com/raw.php?i=RnZv58Zq](http://pastebin.com/raw.php?i=RnZv58Zq)

The log in question suggests there is just normal send\_timeout:

…  
2012/02/18 22:03:36 [debug] 4368#0: \*1 sendfile: @2273599 684918465  
2012/02/18 22:03:36 [debug] 4368#0: \*1 sendfile: 96360, @2273599  
96360:684918465  
2012/02/18 22:03:36 [debug] 4368#0: \*1 http write filter 0835AC9C  
2012/02/18 22:03:36 [debug] 4368#0: \*1 http copy filter: -2  
“/test/bigfile?”  
2012/02/18 22:03:36 [debug] 4368#0: \*1 http writer output filter: -2,  
“/test/bigfile?”  
2012/02/18 22:03:36 [debug] 4368#0: \*1 event timer: 23, old: 2450531909,  
new: 2450532133  
2012/02/18 22:03:49 [debug] 4368#0: \*1 event timer del: 23: 2450531909  
2012/02/18 22:03:49 [debug] 4368#0: \*1 http run request:  
“/test/bigfile?”  
2012/02/18 22:03:49 [debug] 4368#0: \*1 http writer handler:  
“/test/bigfile?”  
2012/02/18 22:03:49 [info] 4368#0: \*1 client timed out (110: Connection  
timed out) while sending response to client, client: 1.1.1.2, server:  
1.1.1.1, request: “GET /test/bigfile HTTP/1.1”, host: “1.1.1.1”,  
referrer: “[http://1.1.1.1/test/](http://1.1.1.1/test/)”  
2012/02/18 22:03:49 [debug] 4368#0: \*1 http finalize request: 408,  
“/test/bigfile?” a:1, c:1  
…

Note that nothing happens with the connection in question between  
“22:03:36” and “22:03:49”. Looks ok unless you have additional  
info which suggests that data from socket buffer was sent to  
the client and it’s nginx fault it doesn’t sent more data.

It’s slightly off from expected 10 seconds as per your config part  
you’ve provided, though this is likely related to the fact that your  
nginx processes are disk-bound and nginx wasn’t able to process  
timer in time. You may want to take a look at sendfile\_max\_chunk  
directive, see

> **[Module ngx\_http\_core\_module](http://nginx.org/en/docs/http/ngx_http_core_module.html#sendfile_max_chunk)**
>
> This directive appeared in version 1.11.8.

Maxim D.

---

<div class="post-metadata">

**Author:** ![Samael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b5ac83/32.png) [@Samael](https://www.ruby-forum.com/u/Samael)\
**Post date:** [February 19, 2012, 12:24am UTC](https://www.ruby-forum.com/t/partial-downloads/216997/5 "2012-02-19T00:24:25Z")

</div>

Thank you, this was useful. I’ve tried it again and this time I  
correlated the events in the log and the tcpdump capture.

It seems that the client is requesting a window update, which doesn’t  
receive an answer and triggers the send timeout. I think that this is  
the issue.

Thank you very much for your help.

Posted at Nginx Forum:

> **[Re: Partial downloads](https://forum.nginx.org/read.php?2,222614,222621#msg-222621)**
>
> Hello, guys, Recently, I've started seeing a strange problem - sometimes it happens that nginx only transfers only a small part of the file and the download gets interrupted. When I debug it, the issue narrows down to "client timed out (110:...
