[PATCH]Upstream: fix possible request hang when "proxy_buffering" is off.

Maxim Dounin mdounin at mdounin.ru
Thu Jun 26 12:08:06 UTC 2014


Hello!

On Thu, Jun 26, 2014 at 11:10:53AM +0800, flygoast wrote:

> You're right. It still can hang. I have another question:
> 
> 
> What's the meaning for "c->sent - sent >= limit - (off_t) (2 * ngx_pagesize))"?
> 
> 
> I don't understand it. Why "2 * ngx_pagesize"? Can you help to explain the logic?

This logic was introduced by Igor in this commit:

http://hg.nginx.org/nginx/rev/e67ef50c3176

Idea is to match cases when amout of disk-related work (almost) 
matches the one allowed by sendfile_max_chunk.  AFAIK, the 
"ngx_pagesize" is due to the fact that reading even single 
unaligned byte is identical to reading the whole page from disk, 
and "2" as there are normally two unaligend ends.  That is, if 
4098 bytes were sent, it means that up to 3 * 4096 bytes were read 
from from disk.

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx-devel mailing list