﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	uname	nginx_version
504	the resourcenot release in time when file be truncated	Dane Zhang		"1,a client request a file;
2,nginx response the request use sendfile,;
3,the file be truncated (rsync etc)
4,nginx have not detect this condition in time;
5,nginx release the resource  (local fd and socket) after time out;

patch:
--- ngx_linux_sendfile_chain.c       2014-02-14 11:18:43.772856547 +0800
+++ ngx_linux_sendfile_chain.c  2014-02-14 14:28:55.644845942 +0800
@@ -286,6 +286,22 @@
 
             sent = rc > 0 ? rc : 0;
 
+                       if (rc == 0)
+                       {
+                               ngx_file_info_t new_info;
+                               if (ngx_file_info(file->file->name.data, &new_info) == 0)
+                               {
+                                       if (new_info.st_size < file->file_last)
+                                       {
+                                               ngx_log_error(NGX_LOG_ALERT, c->log, 0,
+                                                               ""sendfile error: %d, %s, %O < %O"",
+                                                               rc, file->file->name.data, new_info.st_size, file->file_last);
+                                               wev->error = 1;
+                                               return NGX_CHAIN_ERROR;
+                                       }
+                               }
+                       }
+"	defect	closed	minor		nginx-core	1.5.x	fixed	sendfile , file be truncated		Linux YFXINX81-32-DX-APP.opi.com. 2.6.39-900.109.1.reiserfs.el5uek #1 SMP Fri Jun 28 20:11:06 CST 2013 x86_64 x86_64 x86_64 GNU/Linux	"nginx version: nginx/1.5.7
built by gcc 4.1.2 20080704 (Red Hat 4.1.2-54)
configure arguments: --prefix=/diska/sys_dev/ng_patch/"
