<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;">
<div>Hello,</div>
<div><br>
</div>
<div>I have nginx configured to send files in chunks to remote clients. The clients will contact the server to send it in chunks of 1 MB each. I am using nginx version 1.8.0</div>
<div><br>
</div>
<div>
<p style="margin: 0px; font-size: 11px; font-family: Menlo;">[root@ph-rdu-external-download-01 sbin]# ./nginx -V</p>
<p style="margin: 0px; font-size: 11px; font-family: Menlo;">nginx version: nginx/1.8.0</p>
<p style="margin: 0px; font-size: 11px; font-family: Menlo;">built by gcc 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC) </p>
<p style="margin: 0px; font-size: 11px; font-family: Menlo;">built with OpenSSL 1.0.1e-fips 11 Feb 2013</p>
<p style="margin: 0px; font-size: 11px; font-family: Menlo;">TLS SNI support enabled</p>
<p style="margin: 0px; font-size: 11px; font-family: Menlo;">configure arguments: --user=nginx --group=nginx --prefix=/usr/local/nginx --lock-path=/var/lock/subsys/nginx --with-ld-opt=-Wl,-rpath,/usr/lib64 --with-debug --add-module=/root/integ/ngx_devel_kit-master/
 --add-module=/root/integ/lua-nginx-module-0.9.15 --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --without-http_autoindex_module --without-http_fastcgi_module --with-http_ssl_module --without-http_geo_module --without-http_empty_gif_module
 --without-http_ssi_module --without-http_userid_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --without-http_uwsgi_module --without-http_scgi_module --with-http_realip_module --with-http_gzip_static_module --with-http_stub_status_module
 --with-ipv6</p>
</div>
<div><br>
</div>
<div>Currently I am running into an issue, where if the last chunk size is very small (few bytes), the server doesn’t seem to the send the chunk correctly because of which the clients would re-try again for the same chunk. For some reason it is not able to
 send the last chunk. I have attached the debug logs to the thread. If you see the logs the last three writes seem to be for the same chunk of size 6672 bytes</div>
<div><br>
</div>
<div>However if the last chunk size relatively large, then download succeeds without any issues. The issue is seen when the last chunk size is very small. </div>
<div><br>
</div>
<div>My current nginx configuration is as follows</div>
<div><br>
</div>
<div><br>
</div>
<div>
<p style="margin: 0px; font-size: 11px; font-family: Menlo;">http {</p>
<p style="margin: 0px; font-size: 11px; font-family: Menlo;">        # Logging format</p>
<p style="margin: 0px; font-size: 11px; font-family: Menlo;">        log_format main '$remote_addr - $remote_user [$time_local]  ' '"$request_length" "$request_time" '</p>
<p style="margin: 0px; font-size: 11px; font-family: Menlo;">    '"$request" $status $bytes_sent ' '"$body_bytes_sent" "$bytes_sent" ';</p>
<p style="margin: 0px; font-size: 11px; font-family: Menlo;">        default_type                    application/octet-stream;</p>
<p style="margin: 0px; font-size: 11px; font-family: Menlo;">        include                         mime.types;</p>
<p style="margin: 0px; font-size: 11px; font-family: Menlo;">        keepalive_timeout               300 300;</p>
<p style="margin: 0px; font-size: 11px; font-family: Menlo;">        keepalive_requests              8000;</p>
<p style="margin: 0px; font-size: 11px; font-family: Menlo;">        charset                         utf-8;</p>
<p style="margin: 0px; font-size: 11px; font-family: Menlo;">        source_charset                  utf-8;</p>
<p style="margin: 0px; font-size: 11px; font-family: Menlo;">        # Check if it makes errors.</p>
<p style="margin: 0px; font-size: 11px; font-family: Menlo;">        ignore_invalid_headers      off;</p>
<p style="margin: 0px; font-size: 11px; font-family: Menlo;">        recursive_error_pages           on;</p>
<p style="margin: 0px; font-size: 11px; font-family: Menlo;">        sendfile                        on;</p>
<p style="margin: 0px; font-size: 11px; font-family: Menlo;">        server_tokens                   off;</p>
<p style="margin: 0px; font-size: 11px; font-family: Menlo;">        tcp_nodelay                     on;</p>
<p style="margin: 0px; font-size: 11px; font-family: Menlo;">        tcp_nopush                      off;</p>
</div>
<div>}</div>
<div><br>
</div>
<div>Regards,</div>
<div>Arun</div>
<div><br>
</div>
<div><br>
</div>
<div>
<p style="margin: 0px; font-size: 11px; font-family: Menlo;"><br>
</p>
<p style="margin: 0px; font-size: 11px; font-family: Menlo;"><br>
</p>
<p style="margin: 0px; font-size: 11px; font-family: Menlo;"><br>
</p>
<p style="margin: 0px; font-size: 11px; font-family: Menlo;"><br>
</p>
<p style="margin: 0px; font-size: 11px; font-family: Menlo;"><br>
</p>
</div>
</body>
</html>