Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
You have to activate debug logging and wait for a client who has that problem. I don't see any other way to hunt this problem down. –  Fleshgrinder Aug 28 '12 at 23:28
    
Thanks for the hint: the debug log shows a notification about "client connection timed out"... I'll investigate further... –  severin Sep 18 '12 at 15:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.