I use nginx to serve static files and I have a strange problem: Sometimes (unfortunately not reproducable) a static file is only delivered partially to a client. What could be the cause for this?
I see the following in the access log:
CLIENT_IP - [-] [25/Aug/2012:16:11:07 +0200] "GET /resources/downloads/41aa97e0f06c78bea86662e13e7818cd8343ee29.zip HTTP/1.1" 200 30430810 USER_AGENT_OMITTED CLIENT_IP - [-] [25/Aug/2012:16:32:03 +0200] "GET /resources/downloads/41aa97e0f06c78bea86662e13e7818cd8343ee29.zip HTTP/1.1" 200 29577938 USER_AGENT_OMITTED
Obviously, the client tried to download the file twice and got about 30 megabytes once and about 29 megabytes on the second try. nginx reported status 200 for both requests. The error log is empty, the file exists and is readable by the nginx worker user (rails):
~$ ls -l /mnt/share/resources/downloads/41aa97e0f06c78bea86662e13e7818cd8343ee29.zip -rw-r--r-- 1 rails rails 67901051 Aug 25 17:54 /mnt/share/resources/downloads/41aa97e0f06c78bea86662e13e7818cd8343ee29.zip
When I try to download the file I get all 60 megabytes and everything works flawlessly...
Where should I start to look for the error? How does nginx respond to timeouts? Will it report them in the error log? What about the status code? Will nginx deliver status 200 even if some kind of problem occured?